? 901462-notifo-coding-standards.patch
Index: notifo.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/notifo/notifo.info,v
retrieving revision 1.1
diff -u -p -r1.1 notifo.info
--- notifo.info	22 Jun 2010 22:11:05 -0000	1.1
+++ notifo.info	3 Sep 2010 13:42:26 -0000
@@ -1,3 +1,4 @@
+; $Id$
 name = Notifo
 description = "The notifo module"
 core = 6.x
Index: notifo.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/notifo/notifo.module,v
retrieving revision 1.3
diff -u -p -r1.3 notifo.module
--- notifo.module	25 Jun 2010 08:36:00 -0000	1.3
+++ notifo.module	3 Sep 2010 13:42:26 -0000
@@ -1,4 +1,10 @@
 <?php
+// $Id$
+
+/**
+ * @file
+ * API bridge to the Notifo mobile notification service.
+ */
 
 function notifo_action_info() {
   return array(
@@ -45,9 +51,6 @@ function notifo_send_notifo_action($obje
       $node = $object;
   }
 
-  
-  
-
   if (isset($node)) {
     if (!isset($account)) {
       $account = user_load(array('uid' => $node->uid));
@@ -60,8 +63,8 @@ function notifo_send_notifo_action($obje
   $language = user_preferred_language($account);
   
   $usernames = explode(",", $context['usernames']);
-  foreach($usernames as $username){
-    notifo_send_notification($username,$context['message'],variable_get('site_name', ""),$context['title'],NULL);
+  foreach ($usernames as $username) {
+    notifo_send_notification($username, $context['message'], variable_get('site_name', ""), $context['title'], NULL);
   }
 }
 
@@ -125,64 +128,62 @@ function notifo_send_notifo_action_submi
   $form_values = $form_state['values'];
   // Process the HTML form to store configuration. The keyed array that
   // we return will be serialized to the database.
-  variable_set('notifo_sp',$form_values['sp']);
-  variable_set('notifo_api_key',$form_values['api_key']);
+  variable_set('notifo_sp', $form_values['sp']);
+  variable_set('notifo_api_key', $form_values['api_key']);
   $usernames = explode(",", $form_values['usernames']);
-  foreach($usernames as $username){
-    if($form_values['sp'] != $username){
+  foreach ($usernames as $username) {
+    if ($form_values['sp'] != $username) {
       notifo_subscribe_user($username);
     }
   }
-  
+
   $params = array(
-    'sp' => $form_values['sp'],
+    'sp'        => $form_values['sp'],
     'api_key'   => $form_values['api_key'],
-    'usernames'   => $form_values['usernames'],
-    'title'   => $form_values['title'],
+    'usernames' => $form_values['usernames'],
+    'title'     => $form_values['title'],
     'message'   => $form_values['message'],
-    'url'   => $form_values['url'],
+    'url'       => $form_values['url'],
   );
   return $params;
 }
 
-function notifo_send_notification($to,$msg,$label,$title,$uri){
-  $sp = variable_get('notifo_sp','');
-  $api_key = variable_get('notifo_api_key','');
+function notifo_send_notification($to, $msg, $label, $title, $uri) {
+  $sp = variable_get('notifo_sp', '');
+  $api_key = variable_get('notifo_api_key', '');
   $url = "https://api.notifo.com/v1/send_notification";
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-  curl_setopt($ch, CURLOPT_POSTFIELDS, "to=".$to."&msg=".$msg."&label=".$label."&title=".$title."&uri=".$uri);
-  curl_setopt($ch, CURLOPT_USERPWD, $sp.":".$api_key);
-  curl_setopt($ch, CURLOPT_HEADER, false);
+  curl_setopt($ch, CURLOPT_POSTFIELDS, "to=" . $to . "&msg=" . $msg . "&label=" . $label . "&title=" . $title . "&uri=" . $uri);
+  curl_setopt($ch, CURLOPT_USERPWD, $sp . ":" . $api_key);
+  curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
   curl_setopt($ch, CURLOPT_POST, 1);
-  
 
   $result = curl_exec($ch);
 
-  watchdog('notifo','<pre>'.print_r($result,true).'</pre>');
+  watchdog('notifo', '<pre>' . print_r($result, TRUE) . '</pre>');
 }
 
-function notifo_subscribe_user($username){
-  $sp = variable_get('notifo_sp','');
-  $api_key = variable_get('notifo_api_key','');
+function notifo_subscribe_user($username) {
+  $sp = variable_get('notifo_sp', '');
+  $api_key = variable_get('notifo_api_key', '');
   $url = "https://api.notifo.com/v1/subscribe_user";
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-  curl_setopt($ch, CURLOPT_POSTFIELDS, "username=".$username);
-  curl_setopt($ch, CURLOPT_USERPWD, $sp.":".$api_key);
-  curl_setopt($ch, CURLOPT_HEADER, false);
+  curl_setopt($ch, CURLOPT_POSTFIELDS, "username=" . $username);
+  curl_setopt($ch, CURLOPT_USERPWD, $sp . ":" . $api_key);
+  curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
   curl_setopt($ch, CURLOPT_POST, 1);
-  
 
   $result = curl_exec($ch);
 
-  watchdog('notifo','<pre>'.print_r($result,true).'</pre>');
-}
\ No newline at end of file
+  watchdog('notifo', '<pre>' . print_r($result, TRUE) . '</pre>');
+}
