Passed
Push — master ( 4c0a0e...ed714b )
by Vitalii
01:17 queued 21s
created
drupal/sites/default/boinc/themes/boinc/template.php 5 patches
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -626,13 +626,13 @@  discard block
 block discarded – undo
626 626
   $sender = user_load($sender->uid);
627 627
   
628 628
   switch ($status) {
629
-    case FLAG_FRIEND_FLAGGED:
630
-      // Sender accepted recipient's friend request
631
-      $email['subject'] = bts('!name accepted your friend request [!site]', array(
632
-        '!name' => $sender->boincuser_name,
633
-        '!site' => variable_get('site_name', 'Drupal-BOINC'),
634
-        ), NULL, 'boinc:friend-request-email');
635
-      $email['body'] = bts('!name confirmed you as a friend on !site.
629
+  case FLAG_FRIEND_FLAGGED:
630
+    // Sender accepted recipient's friend request
631
+    $email['subject'] = bts('!name accepted your friend request [!site]', array(
632
+      '!name' => $sender->boincuser_name,
633
+      '!site' => variable_get('site_name', 'Drupal-BOINC'),
634
+      ), NULL, 'boinc:friend-request-email');
635
+    $email['body'] = bts('!name confirmed you as a friend on !site.
636 636
 
637 637
 Follow this link to view his or her profile:
638 638
 !link
@@ -641,17 +641,17 @@  discard block
 block discarded – undo
641 641
 
642 642
 Thanks,
643 643
 The !site team', array(
644
-        '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
645
-        '!site' => variable_get('site_name', 'Drupal-BOINC'),
646
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
647
-        '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
648
-        ), array(), NULL, 'boinc:friend-request-email');
649
-      break;
644
+      '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
645
+      '!site' => variable_get('site_name', 'Drupal-BOINC'),
646
+      '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
647
+      '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
648
+      ), array(), NULL, 'boinc:friend-request-email');
649
+    break;
650 650
 
651
-    case FLAG_FRIEND_PENDING:
652
-      // Sender is requesting to be recipient's friend
653
-      $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email');
654
-      $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
651
+  case FLAG_FRIEND_PENDING:
652
+    // Sender is requesting to be recipient's friend
653
+    $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email');
654
+    $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
655 655
 
656 656
 Follow the link below to view this request:
657 657
 !link
@@ -660,13 +660,13 @@  discard block
 block discarded – undo
660 660
 
661 661
 Thanks,
662 662
 The !site team', array(
663
-        '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
664
-        '!site' => variable_get('site_name', 'Drupal-BOINC'),
665
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
666
-        '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
667
-        ),
668
-      array(), NULL, 'boinc:friend-request-email');
669
-      break;
663
+      '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
664
+      '!site' => variable_get('site_name', 'Drupal-BOINC'),
665
+      '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
666
+      '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
667
+      ),
668
+    array(), NULL, 'boinc:friend-request-email');
669
+    break;
670 670
   }
671 671
   return $email;
672 672
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function boinc_links__system_main_menu($links, $menu, $element) {
84 84
   $html = '';
85
-  $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n";
85
+  $html .= '<ul id="'.$menu['id'].'" class="'.$menu['class'].'">'."\n";
86 86
   $item_count = count($links);
87 87
   $i = 1;
88 88
   foreach ($links as $key => $link) {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     if (strpos($key, 'active-trail')) $classes[] = 'active';
91 91
     if ($i == 1) $classes[] = 'first';
92 92
     if ($i == $item_count) $classes[] = 'last';
93
-    $html .= '<li class="' . implode(' ', $classes) .'">';
93
+    $html .= '<li class="'.implode(' ', $classes).'">';
94 94
     if ($link['title'] == 'Home') {
95 95
       $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link');
96 96
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
       if ($link['href'] == 'dashboard') {
100 100
         $item_count = privatemsg_unread_count();
101 101
         if ($item_count) {
102
-          $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
102
+          $link['title'] .= '</a> <a href="'.url('messages').'" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">'.$item_count.'</span></div>';
103 103
           $link['html'] = TRUE;
104 104
           $link['attributes']['class'] = 'compound';
105 105
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     if ($link['href'] == 'moderate') {
110 110
       $item_count = boincuser_moderation_queue_count();
111 111
       if ($item_count) {
112
-        $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
112
+        $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">'.$item_count.'</span></div>';
113 113
         $link['html'] = TRUE;
114 114
       }
115 115
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     $html .= '</li>';
118 118
     $i++;
119 119
   }
120
-  $html .= '</ul>' . "\n";
120
+  $html .= '</ul>'."\n";
121 121
   return $html;
122 122
 }
123 123
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     return '';
133 133
   }
134 134
   else {
135
-    return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n";
135
+    return '<li '.($active ? 'class="active" ' : '').'>'.$link."</li>\n";
136 136
   }
137 137
 }
138 138
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
   if (empty($locality)) {
198 198
     $locality = "en";
199 199
   }
200
-  $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png";
200
+  $vars['flag_path'] = base_path().path_to_theme()."/images/flags/{$locality}.png";
201 201
 
202 202
   $server_status_url = variable_get('boinc_server_status_url', '');
203 203
   if (!$server_status_url) {
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
   if (arg(0) == 'search') {
220 220
     unset($vars['title']);
221 221
   }
222
-  else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
222
+  else if ((arg(0) == 'account') AND (is_numeric(arg(1))) AND (empty(arg(2)))) {
223 223
     unset($vars['title']);
224 224
   }
225
-  else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
225
+  else if ((arg(0) == 'account') AND (arg(1) == 'profile')) {
226 226
     unset($vars['title']);
227 227
   }
228
-  else if ( (arg(0)=='dashboard') ) {
228
+  else if ((arg(0) == 'dashboard')) {
229 229
     unset($vars['title']);
230 230
   }
231
-  else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
231
+  else if ((arg(0) == 'community') AND ((arg(1) == 'teams') OR (arg(1) == 'stats'))) {
232 232
     unset($vars['title']);
233 233
   }
234 234
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
               $tab = str_replace('li class="', 'li class="first ', $tab);
245 245
           }
246 246
           if ($key == $last_key) {
247
-              $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>';
247
+              $tab = str_replace('li class="', 'li class="last ', $tab).'</ul>';
248 248
           }
249 249
       }
250 250
       elseif (strpos($tab, 'li ')) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
               $tab = str_replace('li ', 'li class="first" ', $tab);
253 253
           }
254 254
           if ($key == $last_key) {
255
-              $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>';
255
+              $tab = str_replace('li ', 'li class="last" ', $tab).'</ul>';
256 256
           }
257 257
       }
258 258
   }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
   // Optionally, run node-type-specific preprocess functions, like
291 291
   // boinc_preprocess_node_page() or boinc_preprocess_node_story().
292
-  $function = __FUNCTION__ . '_' . $vars['node']->type;
292
+  $function = __FUNCTION__.'_'.$vars['node']->type;
293 293
   if (function_exists($function)) {
294 294
     $function($vars, $hook);
295 295
   }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
   $vars['node']->comment = 0;
341 341
 
342 342
   $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1));
343
-  $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1);
343
+  $page_count = max(ceil($vars['comment_count']/$comments_per_page), 1);
344 344
   $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1));
345 345
 
346 346
   $links = $vars['links'];
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
   case 'boinc_host':
453 453
       $view = views_get_current_view();
454 454
       if (!($view->result)) {
455
-        $vars['footer'] = '<h3>' . bts ('Host not found in database.', array(), NULL, 'boinc:host-details') . '</h3>';
455
+        $vars['footer'] = '<h3>'.bts('Host not found in database.', array(), NULL, 'boinc:host-details').'</h3>';
456 456
       }
457 457
     break;
458 458
   case 'boinc_host_list':
@@ -471,10 +471,10 @@  discard block
 block discarded – undo
471 471
 
472 472
     if ($result) {
473 473
       // Display the stderr output in the footer
474
-      $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>';
475
-      $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>';
474
+      $vars['footer'] = '<h3>'.bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog').'</h3>';
475
+      $vars['footer'] .= '<pre>'.htmlspecialchars($result->result_stderr_out).'</pre>';
476 476
     } else {
477
-      $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>';
477
+      $vars['footer'] = '<h3>'.bts('Task not found in database.', array(), NULL, 'boinc:task-details').'</h3>';
478 478
     }
479 479
     break;
480 480
   case 'boinc_teams':
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     ob_start();
488 488
     // Get the workunit ID from the URL
489 489
     $result_id = arg(1);
490
-    require_boinc(array('util','boinc_db'));
490
+    require_boinc(array('util', 'boinc_db'));
491 491
     $wu = BoincWorkunit::lookup_id($result_id);
492 492
     if ($wu) {
493 493
       // Output from admin defined BOINC project-specific function
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
       // Output of project_workunit() gets caught in the buffer
496 496
       $vars['footer'] = ob_get_clean();
497 497
     } else {
498
-      $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>';
498
+      $vars['footer'] = '<h3>'.bts('Workunit not found in database.', array(), NULL, 'boinc:workunit-details').'</h3>';
499 499
     }
500 500
   default:
501 501
   }
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
       $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false);
518 518
     }
519 519
     elseif (is_string($user_image)) {
520
-      $author_picture .= '<img src="' . $user_image . '"/>';
520
+      $author_picture .= '<img src="'.$user_image.'"/>';
521 521
     }
522 522
   }
523 523
   $author_picture .= '</div>';
@@ -556,14 +556,14 @@  discard block
 block discarded – undo
556 556
   case 'profile':
557 557
   case 'user':
558 558
     $node = $variables['result']['node'];
559
-    $variables['url'] = url('account/' . $node->is_uid);
559
+    $variables['url'] = url('account/'.$node->is_uid);
560 560
     $variables['title'] = $node->tos_name;
561 561
     $variables['user_image'] = boincuser_get_user_profile_image($node->is_uid);
562 562
     $variables['account'] = user_load($node->is_uid);
563 563
     break;
564 564
   case 'team':
565 565
     $node = $variables['result']['node'];
566
-    $variables['url'] = url('/community/teams/' . $node->entity_id);;
566
+    $variables['url'] = url('/community/teams/'.$node->entity_id); ;
567 567
     break;
568 568
   case 'forum':
569 569
     $node = $variables['result']['node'];
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
     // Parent forum topic title
582 582
     $variables['parent_title'] = $drupalnode->title;
583 583
     // Link to the parent forum topic
584
-    $variables['parent_topic'] = l($drupalnode->title, drupal_get_path_alias('node/' . $nid) );
584
+    $variables['parent_topic'] = l($drupalnode->title, drupal_get_path_alias('node/'.$nid));
585 585
     // Get the taxonomy for the node, creates a link to the parent forum
586 586
     $taxonomy = reset($drupalnode->taxonomy);
587 587
     if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
   if (!arg(2)) {
600 600
     $message = '';
601 601
   }
602
-  return '<p>' . $message . '</p>';
602
+  return '<p>'.$message.'</p>';
603 603
 }
604 604
 
605 605
 /**
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 
616 616
     // Shorten the name when it is too long or it will break many tables.
617 617
     if (drupal_strlen($name) > 20) {
618
-      $name = drupal_substr($name, 0, 15) . '...';
618
+      $name = drupal_substr($name, 0, 15).'...';
619 619
     }
620 620
 
621 621
     if (user_access('access user profiles')) {
622
-      $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
622
+      $output = l($name, 'account/'.$object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
623 623
     }
624 624
     else {
625 625
       $output = check_plain($name);
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
       $output = check_plain($object->name);
638 638
     }
639 639
 
640
-    $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')';
640
+    $output .= ' ('.bts('not verified', array(), NULL, 'boinc:user-not-found').')';
641 641
   }
642 642
   else {
643 643
     $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user')));
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
  * Remove the link under text areas that reads:
651 651
  * "More information about formatting options"
652 652
  */
653
-function boinc_filter_tips_more_info () {
653
+function boinc_filter_tips_more_info() {
654 654
   return '';
655 655
 }
656 656
 
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 The !site team', array(
693 693
         '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
694 694
         '!site' => variable_get('site_name', 'Drupal-BOINC'),
695
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
696
-        '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
695
+        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message').': '.$flag->friend_message : '',
696
+        '!link' => url('account/'.$sender->uid, array('absolute' => TRUE)),
697 697
         ), array(), NULL, 'boinc:friend-request-email');
698 698
       break;
699 699
 
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 The !site team', array(
712 712
         '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
713 713
         '!site' => variable_get('site_name', 'Drupal-BOINC'),
714
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
714
+        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message').': '.$flag->friend_message : '',
715 715
         '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
716 716
         ),
717 717
       array(), NULL, 'boinc:friend-request-email');
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
  * Edit action links
725 725
  */
726 726
 function phptemplate_links($links, $attributes = array('class' => 'links')) {
727
-  if ($links){
727
+  if ($links) {
728 728
     // Remove flag-subscriptions link. It will be placed elsewhere.
729 729
     if (isset($links['flag-subscriptions'])) {
730 730
       unset($links['flag-subscriptions']);
731 731
     }
732 732
     // Reorder the links however you need them.
733
-    $links = reorder_links($links, array('comment_edit','quote','comment_add','comment_reply','flag-abuse_comment','flag-abuse_node'), array('comment_delete'));
733
+    $links = reorder_links($links, array('comment_edit', 'quote', 'comment_add', 'comment_reply', 'flag-abuse_comment', 'flag-abuse_node'), array('comment_delete'));
734 734
     // Use the built-in theme_links() function to format the $links array.
735 735
     return theme_links($links, $attributes);
736 736
   }
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
   // are the class attribute for the <li> tags.
814 814
   $dom = new DOMDocument;
815 815
   $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8'));
816
-  foreach($dom->getElementsByTagName('li') as $node) {
816
+  foreach ($dom->getElementsByTagName('li') as $node) {
817 817
     $key = $node->getAttribute("class");
818 818
     $alllinks[$key] = $dom->saveHTML($node);
819 819
   }
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
     "hide", "unhide",
827 827
     "comment_delete",
828 828
   );
829
-  foreach(array_keys($alllinks) as $key1) {
829
+  foreach (array_keys($alllinks) as $key1) {
830 830
     // Select string up to first space, if present.
831 831
     $class1 = strtok($key1, ' ');
832 832
     if (in_array($class1, $selected_classes)) {
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
     $dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8'));
856 856
 
857 857
     $myli = $dom->getElementsByTagName('li');
858
-    if ($myli->length>0) {
858
+    if ($myli->length > 0) {
859 859
       $newclasses = trim(($myli[0]->getAttribute("class"))." first");
860 860
       $myli[0]->setAttribute("class", $newclasses);
861 861
       $alink = $dom->saveHTML($myli[0]);
@@ -872,13 +872,13 @@  discard block
 block discarded – undo
872 872
 
873 873
   $output = '<ul class="menu"><li class="first">';
874 874
   if ($user->uid) {
875
-    $output .= '<a href="' . url('logout') . '">' . bts('Logout', array(), NULL, 'boinc:menu-link') . '</a>';
875
+    $output .= '<a href="'.url('logout').'">'.bts('Logout', array(), NULL, 'boinc:menu-link').'</a>';
876 876
   } else {
877
-    $output .= '<a href="' . url('user/login', array('query' => drupal_get_destination()) ) . '">' . bts('Login', array(), NULL, 'boinc:menu-link') . '</a>';
877
+    $output .= '<a href="'.url('user/login', array('query' => drupal_get_destination())).'">'.bts('Login', array(), NULL, 'boinc:menu-link').'</a>';
878 878
   }
879 879
   $output .= '</li>';
880 880
   if (module_exists('global_search') OR module_exists('global_search_solr')) {
881
-    $output .= '<li class="last"> <a class="search" href="' . url('search/site') . '">' . bts('search', array(), NULL, 'boinc:menu-link') .'</a> </l1>';
881
+    $output .= '<li class="last"> <a class="search" href="'.url('search/site').'">'.bts('search', array(), NULL, 'boinc:menu-link').'</a> </l1>';
882 882
   }
883 883
   $output .= '</ul>';
884 884
   return $output;
@@ -905,8 +905,8 @@  discard block
 block discarded – undo
905 905
     if ($ignored[$object->uid] == 0) {
906 906
       $links['ignore_user'] = array(
907 907
         'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
908
-        'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
909
-        'query' => 'destination='. $_GET['q'],
908
+        'href' => 'account/prefs/privacy/ignore_user/add/'.$object->uid,
909
+        'query' => 'destination='.$_GET['q'],
910 910
         'attributes' => array(
911 911
           'class' => 'ignore-user',
912 912
           'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
@@ -921,8 +921,8 @@  discard block
 block discarded – undo
921 921
     if ($ignored[$object->uid] == 0) {
922 922
       $links['ignore_user'] = array(
923 923
         'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
924
-        'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
925
-        'query' => 'destination='. $_GET['q'],
924
+        'href' => 'account/prefs/privacy/ignore_user/add/'.$object->uid,
925
+        'query' => 'destination='.$_GET['q'],
926 926
         'attributes' => array(
927 927
           'class' => 'ignore-user',
928 928
           'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
Please login to merge, or discard this patch.
Braces   +15 added lines, -29 removed lines patch added patch discarded remove patch
@@ -130,8 +130,7 @@  discard block
 block discarded – undo
130 130
   AND strpos($link, 'Edit Panel')) {
131 131
     // Remove Edit Panel tab
132 132
     return '';
133
-  }
134
-  else {
133
+  } else {
135 134
     return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n";
136 135
   }
137 136
 }
@@ -218,17 +217,13 @@  discard block
 block discarded – undo
218 217
   // See: https://dev.gridrepublic.org/browse/DBOINC-65
219 218
   if (arg(0) == 'search') {
220 219
     unset($vars['title']);
221
-  }
222
-  else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
220
+  } else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
223 221
     unset($vars['title']);
224
-  }
225
-  else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
222
+  } else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
226 223
     unset($vars['title']);
227
-  }
228
-  else if ( (arg(0)=='dashboard') ) {
224
+  } else if ( (arg(0)=='dashboard') ) {
229 225
     unset($vars['title']);
230
-  }
231
-  else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
226
+  } else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
232 227
     unset($vars['title']);
233 228
   }
234 229
 
@@ -246,8 +241,7 @@  discard block
 block discarded – undo
246 241
           if ($key == $last_key) {
247 242
               $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>';
248 243
           }
249
-      }
250
-      elseif (strpos($tab, 'li ')) {
244
+      } elseif (strpos($tab, 'li ')) {
251 245
           if ($key == 0) {
252 246
               $tab = str_replace('li ', 'li class="first" ', $tab);
253 247
           }
@@ -400,8 +394,7 @@  discard block
 block discarded – undo
400 394
         $cid = boincuser_get_first_unread_comment_id($topic->nid);
401 395
         if ($cid) {
402 396
           $variables['topics'][$id]->new_url = url("goto/comment/{$cid}");
403
-        }
404
-        else {
397
+        } else {
405 398
           // User hasn't visited this topic before, so all replies are new...
406 399
           $topic->new_replies = NULL;
407 400
         }
@@ -458,8 +451,7 @@  discard block
 block discarded – undo
458 451
   case 'boinc_host_list':
459 452
     if ($vars['display_id'] == 'page_2') {
460 453
      $vars['empty'] = boincwork_views_host_list_empty_text();
461
-    }
462
-    elseif ($vars['display_id'] == 'page_1') {
454
+    } elseif ($vars['display_id'] == 'page_1') {
463 455
       $vars['empty'] = boincwork_views_host_list_empty_text('active');
464 456
     }
465 457
     break;
@@ -515,8 +507,7 @@  discard block
 block discarded – undo
515 507
   if ($user_image) {
516 508
     if (is_array($user_image) AND $user_image['image']['filepath']) {
517 509
       $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false);
518
-    }
519
-    elseif (is_string($user_image)) {
510
+    } elseif (is_string($user_image)) {
520 511
       $author_picture .= '<img src="' . $user_image . '"/>';
521 512
     }
522 513
   }
@@ -620,26 +611,22 @@  discard block
 block discarded – undo
620 611
 
621 612
     if (user_access('access user profiles')) {
622 613
       $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
623
-    }
624
-    else {
614
+    } else {
625 615
       $output = check_plain($name);
626 616
     }
627
-  }
628
-  else if ($object->name) {
617
+  } else if ($object->name) {
629 618
     // Sometimes modules display content composed by people who are
630 619
     // not registered members of the site (e.g. mailing list or news
631 620
     // aggregator modules). This clause enables modules to display
632 621
     // the true author of the content.
633 622
     if (!empty($object->homepage)) {
634 623
       $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
635
-    }
636
-    else {
624
+    } else {
637 625
       $output = check_plain($object->name);
638 626
     }
639 627
 
640 628
     $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')';
641
-  }
642
-  else {
629
+  } else {
643 630
     $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user')));
644 631
   }
645 632
 
@@ -724,7 +711,7 @@  discard block
 block discarded – undo
724 711
  * Edit action links
725 712
  */
726 713
 function phptemplate_links($links, $attributes = array('class' => 'links')) {
727
-  if ($links){
714
+  if ($links) {
728 715
     // Remove flag-subscriptions link. It will be placed elsewhere.
729 716
     if (isset($links['flag-subscriptions'])) {
730 717
       unset($links['flag-subscriptions']);
@@ -913,8 +900,7 @@  discard block
 block discarded – undo
913 900
         ),
914 901
       );
915 902
     }
916
-  }
917
-  else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
903
+  } else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
918 904
     if (!isset($ignored[$object->uid])) {
919 905
       $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
920 906
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     if ($i == $item_count) $classes[] = 'last';
93 93
     $html .= '<li class="' . implode(' ', $classes) .'">';
94 94
     if ($link['title'] == 'Home') {
95
-      $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link');
95
+      $link['title'] = bts('Home', array(), null, 'boinc:menu-link');
96 96
     }
97 97
     if (module_exists('privatemsg')) {
98 98
       // Put a new mail notification next to the Account menu item
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $item_count = privatemsg_unread_count();
101 101
         if ($item_count) {
102 102
           $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
103
-          $link['html'] = TRUE;
103
+          $link['html'] = true;
104 104
           $link['attributes']['class'] = 'compound';
105 105
         }
106 106
       }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
       $item_count = boincuser_moderation_queue_count();
111 111
       if ($item_count) {
112 112
         $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
113
-        $link['html'] = TRUE;
113
+        $link['html'] = true;
114 114
       }
115 115
     }
116 116
     $html .= l($link['title'], $link['href'], $link);
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 /**
126 126
  * Remove undesired local task tabs
127 127
  */
128
-function boinc_menu_local_task($link, $active = FALSE) {
129
-  if (strpos($link, 'admin/build/pages') !== FALSE
130
-  AND strpos($link, 'Edit Panel')) {
128
+function boinc_menu_local_task($link, $active = false) {
129
+  if (strpos($link, 'admin/build/pages') !== false
130
+  and strpos($link, 'Edit Panel')) {
131 131
     // Remove Edit Panel tab
132 132
     return '';
133 133
   }
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
   if (arg(0) == 'search') {
220 220
     unset($vars['title']);
221 221
   }
222
-  else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
222
+  else if ( (arg(0)=='account') and (is_numeric(arg(1))) and (empty(arg(2))) ) {
223 223
     unset($vars['title']);
224 224
   }
225
-  else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
225
+  else if ( (arg(0)=='account') and (arg(1)=='profile') ) {
226 226
     unset($vars['title']);
227 227
   }
228 228
   else if ( (arg(0)=='dashboard') ) {
229 229
     unset($vars['title']);
230 230
   }
231
-  else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
231
+  else if ( (arg(0)=='community') and ( (arg(1)=='teams') or (arg(1)=='stats') ) ) {
232 232
     unset($vars['title']);
233 233
   }
234 234
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     unset($vars['links']['forum']);
308 308
     // Add a link to manage subscriptions for the user
309 309
     $vars['links']['subscriptions'] = array(
310
-      'title' => bts('Manage subscriptions', array(), NULL, 'boinc:forum-footer'),
310
+      'title' => bts('Manage subscriptions', array(), null, 'boinc:forum-footer'),
311 311
       'href' => 'account/prefs/subscriptions',
312 312
     );
313 313
   }
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
   $vars['signature'] = check_markup($account->signature, $vars['node']->format);
332 332
 
333 333
   // Show signatures based on user preference
334
-  $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
334
+  $vars['show_signatures'] = ($user->hide_signatures) ? false : true;
335 335
 
336 336
   // Expose comment sort order so that the template can put the topic node
337 337
   // content (i.e. initial post) at the very end if "Newest post first" is the
338 338
   // preference used by this user
339
-  $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE;
339
+  $vars['oldest_post_first'] = ($user->sort != 1) ? true : false;
340 340
   $vars['node']->comment = 0;
341 341
 
342
-  $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1));
342
+  $vars['first_page'] = (!isset($_GET['page']) or ($_GET['page'] < 1));
343 343
   $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1);
344
-  $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1));
344
+  $vars['last_page'] = ($page_count == 1 or ($page_count > 1 and $_GET['page'] == $page_count - 1));
345 345
 
346 346
   $links = $vars['links'];
347 347
   $moderator_links = array();
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
   $vars['locality'] = $language->language;
379 379
 
380 380
   // Show signatures based on user preference
381
-  $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
381
+  $vars['show_signatures'] = ($user->hide_signatures) ? false : true;
382 382
 
383 383
   $links = $vars['links'];
384 384
   $moderator_links = array();
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         }
404 404
         else {
405 405
           // User hasn't visited this topic before, so all replies are new...
406
-          $topic->new_replies = NULL;
406
+          $topic->new_replies = null;
407 407
         }
408 408
       }
409 409
       // Use same logic in forum.module to change message if topic has
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
   case 'boinc_host':
453 453
       $view = views_get_current_view();
454 454
       if (!($view->result)) {
455
-        $vars['footer'] = '<h3>' . bts ('Host not found in database.', array(), NULL, 'boinc:host-details') . '</h3>';
455
+        $vars['footer'] = '<h3>' . bts ('Host not found in database.', array(), null, 'boinc:host-details') . '</h3>';
456 456
       }
457 457
     break;
458 458
   case 'boinc_host_list':
@@ -471,10 +471,10 @@  discard block
 block discarded – undo
471 471
 
472 472
     if ($result) {
473 473
       // Display the stderr output in the footer
474
-      $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>';
474
+      $vars['footer'] = '<h3>' . bts('Stderr output', array(), null, 'boinc:task-details-errorlog') .'</h3>';
475 475
       $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>';
476 476
     } else {
477
-      $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>';
477
+      $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), null, 'boinc:task-details') . '</h3>';
478 478
     }
479 479
     break;
480 480
   case 'boinc_teams':
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
       // Output of project_workunit() gets caught in the buffer
496 496
       $vars['footer'] = ob_get_clean();
497 497
     } else {
498
-      $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>';
498
+      $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), null, 'boinc:workunit-details') . '</h3>';
499 499
     }
500 500
   default:
501 501
   }
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
   $author_picture = '<div class="picture">';
514 514
   $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid);
515 515
   if ($user_image) {
516
-    if (is_array($user_image) AND $user_image['image']['filepath']) {
516
+    if (is_array($user_image) and $user_image['image']['filepath']) {
517 517
       $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false);
518 518
     }
519 519
     elseif (is_string($user_image)) {
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 // Remove the mess of text under the search form and don't display "no results"
596 596
 // if a search hasn't even been submitted
597 597
 function boinc_apachesolr_search_noresults() {
598
-  $message = bts('No results found...', array(), NULL, 'boinc:search-with-no-results');
598
+  $message = bts('No results found...', array(), null, 'boinc:search-with-no-results');
599 599
   if (!arg(2)) {
600 600
     $message = '';
601 601
   }
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
     }
620 620
 
621 621
     if (user_access('access user profiles')) {
622
-      $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
622
+      $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), null, 'boinc:users-table'))));
623 623
     }
624 624
     else {
625 625
       $output = check_plain($name);
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
       $output = check_plain($object->name);
638 638
     }
639 639
 
640
-    $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')';
640
+    $output .= ' (' . bts('not verified', array(), null, 'boinc:user-not-found') . ')';
641 641
   }
642 642
   else {
643
-    $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user')));
643
+    $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), null, 'boinc:anonymous-user')));
644 644
   }
645 645
 
646 646
   return $output;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
       $email['subject'] = bts('!name accepted your friend request [!site]', array(
681 681
         '!name' => $sender->boincuser_name,
682 682
         '!site' => variable_get('site_name', 'Drupal-BOINC'),
683
-        ), NULL, 'boinc:friend-request-email');
683
+        ), null, 'boinc:friend-request-email');
684 684
       $email['body'] = bts('!name confirmed you as a friend on !site.
685 685
 
686 686
 Follow this link to view his or her profile:
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
 The !site team', array(
693 693
         '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
694 694
         '!site' => variable_get('site_name', 'Drupal-BOINC'),
695
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
696
-        '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
697
-        ), array(), NULL, 'boinc:friend-request-email');
695
+        '!message' => $flag->friend_message ? bts('Message', array(), null, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
696
+        '!link' => url('account/'. $sender->uid, array('absolute' => true)),
697
+        ), array(), null, 'boinc:friend-request-email');
698 698
       break;
699 699
 
700 700
     case FLAG_FRIEND_PENDING:
701 701
       // Sender is requesting to be recipient's friend
702
-      $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email');
702
+      $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:friend-request-email');
703 703
       $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
704 704
 
705 705
 Follow the link below to view this request:
@@ -711,10 +711,10 @@  discard block
 block discarded – undo
711 711
 The !site team', array(
712 712
         '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
713 713
         '!site' => variable_get('site_name', 'Drupal-BOINC'),
714
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
715
-        '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
714
+        '!message' => $flag->friend_message ? bts('Message', array(), null, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
715
+        '!link' => url('goto/friend-requests', array('absolute' => true)),
716 716
         ),
717
-      array(), NULL, 'boinc:friend-request-email');
717
+      array(), null, 'boinc:friend-request-email');
718 718
       break;
719 719
   }
720 720
   return $email;
@@ -872,13 +872,13 @@  discard block
 block discarded – undo
872 872
 
873 873
   $output = '<ul class="menu"><li class="first">';
874 874
   if ($user->uid) {
875
-    $output .= '<a href="' . url('logout') . '">' . bts('Logout', array(), NULL, 'boinc:menu-link') . '</a>';
875
+    $output .= '<a href="' . url('logout') . '">' . bts('Logout', array(), null, 'boinc:menu-link') . '</a>';
876 876
   } else {
877
-    $output .= '<a href="' . url('user/login', array('query' => drupal_get_destination()) ) . '">' . bts('Login', array(), NULL, 'boinc:menu-link') . '</a>';
877
+    $output .= '<a href="' . url('user/login', array('query' => drupal_get_destination()) ) . '">' . bts('Login', array(), null, 'boinc:menu-link') . '</a>';
878 878
   }
879 879
   $output .= '</li>';
880
-  if (module_exists('global_search') OR module_exists('global_search_solr')) {
881
-    $output .= '<li class="last"> <a class="search" href="' . url('search/site') . '">' . bts('search', array(), NULL, 'boinc:menu-link') .'</a> </l1>';
880
+  if (module_exists('global_search') or module_exists('global_search_solr')) {
881
+    $output .= '<li class="last"> <a class="search" href="' . url('search/site') . '">' . bts('search', array(), null, 'boinc:menu-link') .'</a> </l1>';
882 882
   }
883 883
   $output .= '</ul>';
884 884
   return $output;
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
  * Private function, based on ignore_user ignore_user_link()
889 889
  * function. Modified for boinc functionality.
890 890
  */
891
-function _boinc_ignore_user_link($type, $object = NULL, $teaser = FALSE) {
891
+function _boinc_ignore_user_link($type, $object = null, $teaser = false) {
892 892
   global $user;
893 893
 
894 894
   if (!$user || !$user->uid) {
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
     }
905 905
     if ($ignored[$object->uid] == 0) {
906 906
       $links['ignore_user'] = array(
907
-        'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
907
+        'title' => bts('Ignore user', array(), null, 'boinc:ignore-user-add'),
908 908
         'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
909 909
         'query' => 'destination='. $_GET['q'],
910 910
         'attributes' => array(
911 911
           'class' => 'ignore-user',
912
-          'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
912
+          'title' => bts('Add user to your ignore list', array(), null, 'boinc:ignore-user-add'),
913 913
         ),
914 914
       );
915 915
     }
@@ -920,12 +920,12 @@  discard block
 block discarded – undo
920 920
     }
921 921
     if ($ignored[$object->uid] == 0) {
922 922
       $links['ignore_user'] = array(
923
-        'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
923
+        'title' => bts('Ignore user', array(), null, 'boinc:ignore-user-add'),
924 924
         'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
925 925
         'query' => 'destination='. $_GET['q'],
926 926
         'attributes' => array(
927 927
           'class' => 'ignore-user',
928
-          'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
928
+          'title' => bts('Add user to your ignore list', array(), null, 'boinc:ignore-user-add'),
929 929
         ),
930 930
       );
931 931
     }
Please login to merge, or discard this patch.
Indentation   +321 added lines, -321 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  * Implementation of HOOK_theme().
68 68
  */
69 69
 function boinc_theme(&$existing, $type, $theme, $path) {
70
-  $hooks = zen_theme($existing, $type, $theme, $path);
71
-  // Add your theme hooks like this:
72
-  /*
70
+    $hooks = zen_theme($existing, $type, $theme, $path);
71
+    // Add your theme hooks like this:
72
+    /*
73 73
   $hooks['hook_name_here'] = array( // Details go here );
74 74
   */
75
-  // @TODO: Needs detailed comments. Patches welcome!
76
-  return $hooks;
75
+    // @TODO: Needs detailed comments. Patches welcome!
76
+    return $hooks;
77 77
 }
78 78
 
79 79
 
@@ -81,44 +81,44 @@  discard block
 block discarded – undo
81 81
  * Adjust the rendering of the menu
82 82
  */
83 83
 function boinc_links__system_main_menu($links, $menu, $element) {
84
-  $html = '';
85
-  $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n";
86
-  $item_count = count($links);
87
-  $i = 1;
88
-  foreach ($links as $key => $link) {
84
+    $html = '';
85
+    $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n";
86
+    $item_count = count($links);
87
+    $i = 1;
88
+    foreach ($links as $key => $link) {
89 89
     $classes = array($key);
90 90
     if (strpos($key, 'active-trail')) $classes[] = 'active';
91 91
     if ($i == 1) $classes[] = 'first';
92 92
     if ($i == $item_count) $classes[] = 'last';
93 93
     $html .= '<li class="' . implode(' ', $classes) .'">';
94 94
     if ($link['title'] == 'Home') {
95
-      $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link');
95
+        $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link');
96 96
     }
97 97
     if (module_exists('privatemsg')) {
98
-      // Put a new mail notification next to the Account menu item
99
-      if ($link['href'] == 'dashboard') {
98
+        // Put a new mail notification next to the Account menu item
99
+        if ($link['href'] == 'dashboard') {
100 100
         $item_count = privatemsg_unread_count();
101 101
         if ($item_count) {
102
-          $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
103
-          $link['html'] = TRUE;
104
-          $link['attributes']['class'] = 'compound';
102
+            $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
103
+            $link['html'] = TRUE;
104
+            $link['attributes']['class'] = 'compound';
105
+        }
105 106
         }
106
-      }
107 107
     }
108 108
     // Put a count of items on the Moderation menu item
109 109
     if ($link['href'] == 'moderate') {
110
-      $item_count = boincuser_moderation_queue_count();
111
-      if ($item_count) {
110
+        $item_count = boincuser_moderation_queue_count();
111
+        if ($item_count) {
112 112
         $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
113 113
         $link['html'] = TRUE;
114
-      }
114
+        }
115 115
     }
116 116
     $html .= l($link['title'], $link['href'], $link);
117 117
     $html .= '</li>';
118 118
     $i++;
119
-  }
120
-  $html .= '</ul>' . "\n";
121
-  return $html;
119
+    }
120
+    $html .= '</ul>' . "\n";
121
+    return $html;
122 122
 }
123 123
 
124 124
 
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
  * Remove undesired local task tabs
127 127
  */
128 128
 function boinc_menu_local_task($link, $active = FALSE) {
129
-  if (strpos($link, 'admin/build/pages') !== FALSE
129
+    if (strpos($link, 'admin/build/pages') !== FALSE
130 130
   AND strpos($link, 'Edit Panel')) {
131 131
     // Remove Edit Panel tab
132 132
     return '';
133
-  }
134
-  else {
133
+    }
134
+    else {
135 135
     return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n";
136
-  }
136
+    }
137 137
 }
138 138
 
139 139
 
@@ -169,103 +169,103 @@  discard block
 block discarded – undo
169 169
  *   The name of the template being rendered ("page" in this case.)
170 170
  */
171 171
 function boinc_preprocess_page(&$vars, $hook) {
172
-  // Responsive Design: Add viewport meta tag to HTML head
173
-  drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />');
174
-  $vars['head'] = drupal_get_html_head();
175
-  //dpm($vars['head'], "preprocess (all) vars[head]");
176
-
177
-  // Expose comments to template files; this is needed so that comments can be
178
-  // rendered in locations other than directly below the node content
179
-  $vars['comments'] = $vars['comment_form'] = '';
180
-  if (module_exists('comment') && isset($vars['node'])) {
172
+    // Responsive Design: Add viewport meta tag to HTML head
173
+    drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />');
174
+    $vars['head'] = drupal_get_html_head();
175
+    //dpm($vars['head'], "preprocess (all) vars[head]");
176
+
177
+    // Expose comments to template files; this is needed so that comments can be
178
+    // rendered in locations other than directly below the node content
179
+    $vars['comments'] = $vars['comment_form'] = '';
180
+    if (module_exists('comment') && isset($vars['node'])) {
181 181
     $vars['comments'] = comment_render($vars['node']);
182 182
     $vars['comment_form'] = drupal_get_form('comment_form', array('nid' => $vars['node']->nid));
183
-  }
183
+    }
184 184
 
185
-  // Determine locale region code so the correct flag is displayed in footer
186
-  global $language;
187
-  global $theme_path;
188
-  $locality = $language->language;
189
-  if (strpos($language->language, '-')) {
185
+    // Determine locale region code so the correct flag is displayed in footer
186
+    global $language;
187
+    global $theme_path;
188
+    $locality = $language->language;
189
+    if (strpos($language->language, '-')) {
190 190
     $flag_icon = "{$theme_path}/images/flags/{$language->language}.png";
191 191
     if (!file_exists($flag_icon)) {
192
-      $lang_code = explode('-', $language->language);
193
-      $locality = $lang_code[0];
192
+        $lang_code = explode('-', $language->language);
193
+        $locality = $lang_code[0];
194 194
     }
195
-  }
196
-  // If there is no language set for some reason, default to English (en).
197
-  if (empty($locality)) {
195
+    }
196
+    // If there is no language set for some reason, default to English (en).
197
+    if (empty($locality)) {
198 198
     $locality = "en";
199
-  }
200
-  $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png";
199
+    }
200
+    $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png";
201 201
 
202
-  $server_status_url = variable_get('boinc_server_status_url', '');
203
-  if (!$server_status_url) {
202
+    $server_status_url = variable_get('boinc_server_status_url', '');
203
+    if (!$server_status_url) {
204 204
     $server_status_url = 'server_status.php';
205
-  }
206
-  $vars['server_status_url'] = $server_status_url;
205
+    }
206
+    $vars['server_status_url'] = $server_status_url;
207 207
 
208
-  $app_list_url = variable_get('boinc_app_list_url', '');
209
-  if (!$app_list_url) {
208
+    $app_list_url = variable_get('boinc_app_list_url', '');
209
+    if (!$app_list_url) {
210 210
     $app_list_url = 'apps.php';
211
-  }
212
-  $vars['app_list_url'] = $app_list_url;
213
-
214
-  // Remove title from certain pages using URL.
215
-  // This is a kludge to remove the title of the page but not the
216
-  // "head_title" which is placed in the HTML <head> section. Most of
217
-  // these pages are defined in the Page Manager module.
218
-  // See: https://dev.gridrepublic.org/browse/DBOINC-65
219
-  if (arg(0) == 'search') {
211
+    }
212
+    $vars['app_list_url'] = $app_list_url;
213
+
214
+    // Remove title from certain pages using URL.
215
+    // This is a kludge to remove the title of the page but not the
216
+    // "head_title" which is placed in the HTML <head> section. Most of
217
+    // these pages are defined in the Page Manager module.
218
+    // See: https://dev.gridrepublic.org/browse/DBOINC-65
219
+    if (arg(0) == 'search') {
220 220
     unset($vars['title']);
221
-  }
222
-  else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
221
+    }
222
+    else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
223 223
     unset($vars['title']);
224
-  }
225
-  else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
224
+    }
225
+    else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
226 226
     unset($vars['title']);
227
-  }
228
-  else if ( (arg(0)=='dashboard') ) {
227
+    }
228
+    else if ( (arg(0)=='dashboard') ) {
229 229
     unset($vars['title']);
230
-  }
231
-  else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
230
+    }
231
+    else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
232 232
     unset($vars['title']);
233
-  }
233
+    }
234 234
 
235
-  // Apply classes to tabs to allow for better styling options
236
-  $tabs = explode("\n", $vars['tabs']);
237
-  array_pop($tabs);
238
-  end($tabs);
239
-  $last_key = key($tabs);
240
-
241
-  foreach ($tabs as $key => &$tab) {
242
-      if (strpos($tab, 'li class=')) {
243
-          if ($key == 0) {
244
-              $tab = str_replace('li class="', 'li class="first ', $tab);
245
-          }
246
-          if ($key == $last_key) {
247
-              $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>';
248
-          }
249
-      }
250
-      elseif (strpos($tab, 'li ')) {
251
-          if ($key == 0) {
252
-              $tab = str_replace('li ', 'li class="first" ', $tab);
253
-          }
254
-          if ($key == $last_key) {
255
-              $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>';
256
-          }
257
-      }
258
-  }
259
-  $vars['tabs'] = implode("\n", $tabs);
235
+    // Apply classes to tabs to allow for better styling options
236
+    $tabs = explode("\n", $vars['tabs']);
237
+    array_pop($tabs);
238
+    end($tabs);
239
+    $last_key = key($tabs);
240
+
241
+    foreach ($tabs as $key => &$tab) {
242
+        if (strpos($tab, 'li class=')) {
243
+            if ($key == 0) {
244
+                $tab = str_replace('li class="', 'li class="first ', $tab);
245
+            }
246
+            if ($key == $last_key) {
247
+                $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>';
248
+            }
249
+        }
250
+        elseif (strpos($tab, 'li ')) {
251
+            if ($key == 0) {
252
+                $tab = str_replace('li ', 'li class="first" ', $tab);
253
+            }
254
+            if ($key == $last_key) {
255
+                $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>';
256
+            }
257
+        }
258
+    }
259
+    $vars['tabs'] = implode("\n", $tabs);
260 260
 
261
-  // Get the main menu but only for the branch the page is on.
262
-  $vars['menu_tree_onlyactive'] = menu_tree('primary-links');
261
+    // Get the main menu but only for the branch the page is on.
262
+    $vars['menu_tree_onlyactive'] = menu_tree('primary-links');
263 263
 
264
-  // Create tertiary menu
265
-  $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2);
264
+    // Create tertiary menu
265
+    $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2);
266 266
 
267
-  // Create action links
268
-  $vars['action_links'] = _boinc_action_links();
267
+    // Create action links
268
+    $vars['action_links'] = _boinc_action_links();
269 269
 }
270 270
 
271 271
 /**
@@ -278,79 +278,79 @@  discard block
 block discarded – undo
278 278
  */
279 279
 function boinc_preprocess_node(&$vars, $hook) {
280 280
 
281
-  //$vars['sample_variable'] = t('Lorem ipsum.');
281
+    //$vars['sample_variable'] = t('Lorem ipsum.');
282 282
 
283
-  // Detach subscribe link from the links list. Subscribe link will be placed
284
-  // on page separately from links.
285
-  if (!empty($vars['node']->links['flag-subscriptions']['title'])) {
283
+    // Detach subscribe link from the links list. Subscribe link will be placed
284
+    // on page separately from links.
285
+    if (!empty($vars['node']->links['flag-subscriptions']['title'])) {
286 286
     $vars['subscribe_link'] = $vars['node']->links['flag-subscriptions']['title'];
287 287
     unset($vars['node']->links['flag-subscriptions']);
288
-  }
288
+    }
289 289
 
290
-  // Optionally, run node-type-specific preprocess functions, like
291
-  // boinc_preprocess_node_page() or boinc_preprocess_node_story().
292
-  $function = __FUNCTION__ . '_' . $vars['node']->type;
293
-  if (function_exists($function)) {
290
+    // Optionally, run node-type-specific preprocess functions, like
291
+    // boinc_preprocess_node_page() or boinc_preprocess_node_story().
292
+    $function = __FUNCTION__ . '_' . $vars['node']->type;
293
+    if (function_exists($function)) {
294 294
     $function($vars, $hook);
295
-  }
295
+    }
296 296
 }
297 297
 
298 298
 /**
299 299
  * Preprocessing for forum lists
300 300
  */
301 301
 function boinc_preprocess_forums(&$vars, $hook) {
302
-  // Add a link to mark all forums as read
303
-  module_load_include('inc', 'forum_tweaks', 'includes/mark-read');
304
-  forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']);
305
-  if (!$vars['parents']) {
302
+    // Add a link to mark all forums as read
303
+    module_load_include('inc', 'forum_tweaks', 'includes/mark-read');
304
+    forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']);
305
+    if (!$vars['parents']) {
306 306
     // Remove the "Post new forum topic" link from the top level forum list
307 307
     unset($vars['links']['forum']);
308 308
     // Add a link to manage subscriptions for the user
309 309
     $vars['links']['subscriptions'] = array(
310
-      'title' => bts('Manage subscriptions', array(), NULL, 'boinc:forum-footer'),
311
-      'href' => 'account/prefs/subscriptions',
310
+        'title' => bts('Manage subscriptions', array(), NULL, 'boinc:forum-footer'),
311
+        'href' => 'account/prefs/subscriptions',
312 312
     );
313
-  }
313
+    }
314 314
 }
315 315
 
316 316
 /**
317 317
  * Preprocessing for forum type nodes
318 318
  */
319 319
 function boinc_preprocess_node_forum(&$vars, $hook) {
320
-  global $language;
321
-  global $user;
320
+    global $language;
321
+    global $user;
322 322
 
323
-  // Locality
324
-  $vars['locality'] = $language->language;
323
+    // Locality
324
+    $vars['locality'] = $language->language;
325 325
 
326
-  // Get the author of the node
327
-  $account = user_load($vars['uid']);
328
-  $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50);
326
+    // Get the author of the node
327
+    $account = user_load($vars['uid']);
328
+    $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50);
329 329
 
330
-  // Add signature
331
-  $vars['signature'] = check_markup($account->signature, $vars['node']->format);
330
+    // Add signature
331
+    $vars['signature'] = check_markup($account->signature, $vars['node']->format);
332 332
 
333
-  // Show signatures based on user preference
334
-  $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
333
+    // Show signatures based on user preference
334
+    $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
335 335
 
336
-  // Expose comment sort order so that the template can put the topic node
337
-  // content (i.e. initial post) at the very end if "Newest post first" is the
338
-  // preference used by this user
339
-  $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE;
340
-  $vars['node']->comment = 0;
336
+    // Expose comment sort order so that the template can put the topic node
337
+    // content (i.e. initial post) at the very end if "Newest post first" is the
338
+    // preference used by this user
339
+    $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE;
340
+    $vars['node']->comment = 0;
341 341
 
342
-  $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1));
343
-  $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1);
344
-  $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1));
342
+    $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1));
343
+    $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1);
344
+    $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1));
345 345
 
346
-  $links = $vars['links'];
347
-  $moderator_links = array();
348
-  _boinc_create_moderator_links($links, $moderator_links);
349
-  $vars['links'] = $links;
350
-  $vars['moderator_links'] = $moderator_links;
346
+    $links = $vars['links'];
347
+    $moderator_links = array();
348
+    _boinc_create_moderator_links($links, $moderator_links);
349
+    $vars['links'] = $links;
350
+    $vars['moderator_links'] = $moderator_links;
351 351
 
352
-  // Ignore user link
353
-  $vars['ignore_link'] = _boinc_ignore_user_link('node', $vars['node']);
352
+    // Ignore user link
353
+    $vars['ignore_link'] = _boinc_ignore_user_link('node', $vars['node']);
354 354
 }
355 355
 
356 356
 
@@ -371,48 +371,48 @@  discard block
 block discarded – undo
371 371
  *   The name of the template being rendered ("comment" in this case.)
372 372
  */
373 373
 function boinc_preprocess_comment(&$vars, $hook) {
374
-  global $language;
375
-  global $user;
374
+    global $language;
375
+    global $user;
376 376
 
377
-  // Locality
378
-  $vars['locality'] = $language->language;
377
+    // Locality
378
+    $vars['locality'] = $language->language;
379 379
 
380
-  // Show signatures based on user preference
381
-  $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
380
+    // Show signatures based on user preference
381
+    $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
382 382
 
383
-  $links = $vars['links'];
384
-  $moderator_links = array();
385
-  _boinc_create_moderator_links($links, $moderator_links);
386
-  $vars['links'] = $links;
387
-  $vars['moderator_links'] = $moderator_links;
383
+    $links = $vars['links'];
384
+    $moderator_links = array();
385
+    _boinc_create_moderator_links($links, $moderator_links);
386
+    $vars['links'] = $links;
387
+    $vars['moderator_links'] = $moderator_links;
388 388
 
389
-  // Ignore user link
390
-  $vars['ignore_link'] = _boinc_ignore_user_link('comment', $vars['comment']);
389
+    // Ignore user link
390
+    $vars['ignore_link'] = _boinc_ignore_user_link('comment', $vars['comment']);
391 391
 }
392 392
 
393 393
 /**
394 394
  *
395 395
  */
396 396
 function boinc_preprocess_forum_topic_list(&$variables) {
397
-  if (!empty($variables['topics'])) {
397
+    if (!empty($variables['topics'])) {
398 398
     foreach ($variables['topics'] as $id => $topic) {
399
-      if ($topic->new_replies) {
399
+        if ($topic->new_replies) {
400 400
         $cid = boincuser_get_first_unread_comment_id($topic->nid);
401 401
         if ($cid) {
402
-          $variables['topics'][$id]->new_url = url("goto/comment/{$cid}");
402
+            $variables['topics'][$id]->new_url = url("goto/comment/{$cid}");
403 403
         }
404 404
         else {
405
-          // User hasn't visited this topic before, so all replies are new...
406
-          $topic->new_replies = NULL;
405
+            // User hasn't visited this topic before, so all replies are new...
406
+            $topic->new_replies = NULL;
407
+        }
407 408
         }
408
-      }
409
-      // Use same logic in forum.module to change message if topic has
410
-      // moved. Changed link to match boinc path-added "community".
411
-      if ($topic->forum_tid != $variables['tid']) {
409
+        // Use same logic in forum.module to change message if topic has
410
+        // moved. Changed link to match boinc path-added "community".
411
+        if ($topic->forum_tid != $variables['tid']) {
412 412
         $variables['topics'][$id]->message = l(t('This topic has been moved'), "community/forum/$topic->forum_tid");
413
-      }
413
+        }
414
+    }
414 415
     }
415
-  }
416 416
 }
417 417
 
418 418
 /**
@@ -425,79 +425,79 @@  discard block
 block discarded – undo
425 425
  */
426 426
 ///* -- Delete this line if you want to use this function
427 427
 function boinc_preprocess_views_view(&$vars, $hook) {
428
-  switch ($vars['name']) {
429
-  case 'boinc_account_computers':
428
+    switch ($vars['name']) {
429
+    case 'boinc_account_computers':
430 430
     switch ($vars['display_id']) {
431 431
     case 'page_1':
432 432
     case 'panel_pane_1':
433 433
       $vars['empty'] = boincwork_views_host_list_empty_text();
434
-      break;
434
+        break;
435 435
     case 'page_2':
436 436
       $vars['empty'] = boincwork_views_host_list_empty_text('active');
437
-      break;
437
+        break;
438 438
     case 'block_1':
439 439
       $vars['empty'] = boincwork_views_host_list_empty_text('preferences');
440
-      break;
440
+        break;
441 441
     default:
442 442
     }
443 443
     break;
444
-  case 'boinc_account_tasks_all':
444
+    case 'boinc_account_tasks_all':
445 445
     $vars['empty'] = boincwork_views_task_list_empty_text();
446 446
     break;
447
-  case 'boinc_friends':
447
+    case 'boinc_friends':
448 448
     if ($vars['display_id'] == 'block_1') {
449
-      $vars['header'] = boincuser_views_friends_block_header();
449
+        $vars['header'] = boincuser_views_friends_block_header();
450 450
     }
451 451
     break;
452
-  case 'boinc_host':
452
+    case 'boinc_host':
453 453
       $view = views_get_current_view();
454
-      if (!($view->result)) {
454
+        if (!($view->result)) {
455 455
         $vars['footer'] = '<h3>' . bts ('Host not found in database.', array(), NULL, 'boinc:host-details') . '</h3>';
456
-      }
456
+        }
457 457
     break;
458
-  case 'boinc_host_list':
458
+    case 'boinc_host_list':
459 459
     if ($vars['display_id'] == 'page_2') {
460
-     $vars['empty'] = boincwork_views_host_list_empty_text();
460
+        $vars['empty'] = boincwork_views_host_list_empty_text();
461 461
     }
462 462
     elseif ($vars['display_id'] == 'page_1') {
463
-      $vars['empty'] = boincwork_views_host_list_empty_text('active');
463
+        $vars['empty'] = boincwork_views_host_list_empty_text('active');
464 464
     }
465 465
     break;
466
-  case 'boinc_task':
466
+    case 'boinc_task':
467 467
     // Load view object (view data is not available in header / footer); execute view query
468 468
     $view = views_get_current_view();
469 469
     $view->execute();
470 470
     $result = reset($view->result);
471 471
 
472 472
     if ($result) {
473
-      // Display the stderr output in the footer
474
-      $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>';
475
-      $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>';
473
+        // Display the stderr output in the footer
474
+        $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>';
475
+        $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>';
476 476
     } else {
477
-      $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>';
477
+        $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>';
478 478
     }
479 479
     break;
480
-  case 'boinc_teams':
480
+    case 'boinc_teams':
481 481
     if ($vars['display_id'] == 'panel_pane_3') {
482
-      $team_id = arg(2);
483
-      $vars['header'] = boincteam_manage_admins_panel_header($team_id);
482
+        $team_id = arg(2);
483
+        $vars['header'] = boincteam_manage_admins_panel_header($team_id);
484 484
     }
485 485
     break;
486
-  case 'boinc_workunit':
486
+    case 'boinc_workunit':
487 487
     ob_start();
488 488
     // Get the workunit ID from the URL
489 489
     $result_id = arg(1);
490 490
     require_boinc(array('util','boinc_db'));
491 491
     $wu = BoincWorkunit::lookup_id($result_id);
492 492
     if ($wu) {
493
-      // Output from admin defined BOINC project-specific function
494
-      project_workunit($wu);
495
-      // Output of project_workunit() gets caught in the buffer
496
-      $vars['footer'] = ob_get_clean();
493
+        // Output from admin defined BOINC project-specific function
494
+        project_workunit($wu);
495
+        // Output of project_workunit() gets caught in the buffer
496
+        $vars['footer'] = ob_get_clean();
497 497
     } else {
498
-      $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>';
498
+        $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>';
499 499
     }
500
-  default:
500
+    default:
501 501
   }
502 502
 }
503 503
 // */
@@ -510,19 +510,19 @@  discard block
 block discarded – undo
510 510
  */
511 511
 ///* -- Delete this line if you want to use this function
512 512
 function boinc_preprocess_privatemsg_view(&$vars, $hook) {
513
-  $author_picture = '<div class="picture">';
514
-  $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid);
515
-  if ($user_image) {
513
+    $author_picture = '<div class="picture">';
514
+    $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid);
515
+    if ($user_image) {
516 516
     if (is_array($user_image) AND $user_image['image']['filepath']) {
517
-      $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false);
517
+        $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false);
518 518
     }
519 519
     elseif (is_string($user_image)) {
520
-      $author_picture .= '<img src="' . $user_image . '"/>';
520
+        $author_picture .= '<img src="' . $user_image . '"/>';
521 521
     }
522
-  }
523
-  $author_picture .= '</div>';
524
-  $vars['author_picture'] = $author_picture;
525
-  $vars['message_timestamp'] = date('j M Y G:i:s T', $vars['message']['timestamp']);
522
+    }
523
+    $author_picture .= '</div>';
524
+    $vars['author_picture'] = $author_picture;
525
+    $vars['message_timestamp'] = date('j M Y G:i:s T', $vars['message']['timestamp']);
526 526
 }
527 527
 // */
528 528
 
@@ -541,19 +541,19 @@  discard block
 block discarded – undo
541 541
 // */
542 542
 
543 543
 function boinc_preprocess_search_result(&$variables) {
544
-  global $language;
545
-  // Locality
546
-  $variables['locality'] = $language->language;
544
+    global $language;
545
+    // Locality
546
+    $variables['locality'] = $language->language;
547 547
 
548
-  // Change the format of the search result date/time in the info string.
549
-  if ($variables['result']['date']) {
548
+    // Change the format of the search result date/time in the info string.
549
+    if ($variables['result']['date']) {
550 550
     $variables['info_split']['date'] = date('j M Y G:i:s T', $variables['result']['date']);
551
-  }
552
-  $variables['info'] = implode(' - ', $variables['info_split']);
551
+    }
552
+    $variables['info'] = implode(' - ', $variables['info_split']);
553 553
 
554
-  $type = strtolower($variables['result']['bundle']);
555
-  switch ($type) {
556
-  case 'profile':
554
+    $type = strtolower($variables['result']['bundle']);
555
+    switch ($type) {
556
+    case 'profile':
557 557
   case 'user':
558 558
     $node = $variables['result']['node'];
559 559
     $variables['url'] = url('account/' . $node->is_uid);
@@ -561,20 +561,20 @@  discard block
 block discarded – undo
561 561
     $variables['user_image'] = boincuser_get_user_profile_image($node->is_uid);
562 562
     $variables['account'] = user_load($node->is_uid);
563 563
     break;
564
-  case 'team':
564
+    case 'team':
565 565
     $node = $variables['result']['node'];
566 566
     $variables['url'] = url('/community/teams/' . $node->entity_id);;
567 567
     break;
568
-  case 'forum':
568
+    case 'forum':
569 569
     $node = $variables['result']['node'];
570 570
     $drupalnode = node_load($node->entity_id);
571 571
     // Get the taxonomy for the node, creates a link to the parent forum
572 572
     $taxonomy = reset($drupalnode->taxonomy);
573 573
     if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
574
-      $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
574
+        $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
575 575
     }
576 576
     break;
577
-  case 'comment':
577
+    case 'comment':
578 578
     // Get the node id for this comment
579 579
     $nid = $variables['result']['fields']['tos_content_extra'];
580 580
     $drupalnode = node_load($nid);
@@ -585,21 +585,21 @@  discard block
 block discarded – undo
585 585
     // Get the taxonomy for the node, creates a link to the parent forum
586 586
     $taxonomy = reset($drupalnode->taxonomy);
587 587
     if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
588
-      $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
588
+        $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
589 589
     }
590
-  break;
591
-  default:
590
+    break;
591
+    default:
592 592
   }
593 593
 }
594 594
 
595 595
 // Remove the mess of text under the search form and don't display "no results"
596 596
 // if a search hasn't even been submitted
597 597
 function boinc_apachesolr_search_noresults() {
598
-  $message = bts('No results found...', array(), NULL, 'boinc:search-with-no-results');
599
-  if (!arg(2)) {
598
+    $message = bts('No results found...', array(), NULL, 'boinc:search-with-no-results');
599
+    if (!arg(2)) {
600 600
     $message = '';
601
-  }
602
-  return '<p>' . $message . '</p>';
601
+    }
602
+    return '<p>' . $message . '</p>';
603 603
 }
604 604
 
605 605
 /**
@@ -608,42 +608,42 @@  discard block
 block discarded – undo
608 608
  */
609 609
 function phptemplate_username($object) {
610 610
 
611
-  if ($object->uid && $object->name) {
611
+    if ($object->uid && $object->name) {
612 612
 
613 613
     // Show the profile name in general, not the username
614 614
     $name = user_load($object->uid)->boincuser_name;
615 615
 
616 616
     // Shorten the name when it is too long or it will break many tables.
617 617
     if (drupal_strlen($name) > 20) {
618
-      $name = drupal_substr($name, 0, 15) . '...';
618
+        $name = drupal_substr($name, 0, 15) . '...';
619 619
     }
620 620
 
621 621
     if (user_access('access user profiles')) {
622
-      $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
622
+        $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
623 623
     }
624 624
     else {
625
-      $output = check_plain($name);
625
+        $output = check_plain($name);
626 626
     }
627
-  }
628
-  else if ($object->name) {
627
+    }
628
+    else if ($object->name) {
629 629
     // Sometimes modules display content composed by people who are
630 630
     // not registered members of the site (e.g. mailing list or news
631 631
     // aggregator modules). This clause enables modules to display
632 632
     // the true author of the content.
633 633
     if (!empty($object->homepage)) {
634
-      $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
634
+        $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
635 635
     }
636 636
     else {
637
-      $output = check_plain($object->name);
637
+        $output = check_plain($object->name);
638 638
     }
639 639
 
640 640
     $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')';
641
-  }
642
-  else {
641
+    }
642
+    else {
643 643
     $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user')));
644
-  }
644
+    }
645 645
 
646
-  return $output;
646
+    return $output;
647 647
 }
648 648
 
649 649
 /**
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
  * "More information about formatting options"
652 652
  */
653 653
 function boinc_filter_tips_more_info () {
654
-  return '';
654
+    return '';
655 655
 }
656 656
 
657 657
 /**
@@ -669,19 +669,19 @@  discard block
 block discarded – undo
669 669
  *   An array containing the email [type] (mailkey), [subject] and [body].
670 670
  */
671 671
 function boinc_flag_friend_message_email($status, $flag, $recipient, $sender) {
672
-  $email = array();
673
-  $email['type'] = 'flag-friend';
674
-  // Reload the sender to get a full user object
675
-  $sender = user_load($sender->uid);
672
+    $email = array();
673
+    $email['type'] = 'flag-friend';
674
+    // Reload the sender to get a full user object
675
+    $sender = user_load($sender->uid);
676 676
 
677
-  switch ($status) {
677
+    switch ($status) {
678 678
     case FLAG_FRIEND_FLAGGED:
679 679
       // Sender accepted recipient's friend request
680 680
       $email['subject'] = bts('!name accepted your friend request [!site]', array(
681 681
         '!name' => $sender->boincuser_name,
682 682
         '!site' => variable_get('site_name', 'Drupal-BOINC'),
683 683
         ), NULL, 'boinc:friend-request-email');
684
-      $email['body'] = bts('!name confirmed you as a friend on !site.
684
+        $email['body'] = bts('!name confirmed you as a friend on !site.
685 685
 
686 686
 Follow this link to view his or her profile:
687 687
 !link
@@ -695,12 +695,12 @@  discard block
 block discarded – undo
695 695
         '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
696 696
         '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
697 697
         ), array(), NULL, 'boinc:friend-request-email');
698
-      break;
698
+        break;
699 699
 
700 700
     case FLAG_FRIEND_PENDING:
701 701
       // Sender is requesting to be recipient's friend
702 702
       $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email');
703
-      $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
703
+        $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
704 704
 
705 705
 Follow the link below to view this request:
706 706
 !link
@@ -714,26 +714,26 @@  discard block
 block discarded – undo
714 714
         '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
715 715
         '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
716 716
         ),
717
-      array(), NULL, 'boinc:friend-request-email');
718
-      break;
719
-  }
720
-  return $email;
717
+        array(), NULL, 'boinc:friend-request-email');
718
+        break;
719
+    }
720
+    return $email;
721 721
 }
722 722
 
723 723
 /**
724 724
  * Edit action links
725 725
  */
726 726
 function phptemplate_links($links, $attributes = array('class' => 'links')) {
727
-  if ($links){
727
+    if ($links){
728 728
     // Remove flag-subscriptions link. It will be placed elsewhere.
729 729
     if (isset($links['flag-subscriptions'])) {
730
-      unset($links['flag-subscriptions']);
730
+        unset($links['flag-subscriptions']);
731 731
     }
732 732
     // Reorder the links however you need them.
733 733
     $links = reorder_links($links, array('comment_edit','quote','comment_add','comment_reply','flag-abuse_comment','flag-abuse_node'), array('comment_delete'));
734 734
     // Use the built-in theme_links() function to format the $links array.
735 735
     return theme_links($links, $attributes);
736
-  }
736
+    }
737 737
 }
738 738
 
739 739
 /**
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
  * That is to say, get rid of it and use the views-view-table.tpl.php template.
778 778
  */
779 779
 function boinc_tablesort_indicator($style) {
780
-  return '';
781
-  /*
780
+    return '';
781
+    /*
782 782
   if ($style == "asc") {
783 783
     return theme('image', 'misc/arrow-asc.png', t('sort icon'), t('sort ascending'));
784 784
   }
@@ -801,48 +801,48 @@  discard block
 block discarded – undo
801 801
  *
802 802
  */
803 803
 function _boinc_create_moderator_links(&$links, &$moderator_links) {
804
-  // If there are no links, then do nothing
805
-  if (empty($links)) {
804
+    // If there are no links, then do nothing
805
+    if (empty($links)) {
806 806
     return;
807
-  }
807
+    }
808 808
 
809
-  $alllinks = array();
810
-  $modlinks = array();
809
+    $alllinks = array();
810
+    $modlinks = array();
811 811
 
812
-  // Create an array of HTML elements from the $links string, keys
813
-  // are the class attribute for the <li> tags.
814
-  $dom = new DOMDocument;
815
-  $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8'));
816
-  foreach($dom->getElementsByTagName('li') as $node) {
812
+    // Create an array of HTML elements from the $links string, keys
813
+    // are the class attribute for the <li> tags.
814
+    $dom = new DOMDocument;
815
+    $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8'));
816
+    foreach($dom->getElementsByTagName('li') as $node) {
817 817
     $key = $node->getAttribute("class");
818 818
     $alllinks[$key] = $dom->saveHTML($node);
819
-  }
819
+    }
820 820
 
821
-  // Select classes to be placed into moderator links array
822
-  $selected_classes = array(
821
+    // Select classes to be placed into moderator links array
822
+    $selected_classes = array(
823 823
     "make_sticky", "make_unsticky",
824 824
     "lock", "unlock",
825 825
     "convert",
826 826
     "hide", "unhide",
827 827
     "comment_delete",
828
-  );
829
-  foreach(array_keys($alllinks) as $key1) {
828
+    );
829
+    foreach(array_keys($alllinks) as $key1) {
830 830
     // Select string up to first space, if present.
831 831
     $class1 = strtok($key1, ' ');
832 832
     if (in_array($class1, $selected_classes)) {
833
-      if (empty($modlinks)) {
833
+        if (empty($modlinks)) {
834 834
         _boinc_firstlink($alllinks[$key1]);
835
-      }
836
-      $modlinks[$key1] = $alllinks[$key1];
837
-      unset($alllinks[$key1]);
835
+        }
836
+        $modlinks[$key1] = $alllinks[$key1];
837
+        unset($alllinks[$key1]);
838 838
     }
839
-  }
840
-  // Convert the HTML arrays back into strings, wrap them in <ul>
841
-  // tags
842
-  $links = "<ul class=\"links\">".implode($alllinks)."</ul>";
843
-  $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>";
839
+    }
840
+    // Convert the HTML arrays back into strings, wrap them in <ul>
841
+    // tags
842
+    $links = "<ul class=\"links\">".implode($alllinks)."</ul>";
843
+    $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>";
844 844
 
845
-  return;
845
+    return;
846 846
 }
847 847
 
848 848
 /*
@@ -850,38 +850,38 @@  discard block
 block discarded – undo
850 850
  * attribute to class.
851 851
  */
852 852
 function _boinc_firstlink(&$alink) {
853
-  if (!empty($alink)) {
853
+    if (!empty($alink)) {
854 854
     $dom = new DomDocument;
855 855
     $dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8'));
856 856
 
857 857
     $myli = $dom->getElementsByTagName('li');
858 858
     if ($myli->length>0) {
859
-      $newclasses = trim(($myli[0]->getAttribute("class"))." first");
860
-      $myli[0]->setAttribute("class", $newclasses);
861
-      $alink = $dom->saveHTML($myli[0]);
859
+        $newclasses = trim(($myli[0]->getAttribute("class"))." first");
860
+        $myli[0]->setAttribute("class", $newclasses);
861
+        $alink = $dom->saveHTML($myli[0]);
862
+    }
862 863
     }
863
-  }
864 864
 }
865 865
 
866 866
 /*
867 867
  * Private function to generate the action links
868 868
  */
869 869
 function _boinc_action_links() {
870
-  global $user;
871
-  global $base_path;
870
+    global $user;
871
+    global $base_path;
872 872
 
873
-  $output = '<ul class="menu"><li class="first">';
874
-  if ($user->uid) {
873
+    $output = '<ul class="menu"><li class="first">';
874
+    if ($user->uid) {
875 875
     $output .= '<a href="' . url('logout') . '">' . bts('Logout', array(), NULL, 'boinc:menu-link') . '</a>';
876
-  } else {
876
+    } else {
877 877
     $output .= '<a href="' . url('user/login', array('query' => drupal_get_destination()) ) . '">' . bts('Login', array(), NULL, 'boinc:menu-link') . '</a>';
878
-  }
879
-  $output .= '</li>';
880
-  if (module_exists('global_search') OR module_exists('global_search_solr')) {
878
+    }
879
+    $output .= '</li>';
880
+    if (module_exists('global_search') OR module_exists('global_search_solr')) {
881 881
     $output .= '<li class="last"> <a class="search" href="' . url('search/site') . '">' . bts('search', array(), NULL, 'boinc:menu-link') .'</a> </l1>';
882
-  }
883
-  $output .= '</ul>';
884
-  return $output;
882
+    }
883
+    $output .= '</ul>';
884
+    return $output;
885 885
 }
886 886
 
887 887
 /**
@@ -889,47 +889,47 @@  discard block
 block discarded – undo
889 889
  * function. Modified for boinc functionality.
890 890
  */
891 891
 function _boinc_ignore_user_link($type, $object = NULL, $teaser = FALSE) {
892
-  global $user;
892
+    global $user;
893 893
 
894
-  if (!$user || !$user->uid) {
894
+    if (!$user || !$user->uid) {
895 895
     return;
896
-  }
896
+    }
897 897
 
898
-  static $ignored;
899
-  $links = array();
898
+    static $ignored;
899
+    $links = array();
900 900
 
901
-  if ($type == 'node' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
901
+    if ($type == 'node' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
902 902
     if (!isset($ignored[$object->uid])) {
903
-      $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
903
+        $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
904 904
     }
905 905
     if ($ignored[$object->uid] == 0) {
906
-      $links['ignore_user'] = array(
906
+        $links['ignore_user'] = array(
907 907
         'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
908 908
         'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
909 909
         'query' => 'destination='. $_GET['q'],
910 910
         'attributes' => array(
911
-          'class' => 'ignore-user',
912
-          'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
911
+            'class' => 'ignore-user',
912
+            'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
913 913
         ),
914
-      );
914
+        );
915 915
     }
916
-  }
917
-  else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
916
+    }
917
+    else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
918 918
     if (!isset($ignored[$object->uid])) {
919
-      $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
919
+        $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
920 920
     }
921 921
     if ($ignored[$object->uid] == 0) {
922
-      $links['ignore_user'] = array(
922
+        $links['ignore_user'] = array(
923 923
         'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
924 924
         'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
925 925
         'query' => 'destination='. $_GET['q'],
926 926
         'attributes' => array(
927
-          'class' => 'ignore-user',
928
-          'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
927
+            'class' => 'ignore-user',
928
+            'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
929 929
         ),
930
-      );
930
+        );
931
+    }
931 932
     }
932
-  }
933 933
 
934
-  return $links;
934
+    return $links;
935 935
 }
Please login to merge, or discard this patch.
drupal/sites/all/features/user_profiles/user_profiles.features.content.inc 2 patches
Indentation   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -4,41 +4,41 @@  discard block
 block discarded – undo
4 4
  * Implementation of hook_content_default_fields().
5 5
  */
6 6
 function user_profiles_content_default_fields() {
7
-  $fields = array();
7
+    $fields = array();
8 8
 
9
-  // Exported field: field_background
10
-  $fields['profile-field_background'] = array(
9
+    // Exported field: field_background
10
+    $fields['profile-field_background'] = array(
11 11
     'field_name' => 'field_background',
12 12
     'type_name' => 'profile',
13 13
     'display_settings' => array(
14
-      'label' => array(
14
+        'label' => array(
15 15
         'format' => 'above',
16 16
         'exclude' => 0,
17
-      ),
18
-      'teaser' => array(
17
+        ),
18
+        'teaser' => array(
19 19
         'format' => 'default',
20 20
         'exclude' => 0,
21
-      ),
22
-      'full' => array(
21
+        ),
22
+        'full' => array(
23 23
         'format' => 'default',
24 24
         'exclude' => 0,
25
-      ),
26
-      '4' => array(
25
+        ),
26
+        '4' => array(
27 27
         'format' => 'default',
28 28
         'exclude' => 0,
29
-      ),
30
-      '2' => array(
29
+        ),
30
+        '2' => array(
31 31
         'format' => 'default',
32 32
         'exclude' => 0,
33
-      ),
34
-      '3' => array(
33
+        ),
34
+        '3' => array(
35 35
         'format' => 'default',
36 36
         'exclude' => 0,
37
-      ),
38
-      'token' => array(
37
+        ),
38
+        'token' => array(
39 39
         'format' => 'default',
40 40
         'exclude' => 0,
41
-      ),
41
+        ),
42 42
     ),
43 43
     'widget_active' => '1',
44 44
     'type' => 'text',
@@ -51,56 +51,56 @@  discard block
 block discarded – undo
51 51
     'allowed_values' => '',
52 52
     'allowed_values_php' => '',
53 53
     'widget' => array(
54
-      'rows' => '10',
55
-      'size' => 60,
56
-      'default_value' => array(
54
+        'rows' => '10',
55
+        'size' => 60,
56
+        'default_value' => array(
57 57
         '0' => array(
58
-          'value' => '',
59
-          '_error_element' => 'default_value_widget][field_background][0][value',
60
-        ),
61
-      ),
62
-      'default_value_php' => NULL,
63
-      'label' => bts('Your personal background', array(), NULL, 'boinc:account-profile-edit'),
64
-      'weight' => '3',
65
-      'description' => bts('Tell us about yourself. You could tell us where you\'re from, your age, occupation, hobbies, or anything else about yourself.', array(), NULL, 'boinc:account-profile-edit'),
66
-      'type' => 'text_textarea',
67
-      'module' => 'text',
58
+            'value' => '',
59
+            '_error_element' => 'default_value_widget][field_background][0][value',
60
+        ),
61
+        ),
62
+        'default_value_php' => NULL,
63
+        'label' => bts('Your personal background', array(), NULL, 'boinc:account-profile-edit'),
64
+        'weight' => '3',
65
+        'description' => bts('Tell us about yourself. You could tell us where you\'re from, your age, occupation, hobbies, or anything else about yourself.', array(), NULL, 'boinc:account-profile-edit'),
66
+        'type' => 'text_textarea',
67
+        'module' => 'text',
68 68
     ),
69
-  );
69
+    );
70 70
 
71
-  // Exported field: field_country
72
-  $fields['profile-field_country'] = array(
71
+    // Exported field: field_country
72
+    $fields['profile-field_country'] = array(
73 73
     'field_name' => 'field_country',
74 74
     'type_name' => 'profile',
75 75
     'display_settings' => array(
76
-      'label' => array(
76
+        'label' => array(
77 77
         'format' => 'above',
78 78
         'exclude' => 0,
79
-      ),
80
-      'teaser' => array(
79
+        ),
80
+        'teaser' => array(
81 81
         'format' => 'default',
82 82
         'exclude' => 0,
83
-      ),
84
-      'full' => array(
83
+        ),
84
+        'full' => array(
85 85
         'format' => 'default',
86 86
         'exclude' => 0,
87
-      ),
88
-      '4' => array(
87
+        ),
88
+        '4' => array(
89 89
         'format' => 'default',
90 90
         'exclude' => 0,
91
-      ),
92
-      '2' => array(
91
+        ),
92
+        '2' => array(
93 93
         'format' => 'default',
94 94
         'exclude' => 0,
95
-      ),
96
-      '3' => array(
95
+        ),
96
+        '3' => array(
97 97
         'format' => 'default',
98 98
         'exclude' => 0,
99
-      ),
100
-      'token' => array(
99
+        ),
100
+        'token' => array(
101 101
         'format' => 'default',
102 102
         'exclude' => 0,
103
-      ),
103
+        ),
104 104
     ),
105 105
     'widget_active' => '1',
106 106
     'type' => 'text',
@@ -345,53 +345,53 @@  discard block
 block discarded – undo
345 345
 Zimbabwe|Zimbabwe',
346 346
     'allowed_values_php' => 'return boinccore_get_country_list();',
347 347
     'widget' => array(
348
-      'default_value' => array(
348
+        'default_value' => array(
349 349
         '0' => array(
350
-          'value' => '',
351
-        ),
352
-      ),
353
-      'default_value_php' => NULL,
354
-      'label' => 'Country',
355
-      'weight' => '5',
356
-      'description' => '',
357
-      'type' => 'optionwidgets_select',
358
-      'module' => 'optionwidgets',
350
+            'value' => '',
351
+        ),
352
+        ),
353
+        'default_value_php' => NULL,
354
+        'label' => 'Country',
355
+        'weight' => '5',
356
+        'description' => '',
357
+        'type' => 'optionwidgets_select',
358
+        'module' => 'optionwidgets',
359 359
     ),
360
-  );
360
+    );
361 361
 
362
-  // Exported field: field_image
363
-  $fields['profile-field_image'] = array(
362
+    // Exported field: field_image
363
+    $fields['profile-field_image'] = array(
364 364
     'field_name' => 'field_image',
365 365
     'type_name' => 'profile',
366 366
     'display_settings' => array(
367
-      'label' => array(
367
+        'label' => array(
368 368
         'format' => 'above',
369 369
         'exclude' => 0,
370
-      ),
371
-      'teaser' => array(
370
+        ),
371
+        'teaser' => array(
372 372
         'format' => 'image_plain',
373 373
         'exclude' => 0,
374
-      ),
375
-      'full' => array(
374
+        ),
375
+        'full' => array(
376 376
         'format' => 'image_plain',
377 377
         'exclude' => 0,
378
-      ),
379
-      '4' => array(
378
+        ),
379
+        '4' => array(
380 380
         'format' => 'image_plain',
381 381
         'exclude' => 0,
382
-      ),
383
-      '2' => array(
382
+        ),
383
+        '2' => array(
384 384
         'format' => 'image_plain',
385 385
         'exclude' => 0,
386
-      ),
387
-      '3' => array(
386
+        ),
387
+        '3' => array(
388 388
         'format' => 'image_plain',
389 389
         'exclude' => 0,
390
-      ),
391
-      'token' => array(
390
+        ),
391
+        'token' => array(
392 392
         'format' => 'image_plain',
393 393
         'exclude' => 0,
394
-      ),
394
+        ),
395 395
     ),
396 396
     'widget_active' => '1',
397 397
     'type' => 'filefield',
@@ -403,19 +403,19 @@  discard block
 block discarded – undo
403 403
     'list_default' => 1,
404 404
     'description_field' => '0',
405 405
     'widget' => array(
406
-      'file_extensions' => 'png gif jpg jpeg',
407
-      'file_path' => 'profiles',
408
-      'progress_indicator' => 'bar',
409
-      'max_filesize_per_file' => '512K',
410
-      'max_filesize_per_node' => '',
411
-      'max_resolution' => '300x300',
412
-      'min_resolution' => '50x50',
413
-      'alt' => '',
414
-      'custom_alt' => 0,
415
-      'title' => '',
416
-      'custom_title' => 0,
417
-      'title_type' => 'textfield',
418
-      'default_image' => array(
406
+        'file_extensions' => 'png gif jpg jpeg',
407
+        'file_path' => 'profiles',
408
+        'progress_indicator' => 'bar',
409
+        'max_filesize_per_file' => '512K',
410
+        'max_filesize_per_node' => '',
411
+        'max_resolution' => '300x300',
412
+        'min_resolution' => '50x50',
413
+        'alt' => '',
414
+        'custom_alt' => 0,
415
+        'title' => '',
416
+        'custom_title' => 0,
417
+        'title_type' => 'textfield',
418
+        'default_image' => array(
419 419
         'filename' => 'default-avatar.png',
420 420
         'filepath' => 'sites/default/files/imagefield_default_images/default-avatar.png',
421 421
         'filemime' => 'image/png',
@@ -426,49 +426,49 @@  discard block
 block discarded – undo
426 426
         'status' => 1,
427 427
         'timestamp' => 1347855344,
428 428
         'fid' => '1',
429
-      ),
430
-      'use_default_image' => 1,
431
-      'label' => 'Avatar',
432
-      'weight' => '7',
433
-      'description' => '',
434
-      'type' => 'imagefield_widget',
435
-      'module' => 'imagefield',
429
+        ),
430
+        'use_default_image' => 1,
431
+        'label' => 'Avatar',
432
+        'weight' => '7',
433
+        'description' => '',
434
+        'type' => 'imagefield_widget',
435
+        'module' => 'imagefield',
436 436
     ),
437
-  );
437
+    );
438 438
 
439
-  // Exported field: field_opinions
440
-  $fields['profile-field_opinions'] = array(
439
+    // Exported field: field_opinions
440
+    $fields['profile-field_opinions'] = array(
441 441
     'field_name' => 'field_opinions',
442 442
     'type_name' => 'profile',
443 443
     'display_settings' => array(
444
-      'label' => array(
444
+        'label' => array(
445 445
         'format' => 'above',
446 446
         'exclude' => 0,
447
-      ),
448
-      'teaser' => array(
447
+        ),
448
+        'teaser' => array(
449 449
         'format' => 'default',
450 450
         'exclude' => 0,
451
-      ),
452
-      'full' => array(
451
+        ),
452
+        'full' => array(
453 453
         'format' => 'default',
454 454
         'exclude' => 0,
455
-      ),
456
-      '4' => array(
455
+        ),
456
+        '4' => array(
457 457
         'format' => 'default',
458 458
         'exclude' => 0,
459
-      ),
460
-      '2' => array(
459
+        ),
460
+        '2' => array(
461 461
         'format' => 'default',
462 462
         'exclude' => 0,
463
-      ),
464
-      '3' => array(
463
+        ),
464
+        '3' => array(
465 465
         'format' => 'default',
466 466
         'exclude' => 0,
467
-      ),
468
-      'token' => array(
467
+        ),
468
+        'token' => array(
469 469
         'format' => 'default',
470 470
         'exclude' => 0,
471
-      ),
471
+        ),
472 472
     ),
473 473
     'widget_active' => '1',
474 474
     'type' => 'text',
@@ -481,60 +481,60 @@  discard block
 block discarded – undo
481 481
     'allowed_values' => '',
482 482
     'allowed_values_php' => '',
483 483
     'widget' => array(
484
-      'rows' => '10',
485
-      'size' => 60,
486
-      'default_value' => array(
484
+        'rows' => '10',
485
+        'size' => 60,
486
+        'default_value' => array(
487 487
         '0' => array(
488
-          'value' => '',
489
-          '_error_element' => 'default_value_widget][field_opinions][0][value',
490
-        ),
491
-      ),
492
-      'default_value_php' => NULL,
493
-      'label' => bts('Your opinions about this project', array(), NULL, 'boinc:account-profile-edit'),
494
-      'weight' => '4',
495
-      'description' => bts('Tell us your thoughts about @this_project
488
+            'value' => '',
489
+            '_error_element' => 'default_value_widget][field_opinions][0][value',
490
+        ),
491
+        ),
492
+        'default_value_php' => NULL,
493
+        'label' => bts('Your opinions about this project', array(), NULL, 'boinc:account-profile-edit'),
494
+        'weight' => '4',
495
+        'description' => bts('Tell us your thoughts about @this_project
496 496
    1. Why do you run @this_project?
497 497
    2. What are your views about the project?
498 498
    3. Any suggestions?',
499
-      array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-profile-edit'),
500
-      'type' => 'text_textarea',
501
-      'module' => 'text',
499
+        array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-profile-edit'),
500
+        'type' => 'text_textarea',
501
+        'module' => 'text',
502 502
     ),
503
-  );
503
+    );
504 504
 
505
-  // Exported field: field_profile_image
506
-  $fields['profile-field_profile_image'] = array(
505
+    // Exported field: field_profile_image
506
+    $fields['profile-field_profile_image'] = array(
507 507
     'field_name' => 'field_profile_image',
508 508
     'type_name' => 'profile',
509 509
     'display_settings' => array(
510
-      'label' => array(
510
+        'label' => array(
511 511
         'format' => 'above',
512 512
         'exclude' => 0,
513
-      ),
514
-      'teaser' => array(
513
+        ),
514
+        'teaser' => array(
515 515
         'format' => 'image_plain',
516 516
         'exclude' => 0,
517
-      ),
518
-      'full' => array(
517
+        ),
518
+        'full' => array(
519 519
         'format' => 'image_plain',
520 520
         'exclude' => 0,
521
-      ),
522
-      '4' => array(
521
+        ),
522
+        '4' => array(
523 523
         'format' => 'image_plain',
524 524
         'exclude' => 0,
525
-      ),
526
-      '2' => array(
525
+        ),
526
+        '2' => array(
527 527
         'format' => 'image_plain',
528 528
         'exclude' => 0,
529
-      ),
530
-      '3' => array(
529
+        ),
530
+        '3' => array(
531 531
         'format' => 'image_plain',
532 532
         'exclude' => 0,
533
-      ),
534
-      'token' => array(
533
+        ),
534
+        'token' => array(
535 535
         'format' => 'image_plain',
536 536
         'exclude' => 0,
537
-      ),
537
+        ),
538 538
     ),
539 539
     'widget_active' => '1',
540 540
     'type' => 'filefield',
@@ -546,19 +546,19 @@  discard block
 block discarded – undo
546 546
     'list_default' => 1,
547 547
     'description_field' => '0',
548 548
     'widget' => array(
549
-      'file_extensions' => 'png gif jpg jpeg',
550
-      'file_path' => 'profiles',
551
-      'progress_indicator' => 'bar',
552
-      'max_filesize_per_file' => '512K',
553
-      'max_filesize_per_node' => '',
554
-      'max_resolution' => '640x480',
555
-      'min_resolution' => '100x100',
556
-      'alt' => '',
557
-      'custom_alt' => 0,
558
-      'title' => '',
559
-      'custom_title' => 0,
560
-      'title_type' => 'textfield',
561
-      'default_image' => array(
549
+        'file_extensions' => 'png gif jpg jpeg',
550
+        'file_path' => 'profiles',
551
+        'progress_indicator' => 'bar',
552
+        'max_filesize_per_file' => '512K',
553
+        'max_filesize_per_node' => '',
554
+        'max_resolution' => '640x480',
555
+        'min_resolution' => '100x100',
556
+        'alt' => '',
557
+        'custom_alt' => 0,
558
+        'title' => '',
559
+        'custom_title' => 0,
560
+        'title_type' => 'textfield',
561
+        'default_image' => array(
562 562
         'filename' => 'default-user.png',
563 563
         'filepath' => 'sites/default/files/imagefield_default_images/default-user.png',
564 564
         'filemime' => 'image/png',
@@ -569,49 +569,49 @@  discard block
 block discarded – undo
569 569
         'status' => 1,
570 570
         'timestamp' => 1362770990,
571 571
         'fid' => '5',
572
-      ),
573
-      'use_default_image' => 1,
574
-      'label' => 'Profile image',
575
-      'weight' => '8',
576
-      'description' => '',
577
-      'type' => 'imagefield_widget',
578
-      'module' => 'imagefield',
572
+        ),
573
+        'use_default_image' => 1,
574
+        'label' => 'Profile image',
575
+        'weight' => '8',
576
+        'description' => '',
577
+        'type' => 'imagefield_widget',
578
+        'module' => 'imagefield',
579 579
     ),
580
-  );
580
+    );
581 581
 
582
-  // Exported field: field_url
583
-  $fields['profile-field_url'] = array(
582
+    // Exported field: field_url
583
+    $fields['profile-field_url'] = array(
584 584
     'field_name' => 'field_url',
585 585
     'type_name' => 'profile',
586 586
     'display_settings' => array(
587
-      'label' => array(
587
+        'label' => array(
588 588
         'format' => 'above',
589 589
         'exclude' => 0,
590
-      ),
591
-      'teaser' => array(
590
+        ),
591
+        'teaser' => array(
592 592
         'format' => 'default',
593 593
         'exclude' => 0,
594
-      ),
595
-      'full' => array(
594
+        ),
595
+        'full' => array(
596 596
         'format' => 'default',
597 597
         'exclude' => 0,
598
-      ),
599
-      '4' => array(
598
+        ),
599
+        '4' => array(
600 600
         'format' => 'default',
601 601
         'exclude' => 0,
602
-      ),
603
-      '2' => array(
602
+        ),
603
+        '2' => array(
604 604
         'format' => 'default',
605 605
         'exclude' => 0,
606
-      ),
607
-      '3' => array(
606
+        ),
607
+        '3' => array(
608 608
         'format' => 'default',
609 609
         'exclude' => 0,
610
-      ),
611
-      'token' => array(
610
+        ),
611
+        'token' => array(
612 612
         'format' => 'default',
613 613
         'exclude' => 0,
614
-      ),
614
+        ),
615 615
     ),
616 616
     'widget_active' => '1',
617 617
     'type' => 'text',
@@ -624,56 +624,56 @@  discard block
 block discarded – undo
624 624
     'allowed_values' => '',
625 625
     'allowed_values_php' => '',
626 626
     'widget' => array(
627
-      'rows' => 5,
628
-      'size' => '42',
629
-      'default_value' => array(
627
+        'rows' => 5,
628
+        'size' => '42',
629
+        'default_value' => array(
630 630
         '0' => array(
631
-          'value' => '',
632
-          '_error_element' => 'default_value_widget][field_url][0][value',
633
-        ),
634
-      ),
635
-      'default_value_php' => NULL,
636
-      'label' => 'Website URL',
637
-      'weight' => '9',
638
-      'description' => '',
639
-      'type' => 'text_textfield',
640
-      'module' => 'text',
631
+            'value' => '',
632
+            '_error_element' => 'default_value_widget][field_url][0][value',
633
+        ),
634
+        ),
635
+        'default_value_php' => NULL,
636
+        'label' => 'Website URL',
637
+        'weight' => '9',
638
+        'description' => '',
639
+        'type' => 'text_textfield',
640
+        'module' => 'text',
641 641
     ),
642
-  );
642
+    );
643 643
 
644
-  // Exported field: field_zip
645
-  $fields['profile-field_zip'] = array(
644
+    // Exported field: field_zip
645
+    $fields['profile-field_zip'] = array(
646 646
     'field_name' => 'field_zip',
647 647
     'type_name' => 'profile',
648 648
     'display_settings' => array(
649
-      'label' => array(
649
+        'label' => array(
650 650
         'format' => 'above',
651 651
         'exclude' => 0,
652
-      ),
653
-      'teaser' => array(
652
+        ),
653
+        'teaser' => array(
654 654
         'format' => 'default',
655 655
         'exclude' => 0,
656
-      ),
657
-      'full' => array(
656
+        ),
657
+        'full' => array(
658 658
         'format' => 'default',
659 659
         'exclude' => 0,
660
-      ),
661
-      '4' => array(
660
+        ),
661
+        '4' => array(
662 662
         'format' => 'default',
663 663
         'exclude' => 0,
664
-      ),
665
-      '2' => array(
664
+        ),
665
+        '2' => array(
666 666
         'format' => 'default',
667 667
         'exclude' => 0,
668
-      ),
669
-      '3' => array(
668
+        ),
669
+        '3' => array(
670 670
         'format' => 'default',
671 671
         'exclude' => 0,
672
-      ),
673
-      'token' => array(
672
+        ),
673
+        'token' => array(
674 674
         'format' => 'default',
675 675
         'exclude' => 0,
676
-      ),
676
+        ),
677 677
     ),
678 678
     'widget_active' => '1',
679 679
     'type' => 'text',
@@ -686,32 +686,32 @@  discard block
 block discarded – undo
686 686
     'allowed_values' => '',
687 687
     'allowed_values_php' => '',
688 688
     'widget' => array(
689
-      'rows' => 5,
690
-      'size' => '10',
691
-      'default_value' => array(
689
+        'rows' => 5,
690
+        'size' => '10',
691
+        'default_value' => array(
692 692
         '0' => array(
693
-          'value' => '',
694
-          '_error_element' => 'default_value_widget][field_zip][0][value',
695
-        ),
696
-      ),
697
-      'default_value_php' => NULL,
698
-      'label' => bts('Postal code', array(), NULL, 'boinc:account-profile-edit'),
699
-      'weight' => '6',
700
-      'description' => '',
701
-      'type' => 'text_textfield',
702
-      'module' => 'text',
693
+            'value' => '',
694
+            '_error_element' => 'default_value_widget][field_zip][0][value',
695
+        ),
696
+        ),
697
+        'default_value_php' => NULL,
698
+        'label' => bts('Postal code', array(), NULL, 'boinc:account-profile-edit'),
699
+        'weight' => '6',
700
+        'description' => '',
701
+        'type' => 'text_textfield',
702
+        'module' => 'text',
703 703
     ),
704
-  );
704
+    );
705 705
 
706
-  // Translatables
707
-  // Use bts() function to translate additional strings.
708
-  bts('Avatar', array(), NULL, 'boinc:account-profile-edit');
709
-  bts('Country', array(), NULL, 'boinc:country-of-origin');
710
-  bts('Profile image', array(), NULL, 'boinc:account-profile-edit');
711
-  bts('Website URL', array(), NULL, 'boinc:account-profile-edit');
712
-  bts('Your opinions about this project', array(), NULL, 'boinc:account-profile-edit');
713
-  bts('Your personal background', array(), NULL, 'boinc:account-profile-edit');
714
-  bts('Postal code', array(), NULL, 'boinc:account-profile-edit');
706
+    // Translatables
707
+    // Use bts() function to translate additional strings.
708
+    bts('Avatar', array(), NULL, 'boinc:account-profile-edit');
709
+    bts('Country', array(), NULL, 'boinc:country-of-origin');
710
+    bts('Profile image', array(), NULL, 'boinc:account-profile-edit');
711
+    bts('Website URL', array(), NULL, 'boinc:account-profile-edit');
712
+    bts('Your opinions about this project', array(), NULL, 'boinc:account-profile-edit');
713
+    bts('Your personal background', array(), NULL, 'boinc:account-profile-edit');
714
+    bts('Postal code', array(), NULL, 'boinc:account-profile-edit');
715 715
 
716
-  return $fields;
716
+    return $fields;
717 717
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
           '_error_element' => 'default_value_widget][field_background][0][value',
60 60
         ),
61 61
       ),
62
-      'default_value_php' => NULL,
63
-      'label' => bts('Your personal background', array(), NULL, 'boinc:account-profile-edit'),
62
+      'default_value_php' => null,
63
+      'label' => bts('Your personal background', array(), null, 'boinc:account-profile-edit'),
64 64
       'weight' => '3',
65
-      'description' => bts('Tell us about yourself. You could tell us where you\'re from, your age, occupation, hobbies, or anything else about yourself.', array(), NULL, 'boinc:account-profile-edit'),
65
+      'description' => bts('Tell us about yourself. You could tell us where you\'re from, your age, occupation, hobbies, or anything else about yourself.', array(), null, 'boinc:account-profile-edit'),
66 66
       'type' => 'text_textarea',
67 67
       'module' => 'text',
68 68
     ),
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
           'value' => '',
351 351
         ),
352 352
       ),
353
-      'default_value_php' => NULL,
353
+      'default_value_php' => null,
354 354
       'label' => 'Country',
355 355
       'weight' => '5',
356 356
       'description' => '',
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
           '_error_element' => 'default_value_widget][field_opinions][0][value',
490 490
         ),
491 491
       ),
492
-      'default_value_php' => NULL,
493
-      'label' => bts('Your opinions about this project', array(), NULL, 'boinc:account-profile-edit'),
492
+      'default_value_php' => null,
493
+      'label' => bts('Your opinions about this project', array(), null, 'boinc:account-profile-edit'),
494 494
       'weight' => '4',
495 495
       'description' => bts('Tell us your thoughts about @this_project
496 496
    1. Why do you run @this_project?
497 497
    2. What are your views about the project?
498 498
    3. Any suggestions?',
499
-      array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-profile-edit'),
499
+      array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:account-profile-edit'),
500 500
       'type' => 'text_textarea',
501 501
       'module' => 'text',
502 502
     ),
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
           '_error_element' => 'default_value_widget][field_url][0][value',
633 633
         ),
634 634
       ),
635
-      'default_value_php' => NULL,
635
+      'default_value_php' => null,
636 636
       'label' => 'Website URL',
637 637
       'weight' => '9',
638 638
       'description' => '',
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
           '_error_element' => 'default_value_widget][field_zip][0][value',
695 695
         ),
696 696
       ),
697
-      'default_value_php' => NULL,
698
-      'label' => bts('Postal code', array(), NULL, 'boinc:account-profile-edit'),
697
+      'default_value_php' => null,
698
+      'label' => bts('Postal code', array(), null, 'boinc:account-profile-edit'),
699 699
       'weight' => '6',
700 700
       'description' => '',
701 701
       'type' => 'text_textfield',
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 
706 706
   // Translatables
707 707
   // Use bts() function to translate additional strings.
708
-  bts('Avatar', array(), NULL, 'boinc:account-profile-edit');
709
-  bts('Country', array(), NULL, 'boinc:country-of-origin');
710
-  bts('Profile image', array(), NULL, 'boinc:account-profile-edit');
711
-  bts('Website URL', array(), NULL, 'boinc:account-profile-edit');
712
-  bts('Your opinions about this project', array(), NULL, 'boinc:account-profile-edit');
713
-  bts('Your personal background', array(), NULL, 'boinc:account-profile-edit');
714
-  bts('Postal code', array(), NULL, 'boinc:account-profile-edit');
708
+  bts('Avatar', array(), null, 'boinc:account-profile-edit');
709
+  bts('Country', array(), null, 'boinc:country-of-origin');
710
+  bts('Profile image', array(), null, 'boinc:account-profile-edit');
711
+  bts('Website URL', array(), null, 'boinc:account-profile-edit');
712
+  bts('Your opinions about this project', array(), null, 'boinc:account-profile-edit');
713
+  bts('Your personal background', array(), null, 'boinc:account-profile-edit');
714
+  bts('Postal code', array(), null, 'boinc:account-profile-edit');
715 715
 
716 716
   return $fields;
717 717
 }
Please login to merge, or discard this patch.
drupal/sites/all/features/stats_charts/stats_charts.panels_default.inc 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -4,33 +4,33 @@  discard block
 block discarded – undo
4 4
  * Implementation of hook_default_panels_mini().
5 5
  */
6 6
 function stats_charts_default_panels_mini() {
7
-  $export = array();
7
+    $export = array();
8 8
 
9
-  $mini = new stdClass;
10
-  $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
-  $mini->api_version = 1;
12
-  $mini->name = 'project_stats_overview';
13
-  $mini->category = 'BOINC';
14
-  $mini->admin_title = 'Project stats overview';
15
-  $mini->admin_description = 'General statistical information for the project';
16
-  $mini->requiredcontexts = array();
17
-  $mini->contexts = array();
18
-  $mini->relationships = array();
19
-  $display = new panels_display;
20
-  $display->layout = 'onecol';
21
-  $display->layout_settings = array();
22
-  $display->panel_settings = array(
9
+    $mini = new stdClass;
10
+    $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
+    $mini->api_version = 1;
12
+    $mini->name = 'project_stats_overview';
13
+    $mini->category = 'BOINC';
14
+    $mini->admin_title = 'Project stats overview';
15
+    $mini->admin_description = 'General statistical information for the project';
16
+    $mini->requiredcontexts = array();
17
+    $mini->contexts = array();
18
+    $mini->relationships = array();
19
+    $display = new panels_display;
20
+    $display->layout = 'onecol';
21
+    $display->layout_settings = array();
22
+    $display->panel_settings = array(
23 23
     'style_settings' => array(
24
-      'default' => NULL,
25
-      'middle' => NULL,
24
+        'default' => NULL,
25
+        'middle' => NULL,
26 26
     ),
27
-  );
28
-  $display->cache = array();
29
-  $display->title = '';
30
-  $display->storage_type = 'panels_mini';
31
-  $display->storage_id = 'project_stats_overview';
32
-  $display->content = array();
33
-  $display->panels = array();
27
+    );
28
+    $display->cache = array();
29
+    $display->title = '';
30
+    $display->storage_type = 'panels_mini';
31
+    $display->storage_id = 'project_stats_overview';
32
+    $display->content = array();
33
+    $display->panels = array();
34 34
     $pane = new stdClass;
35 35
     $pane->pid = 'new-1';
36 36
     $pane->panel = 'middle';
@@ -39,25 +39,25 @@  discard block
 block discarded – undo
39 39
     $pane->shown = TRUE;
40 40
     $pane->access = array();
41 41
     $pane->configuration = array(
42
-      'admin_title' => 'Project stats overview',
43
-      'title' => bts('@this_project Progress', array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:frontpage'),
44
-      'body' => '<?php echo boincstats_get_project_stats_overview(); ?>',
45
-      'format' => '3',
46
-      'substitute' => TRUE,
42
+        'admin_title' => 'Project stats overview',
43
+        'title' => bts('@this_project Progress', array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:frontpage'),
44
+        'body' => '<?php echo boincstats_get_project_stats_overview(); ?>',
45
+        'format' => '3',
46
+        'substitute' => TRUE,
47 47
     );
48 48
     $pane->cache = array();
49 49
     $pane->style = array(
50
-      'settings' => NULL,
50
+        'settings' => NULL,
51 51
     );
52 52
     $pane->css = array();
53 53
     $pane->extras = array();
54 54
     $pane->position = 0;
55 55
     $display->content['new-1'] = $pane;
56 56
     $display->panels['middle'][0] = 'new-1';
57
-  $display->hide_title = PANELS_TITLE_FIXED;
58
-  $display->title_pane = 'new-1';
59
-  $mini->display = $display;
60
-  $export['project_stats_overview'] = $mini;
57
+    $display->hide_title = PANELS_TITLE_FIXED;
58
+    $display->title_pane = 'new-1';
59
+    $mini->display = $display;
60
+    $export['project_stats_overview'] = $mini;
61 61
 
62
-  return $export;
62
+    return $export;
63 63
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
   $export = array();
8 8
 
9 9
   $mini = new stdClass;
10
-  $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
10
+  $mini->disabled = false; /* Edit this to true to make a default mini disabled initially */
11 11
   $mini->api_version = 1;
12 12
   $mini->name = 'project_stats_overview';
13 13
   $mini->category = 'BOINC';
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
   $display->layout_settings = array();
22 22
   $display->panel_settings = array(
23 23
     'style_settings' => array(
24
-      'default' => NULL,
25
-      'middle' => NULL,
24
+      'default' => null,
25
+      'middle' => null,
26 26
     ),
27 27
   );
28 28
   $display->cache = array();
@@ -36,18 +36,18 @@  discard block
 block discarded – undo
36 36
     $pane->panel = 'middle';
37 37
     $pane->type = 'custom';
38 38
     $pane->subtype = 'custom';
39
-    $pane->shown = TRUE;
39
+    $pane->shown = true;
40 40
     $pane->access = array();
41 41
     $pane->configuration = array(
42 42
       'admin_title' => 'Project stats overview',
43
-      'title' => bts('@this_project Progress', array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:frontpage'),
43
+      'title' => bts('@this_project Progress', array('@this_project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:frontpage'),
44 44
       'body' => '<?php echo boincstats_get_project_stats_overview(); ?>',
45 45
       'format' => '3',
46
-      'substitute' => TRUE,
46
+      'substitute' => true,
47 47
     );
48 48
     $pane->cache = array();
49 49
     $pane->style = array(
50
-      'settings' => NULL,
50
+      'settings' => null,
51 51
     );
52 52
     $pane->css = array();
53 53
     $pane->extras = array();
Please login to merge, or discard this patch.
html/ops/fix_project_prefs.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             // changing the tree in a loop has strange results so do it separately
77 77
             $to_remove = array();
78 78
             $ids = array();
79
-            foreach($appids as $elem) {
79
+            foreach ($appids as $elem) {
80 80
                 $ids[] = $elem->nodeValue;
81 81
                 $to_remove[] = $elem;
82 82
             }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         exit(1);
95 95
     }
96 96
     $appids = $node->getElementsByTagName("app_id");
97
-    if ($appids->length == 0 ) return;
97
+    if ($appids->length == 0) return;
98 98
     // changing the tree in a loop has strange results so do it separately
99 99
     $to_remove = array();
100 100
     $ids = array();
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $to_remove = array();
130 130
         foreach ($subNodes as $subNode) {
131 131
             // ignore empty text nodes which are basically whitespace from indentation (only relevant if preserveWhiteSpace is set to true above)
132
-            if (($subNode->nodeType != XML_TEXT_NODE) || (($subNode->nodeType == XML_TEXT_NODE) &&(strlen(trim($subNode->wholeText))>=1))) {
132
+            if (($subNode->nodeType != XML_TEXT_NODE) || (($subNode->nodeType == XML_TEXT_NODE) && (strlen(trim($subNode->wholeText)) >= 1))) {
133 133
                 if ($subNode->nodeName == "venue") {
134 134
                     if (!$subNode->hasChildNodes()) {
135 135
                         // empty venue tag, clean this up too
Please login to merge, or discard this patch.
html/user/profile_menu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 start_table();
42 42
 
43 43
 $today = getdate(time());
44
-$UOTD_heading = tra("User of the Day")." -- " . $today['month'] . " " . $today['mday'] . ", " . $today['year'];
44
+$UOTD_heading = tra("User of the Day")." -- ".$today['month']." ".$today['mday'].", ".$today['year'];
45 45
 row1($UOTD_heading);
46 46
 echo "<tr><td>";
47 47
     $profile = get_current_uotd();
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 row1(tra("User Profile Explorer"));
60 60
 echo "<tr><td>
61 61
     <ul>
62
-    <li>".tra("View the %1 User Picture Gallery %2.", "<a href=\"" . url_base() . "user_profile/user_gallery_1.html\">", "</a>")."</li>
63
-    <li>".tra("Browse profiles %1 by country %2.", "<a href=\"" . url_base() . "user_profile/profile_country.html\">", "</a>")."</li>
62
+    <li>".tra("View the %1 User Picture Gallery %2.", "<a href=\"".url_base()."user_profile/user_gallery_1.html\">", "</a>")."</li>
63
+    <li>".tra("Browse profiles %1 by country %2.", "<a href=\"".url_base()."user_profile/profile_country.html\">", "</a>")."</li>
64 64
     <li>".tra("Browse profiles %1 at random %2, %3 at random with pictures %2, or %4 at random without pictures %2.", "<a href=\"?cmd=rand&amp;pic=-1\">", "</a>",
65 65
             "<a href=\"?cmd=rand&amp;pic=1\">", "<a href=\"?cmd=rand&amp;pic=0\">")."</li>
66 66
 ";
67
-if (file_exists(PROFILE_PATH . "profile_alpha.html")) {
67
+if (file_exists(PROFILE_PATH."profile_alpha.html")) {
68 68
     echo "<li>".tra("Alphabetical profile listings:")."<br>";
69 69
 
70
-    include( PROFILE_PATH . "profile_alpha.html" );
70
+    include(PROFILE_PATH."profile_alpha.html");
71 71
 }
72 72
 echo "</ul></td></tr>";
73 73
 
@@ -110,5 +110,5 @@  discard block
 block discarded – undo
110 110
     }
111 111
 }
112 112
 
113
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
113
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
114 114
 ?>
Please login to merge, or discard this patch.
html/user/forum_search_action.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -219,8 +219,8 @@
 block discarded – undo
219 219
     echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p>
220 220
     <p>"
221 221
     .tra("You can also %1 try the same search on Google. %2",
222
-         "<a href=\"https://www.google.com/search?domains=".url_base()."&sitesearch=".url_base()."forum_thread.php&q=".htmlentities($search_keywords)."\">",
223
-         "</a>")
222
+            "<a href=\"https://www.google.com/search?domains=".url_base()."&sitesearch=".url_base()."forum_thread.php&q=".htmlentities($search_keywords)."\">",
223
+            "</a>")
224 224
     ."</p>";
225 225
 }
226 226
 echo "<p><a href=\"forum_search.php\">".tra("Perform another search")."</a></p>";
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 // Optionally filters by forum, user, time, or hidden if specified.
32 32
 //
33 33
 function search_thread_titles(
34
-    $keyword_list, $forum="", $user="", $time="", $limit=200,
35
-    $sort_style=CREATE_TIME_NEW, $show_hidden = false
36
-){
37
-    $search_string="%";
34
+    $keyword_list, $forum = "", $user = "", $time = "", $limit = 200,
35
+    $sort_style = CREATE_TIME_NEW, $show_hidden = false
36
+) {
37
+    $search_string = "%";
38 38
     foreach ($keyword_list as $key => $word) {
39 39
         $search_string .= BoincDb::escape_string($word)."%";
40 40
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     if (!$show_hidden) {
52 52
         $query .= " and thread.hidden = 0";
53 53
     }
54
-    switch($sort_style) {
54
+    switch ($sort_style) {
55 55
     case MODIFIED_NEW:
56 56
         $query .= ' ORDER BY timestamp DESC';
57 57
         break;
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 //
85 85
 function search_post_content(
86 86
     $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden
87
-){
87
+) {
88 88
     $db = BoincDb::get();
89 89
 
90
-    $search_string="%";
91
-    foreach ($keyword_list as $key => $word){
90
+    $search_string = "%";
91
+    foreach ($keyword_list as $key => $word) {
92 92
         $search_string .= BoincDb::escape_string($word)."%";
93 93
     }
94 94
     $optional_join = "";
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
     }
101 101
     $query = "select post.* from ".$db->db_name.".post".$optional_join." where content like '".$search_string."'";
102 102
     if ($forum) {
103
-        $query.=" and forum = $forum->id";
103
+        $query .= " and forum = $forum->id";
104 104
     }
105 105
     if ($user) {
106
-        $query.=" and post.user = $user->id ";
106
+        $query .= " and post.user = $user->id ";
107 107
     }
108 108
     if ($time) {
109
-        $query.=" and post.timestamp > $time";
109
+        $query .= " and post.timestamp > $time";
110 110
     }
111 111
     if (!$show_hidden) {
112 112
         $query .= " AND post.hidden = 0";
113 113
     }
114
-    switch($sort_style) {
114
+    switch ($sort_style) {
115 115
     case VIEWS_MOST:
116
-        $query.= ' ORDER BY views DESC';
116
+        $query .= ' ORDER BY views DESC';
117 117
         break;
118 118
     case CREATE_TIME_NEW:
119 119
         $query .= ' ORDER by post.timestamp desc';
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
         $query .= ' ORDER BY post.timestamp DESC';
129 129
         break;
130 130
     }
131
-    $query.= " limit $limit";
131
+    $query .= " limit $limit";
132 132
     return BoincPost::enum_general($query);
133 133
 }
134 134
 
135 135
 $logged_in_user = get_logged_in_user(false);
136 136
 BoincForumPrefs::lookup($logged_in_user);
137
-if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){
137
+if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) {
138 138
     $show_hidden_posts = true;
139 139
 } else {
140 140
     $show_hidden_posts = false;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 $search_max_time = post_int("search_max_time");
148 148
 $search_forum = post_int("search_forum");
149 149
 $search_sort = post_int("search_sort");
150
-$search_list = explode(" ",$search_keywords);
150
+$search_list = explode(" ", $search_keywords);
151 151
 if ($search_max_time) {
152 152
     $min_timestamp = time() - ($search_max_time*3600*24);
153 153
 } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 $limit = 100;
158 158
 
159
-if ($search_forum==-1){
159
+if ($search_forum == -1) {
160 160
     $forum = null;
161 161
 } else if ($search_forum) {
162 162
     $forum = BoincForum::lookup_id($search_forum);
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 
174 174
 // Display the threads while we search for posts
175 175
 //
176
-if (count($threads)){
177
-    echo "<h3>" . tra("Thread titles matching your query:") . "</h3>";
176
+if (count($threads)) {
177
+    echo "<h3>".tra("Thread titles matching your query:")."</h3>";
178 178
     start_table('table-striped');
179 179
     thread_list_header();
180
-    foreach ($threads as $thread){
180
+    foreach ($threads as $thread) {
181 181
         if ($thread->hidden) continue;
182 182
         thread_list_item($thread, $logged_in_user);
183 183
     }
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
     $show_hidden_posts
194 194
 );
195 195
 
196
-if (count($posts)){
197
-    echo "<h3>" . tra("Messages matching your query:") . "</h3>";
196
+if (count($posts)) {
197
+    echo "<h3>".tra("Messages matching your query:")."</h3>";
198 198
     start_table('table-striped');
199 199
     row_heading_array(['Info', 'Post'], ['', 'width=70%']);
200 200
     $n = 1;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     end_table();
218 218
 }
219 219
 
220
-if (!count($threads) && !count($posts)){
220
+if (!count($threads) && !count($posts)) {
221 221
     echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p>
222 222
     <p>"
223 223
     .tra("You can also %1 try the same search on Google. %2",
@@ -228,5 +228,5 @@  discard block
 block discarded – undo
228 228
 echo "<p><a href=\"forum_search.php\">".tra("Perform another search")."</a></p>";
229 229
 page_tail();
230 230
 
231
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
231
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
232 232
 ?>
Please login to merge, or discard this patch.
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 function search_thread_titles(
34 34
     $keyword_list, $forum="", $user="", $time="", $limit=200,
35 35
     $sort_style=CREATE_TIME_NEW, $show_hidden = false
36
-){
36
+) {
37 37
     $search_string="%";
38 38
     foreach ($keyword_list as $key => $word) {
39 39
         $search_string .= BoincDb::escape_string($word)."%";
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 //
85 85
 function search_post_content(
86 86
     $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden
87
-){
87
+) {
88 88
     $db = BoincDb::get();
89 89
 
90 90
     $search_string="%";
91
-    foreach ($keyword_list as $key => $word){
91
+    foreach ($keyword_list as $key => $word) {
92 92
         $search_string .= BoincDb::escape_string($word)."%";
93 93
     }
94 94
     $optional_join = "";
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 $logged_in_user = get_logged_in_user(false);
136 136
 BoincForumPrefs::lookup($logged_in_user);
137
-if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){
137
+if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) {
138 138
     $show_hidden_posts = true;
139 139
 } else {
140 140
     $show_hidden_posts = false;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 $limit = 100;
158 158
 
159
-if ($search_forum==-1){
159
+if ($search_forum==-1) {
160 160
     $forum = null;
161 161
 } else if ($search_forum) {
162 162
     $forum = BoincForum::lookup_id($search_forum);
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 
174 174
 // Display the threads while we search for posts
175 175
 //
176
-if (count($threads)){
176
+if (count($threads)) {
177 177
     echo "<h3>" . tra("Thread titles matching your query:") . "</h3>";
178 178
     start_table('table-striped');
179 179
     thread_list_header();
180
-    foreach ($threads as $thread){
180
+    foreach ($threads as $thread) {
181 181
         if ($thread->hidden) continue;
182 182
         thread_list_item($thread, $logged_in_user);
183 183
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     $show_hidden_posts
194 194
 );
195 195
 
196
-if (count($posts)){
196
+if (count($posts)) {
197 197
     echo "<h3>" . tra("Messages matching your query:") . "</h3>";
198 198
     start_table('table-striped');
199 199
     row_heading_array(['Info', 'Post'], ['', 'width=70%']);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     end_table();
218 218
 }
219 219
 
220
-if (!count($threads) && !count($posts)){
220
+if (!count($threads) && !count($posts)) {
221 221
     echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p>
222 222
     <p>"
223 223
     .tra("You can also %1 try the same search on Google. %2",
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam_forum.module 4 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -387,8 +387,7 @@
 block discarded – undo
387 387
     $team = node_load($nid);
388 388
     $output .= '<p>' . bts('You may create a message board for use by @team',
389 389
       array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>';
390
-  }
391
-  else {
390
+  } else {
392 391
     $output .= '<p>' . bts('This is a team-only message board', array(), NULL, 'boinc:team-forum') . ':</p>';
393 392
   }
394 393
   $output .= '<ul>';
Please login to merge, or discard this patch.
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -25,29 +25,29 @@  discard block
 block discarded – undo
25 25
  * Implementation of hook_menu()
26 26
  */
27 27
 function boincteam_forum_menu() {
28
-  $items = array();
28
+    $items = array();
29 29
 
30
-  return $items;
30
+    return $items;
31 31
 }
32 32
 
33 33
 /**
34 34
 * Implementation of hook_form_alter()
35 35
 */
36 36
 function boincteam_forum_form_alter(&$form, $form_state, $form_id) {
37
-  switch ($form_id) {
38
-  // Team forum node edit form
39
-  case 'team_forum_node_form':
37
+    switch ($form_id) {
38
+    // Team forum node edit form
39
+    case 'team_forum_node_form':
40 40
 
41 41
     // Internal fields to indicate where these changes are taking place
42 42
     array_unshift($form, array(
43
-      'tfid' => array(
43
+        'tfid' => array(
44 44
         '#type' => 'hidden',
45 45
         '#value' => arg(3),
46
-      ),
46
+        ),
47 47
     ));
48 48
     break;
49 49
 
50
-  default:
50
+    default:
51 51
   }
52 52
 }
53 53
 
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
  * Obsolete in Drupal 7...
57 57
  */
58 58
 function boincteam_forum_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
59
-  // In Drupal 7, these operation cases will all exist as their own hooks,
60
-  // so let's approximate that here so that this function can simply be removed
61
-  // upon migration to 7
62
-  switch($op) {
63
-  case 'insert':
59
+    // In Drupal 7, these operation cases will all exist as their own hooks,
60
+    // so let's approximate that here so that this function can simply be removed
61
+    // upon migration to 7
62
+    switch($op) {
63
+    case 'insert':
64 64
     boincteam_forum_node_insert($node);
65 65
     break;
66
-  case 'load':
66
+    case 'load':
67 67
     boincteam_forum_node_load($node);
68 68
     break;
69
-  case 'update':
69
+    case 'update':
70 70
     boincteam_forum_node_update($node);
71 71
     break;
72
-  case 'validate':
72
+    case 'validate':
73 73
     boincteam_forum_node_validate($node);
74 74
     break;
75
-  case 'view':
75
+    case 'view':
76 76
     boincteam_forum_node_view($node);
77 77
     break;
78
-  default:
78
+    default:
79 79
   }
80 80
 }
81 81
 
@@ -84,21 +84,21 @@  discard block
 block discarded – undo
84 84
  * is inserted (forward compatible to Drupal 7)
85 85
  */
86 86
 function boincteam_forum_node_insert($node) {
87
-  switch($node->type) {
88
-  case 'team_forum':
87
+    switch($node->type) {
88
+    case 'team_forum':
89 89
     $account = user_load($node->uid);
90 90
     $team_id = boincteam_forum_lookup_nid($node->tfid);
91 91
     if ($account->team == $team_id) {
92
-      db_query("
92
+        db_query("
93 93
         INSERT INTO {boincteam_forum_node} SET
94 94
           nid = %d,
95 95
           tfid = %d",
96 96
         $node->nid, $node->tfid
97
-      );
97
+        );
98 98
     }
99 99
     unset($node->tfid);
100 100
     break;
101
-  default:
101
+    default:
102 102
   }
103 103
 }
104 104
 
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
  * is loaded (forward compatible to Drupal 7)
108 108
  */
109 109
 function boincteam_forum_node_load($node) {
110
-  switch($node->type) {
111
-  case 'team_forum':
110
+    switch($node->type) {
111
+    case 'team_forum':
112 112
     $node->tfid = db_result(db_query("
113 113
       SELECT tfid FROM {boincteam_forum_node}
114 114
       WHERE nid = %d", $node->nid
115 115
     ));
116 116
     break;
117 117
 
118
-  default:
118
+    default:
119 119
 
120 120
   }
121 121
 }
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
  * is updated (forward compatible to Drupal 7)
126 126
  */
127 127
 function boincteam_forum_node_update($node) {
128
-  switch($node->type) {
129
-  case 'team_forum':
128
+    switch($node->type) {
129
+    case 'team_forum':
130 130
 
131 131
     break;
132 132
 
133
-  default:
133
+    default:
134 134
 
135 135
   }
136 136
 }
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
  * is validated (forward compatible to Drupal 7)
141 141
  */
142 142
 function boincteam_forum_node_validate($node) {
143
-  switch($node->type) {
144
-  case 'team_forum':
143
+    switch($node->type) {
144
+    case 'team_forum':
145 145
     $account = user_load($node->uid);
146 146
     // Get tfid from node, but if empty/null, get it from the database
147 147
     if (!($node->tfid)) {
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
     }
155 155
     $team_id = boincteam_forum_lookup_nid($tfid);
156 156
     if (!$account->team OR $account->team != $team_id) {
157
-      drupal_set_message(t('Failed to add team forum topic.'), 'error');
158
-      drupal_goto('community/forum');
157
+        drupal_set_message(t('Failed to add team forum topic.'), 'error');
158
+        drupal_goto('community/forum');
159 159
     }
160 160
     break;
161
-  default:
161
+    default:
162 162
   }
163 163
 }
164 164
 
@@ -167,19 +167,19 @@  discard block
 block discarded – undo
167 167
  * is viewed (forward compatible to Drupal 7)
168 168
  */
169 169
 function boincteam_forum_node_view($node) {
170
-  switch($node->type) {
171
-  case 'team_forum':
170
+    switch($node->type) {
171
+    case 'team_forum':
172 172
     $team_id = boincteam_forum_lookup_nid($node->tfid);
173 173
     $public_forum = boincteam_forum_is_public($node->tfid);
174 174
     $is_member = boincteam_is_member($team_id);
175 175
     $is_global_moderator = boincteam_forum_is_global_moderator();
176 176
     if (!$public_forum AND !$is_member AND !$is_global_moderator) {
177
-      drupal_not_found();
178
-      module_invoke_all('exit');
179
-      exit();
177
+        drupal_not_found();
178
+        module_invoke_all('exit');
179
+        exit();
180 180
     }
181 181
     break;
182
-  default:
182
+    default:
183 183
   }
184 184
 }
185 185
 
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
 * Implementation of hook_views_api().
188 188
 */
189 189
 function boincteam_forum_views_api() {
190
-  return array(
190
+    return array(
191 191
     'api' => 2.0,
192 192
     'path' => drupal_get_path('module', 'boincteam_forum')
193
-  );
193
+    );
194 194
 }
195 195
 
196 196
 /**
197 197
  * Implementation of hook_perm()
198 198
  */
199 199
 function boincteam_forum_perm() {
200
-  return array('manage boincteam forum');
200
+    return array('manage boincteam forum');
201 201
 }
202 202
 
203 203
 
@@ -209,43 +209,43 @@  discard block
 block discarded – undo
209 209
  * Check if the user has global access to moderate team forums
210 210
  */
211 211
 function boincteam_forum_is_global_moderator() {
212
-  global $user;
213
-  return user_access('manage boincteam forum');
212
+    global $user;
213
+    return user_access('manage boincteam forum');
214 214
 }
215 215
 
216 216
 /*
217 217
  * Check if any forums for a team are public
218 218
  */
219 219
 function boincteam_forum_is_any_public($team_id) {
220
-  $forums = boincteam_forum_list($team_id);
221
-  foreach ($forums as $forum) {
220
+    $forums = boincteam_forum_list($team_id);
221
+    foreach ($forums as $forum) {
222 222
     if ($forum->public) {
223
-      return TRUE;
223
+        return TRUE;
224 224
     }
225
-  }
226
-  return FALSE;
225
+    }
226
+    return FALSE;
227 227
 }
228 228
 
229 229
 /*
230 230
  * Check if a team forum should be visible to everyone
231 231
  */
232 232
 function boincteam_forum_is_public($tfid) {
233
-  return db_result(db_query("
233
+    return db_result(db_query("
234 234
     SELECT public FROM {boincteam_forum} WHERE tfid=%d", $tfid
235
-  ));
235
+    ));
236 236
 }
237 237
 
238 238
 /*
239 239
  * Load the forums for a team, if any exist
240 240
  */
241 241
 function boincteam_forum_list($team_id = NULL) {
242
-  if (!$team_id) {
242
+    if (!$team_id) {
243 243
     global $user;
244 244
     $account = user_load($user->uid);
245 245
     $team_id = $account->team;
246
-  }
247
-  $team_forums = array();
248
-  if ($team_id) {
246
+    }
247
+    $team_forums = array();
248
+    if ($team_id) {
249 249
     // Load any team forum objects for the user's team
250 250
     $result = db_query("
251 251
       SELECT tfid, nid, title, description, created, updated, public,
@@ -255,26 +255,26 @@  discard block
 block discarded – undo
255 255
     $row = 0;
256 256
     while ($team_forum = db_fetch_object($result)) {
257 257
 
258
-      $team_forum->link = url("community/teams/{$team_id}/forum/{$team_forum->tfid}");
259
-      $team_forum->zebra = $row % 2 ? 'even' : 'odd';
260
-      $team_forum->new_topics = 0; // TODO: Track user views of team topics
261
-      $team_forum->new_text = '';
262
-      $team_forum->new_url = '';
263
-      $team_forum->num_topics = db_result(db_query("
258
+        $team_forum->link = url("community/teams/{$team_id}/forum/{$team_forum->tfid}");
259
+        $team_forum->zebra = $row % 2 ? 'even' : 'odd';
260
+        $team_forum->new_topics = 0; // TODO: Track user views of team topics
261
+        $team_forum->new_text = '';
262
+        $team_forum->new_url = '';
263
+        $team_forum->num_topics = db_result(db_query("
264 264
         SELECT COUNT(nid) FROM {boincteam_forum_node}
265 265
         WHERE tfid = %d",
266 266
         $team_forum->tfid
267
-      ));
268
-      $team_forum->num_posts = db_result(db_query("
267
+        ));
268
+        $team_forum->num_posts = db_result(db_query("
269 269
         SELECT COALESCE(SUM(ncs.comment_count),0) + COUNT(ncs.nid)
270 270
         FROM {boincteam_forum_node} bfn
271 271
         JOIN {node_comment_statistics} ncs ON ncs.nid = bfn.nid
272 272
         JOIN {node} n ON n.nid = ncs.nid
273 273
         WHERE bfn.tfid = %d AND n.status = 1",
274 274
         $team_forum->tfid
275
-      ));
276
-      $last_post = new stdClass();
277
-      $last_post->timestamp = db_result(db_query("
275
+        ));
276
+        $last_post = new stdClass();
277
+        $last_post->timestamp = db_result(db_query("
278 278
         SELECT ncs.last_comment_timestamp FROM {node} n
279 279
         INNER JOIN {boincteam_forum_node} bfn
280 280
         INNER JOIN {node_comment_statistics} ncs ON n.nid = bfn.nid AND n.nid = ncs.nid
@@ -282,36 +282,36 @@  discard block
 block discarded – undo
282 282
         ORDER BY ncs.last_comment_timestamp DESC
283 283
         LIMIT 1",
284 284
         $team_forum->tfid
285
-      ));
286
-      $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : NULL);
287
-      $team_forums[$team_forum->tfid] = $team_forum;
288
-      $row++;
285
+        ));
286
+        $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : NULL);
287
+        $team_forums[$team_forum->tfid] = $team_forum;
288
+        $row++;
289 289
     }
290
-  }
291
-  return $team_forums;
290
+    }
291
+    return $team_forums;
292 292
 }
293 293
 
294 294
 /*
295 295
  * Load a team forum by ID
296 296
  */
297 297
 function boincteam_forum_load($tfid) {
298
-  // Load any team forum objects for the user's team
299
-  $result = db_query("
298
+    // Load any team forum objects for the user's team
299
+    $result = db_query("
300 300
     SELECT tfid, nid, title, description, created, updated, public,
301 301
       min_time_between_posts, min_total_credit_to_post, min_avg_credit_to_post
302 302
     FROM {boincteam_forum} WHERE tfid=%d", $tfid
303
-  );
304
-  return db_fetch_object($result);
303
+    );
304
+    return db_fetch_object($result);
305 305
 }
306 306
 
307 307
 /*
308 308
  * Look up the team ID for a given team forum
309 309
  */
310 310
 function boincteam_forum_lookup_nid($tfid) {
311
-  return db_result(db_query("
311
+    return db_result(db_query("
312 312
     SELECT nid FROM {boincteam_forum}
313 313
     WHERE tfid=%d", $tfid
314
-  ));
314
+    ));
315 315
 }
316 316
 
317 317
 
@@ -323,80 +323,80 @@  discard block
 block discarded – undo
323 323
  * Create team forum form
324 324
  */
325 325
 function boincteam_forum_create_form_panel() {
326
-  $output = '';
327
-  $output .= '<h2 class="pane-title">' . bts('Create team message board', array(), NULL, 'boinc:team-forum')
326
+    $output = '';
327
+    $output .= '<h2 class="pane-title">' . bts('Create team message board', array(), NULL, 'boinc:team-forum')
328 328
     . '</h2>';
329
-  $output .= drupal_get_form('boincteam_forum_create_form');
329
+    $output .= drupal_get_form('boincteam_forum_create_form');
330 330
 
331
-  return $output;
331
+    return $output;
332 332
 }
333 333
 
334 334
 /**
335 335
  * Edit team forum form
336 336
  */
337 337
 function boincteam_forum_edit_form_panel($tfid) {
338
-  $team_forum = boincteam_forum_load($tfid);
339
-  $output = '';
340
-  $output .= '<h2 class="pane-title">' . bts('Edit message board', array(), NULL, 'boinc:team-forum') . ': ' .
338
+    $team_forum = boincteam_forum_load($tfid);
339
+    $output = '';
340
+    $output .= '<h2 class="pane-title">' . bts('Edit message board', array(), NULL, 'boinc:team-forum') . ': ' .
341 341
     $team_forum->title . '</h2>';
342
-  $output .= drupal_get_form('boincteam_forum_edit_form', $tfid);
342
+    $output .= drupal_get_form('boincteam_forum_edit_form', $tfid);
343 343
 
344
-  return $output;
344
+    return $output;
345 345
 }
346 346
 
347 347
 /**
348 348
  * Link to team forums
349 349
  */
350 350
 function boincteam_forum_link_panel($team_id) {
351
-  $show_public_only = (
351
+    $show_public_only = (
352 352
     !boincteam_is_member($team_id) AND
353 353
     !boincteam_forum_is_global_moderator()
354
-  );
355
-  $forums = boincteam_forum_list($team_id);
356
-  $output = '';
357
-  $output .= '<h2 class="pane-title">' . bts('Team forum', array(), NULL, 'boinc:team-forum') . '</h2>';
358
-  $output .= '<p>'
354
+    );
355
+    $forums = boincteam_forum_list($team_id);
356
+    $output = '';
357
+    $output .= '<h2 class="pane-title">' . bts('Team forum', array(), NULL, 'boinc:team-forum') . '</h2>';
358
+    $output .= '<p>'
359 359
     . bts('A discussion forum has been set up for team members.', array(), NULL, 'boinc:team-forum')
360 360
     . '</p>';
361
-  $output .= '<ul class="tab-list action-list">';
362
-  foreach ($forums as $forum) {
361
+    $output .= '<ul class="tab-list action-list">';
362
+    foreach ($forums as $forum) {
363 363
     if (!$show_public_only OR $forum->public) {
364
-      $output .= '  <li class="tab primary">' .
364
+        $output .= '  <li class="tab primary">' .
365 365
         l(
366
-          //$forum->title,
367
-          bts('Enter forum', array(), NULL, 'boinc:team-forum'),
368
-          "community/teams/{$team_id}/forum/{$forum->tfid}"
366
+            //$forum->title,
367
+            bts('Enter forum', array(), NULL, 'boinc:team-forum'),
368
+            "community/teams/{$team_id}/forum/{$forum->tfid}"
369 369
         ) . '</li>';
370
-      // Since we're only supporting one team forum for now, we've labeled the
371
-      // link in a generic way above and will now just break out of the loop
372
-      break;
370
+        // Since we're only supporting one team forum for now, we've labeled the
371
+        // link in a generic way above and will now just break out of the loop
372
+        break;
373 373
     }
374
-  }
375
-  $output .= '</ul>';
376
-  return $output;
374
+    }
375
+    $output .= '</ul>';
376
+    return $output;
377 377
 }
378 378
 
379 379
 /**
380 380
  * General info about team forums
381 381
  */
382 382
 function boincteam_forum_topic_overview_panel($nid = NULL) {
383
-  $output = '';
384
-  $output .= '<h2 class="pane-title">' . bts('About message boards', array(), NULL, 'boinc:team-forum') . '</h2>';
385
-  $output .= '<div>';
386
-  if ($nid) {
383
+    $output = '';
384
+    $output .= '<h2 class="pane-title">' . bts('About message boards', array(), NULL, 'boinc:team-forum') . '</h2>';
385
+    $output .= '<div>';
386
+    if ($nid) {
387 387
     $team = node_load($nid);
388 388
     $output .= '<p>' . bts('You may create a message board for use by @team',
389
-      array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>';
390
-  }
391
-  else {
389
+        array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>';
390
+    }
391
+    else {
392 392
     $output .= '<p>' . bts('This is a team-only message board', array(), NULL, 'boinc:team-forum') . ':</p>';
393
-  }
394
-  $output .= '<ul>';
395
-  $output .= '  <li>' . bts('Only members may post', array(), NULL, 'boinc:team-forum') . '</li>';
396
-  $output .= '  <li>' . bts('Only members may read (optional)', array(), NULL, 'boinc:team-forum') . '</li>';
397
-  $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges', array(), NULL, 'boinc:team-forum') .
393
+    }
394
+    $output .= '<ul>';
395
+    $output .= '  <li>' . bts('Only members may post', array(), NULL, 'boinc:team-forum') . '</li>';
396
+    $output .= '  <li>' . bts('Only members may read (optional)', array(), NULL, 'boinc:team-forum') . '</li>';
397
+    $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges', array(), NULL, 'boinc:team-forum') .
398 398
     '</li>';
399
-  $output .= '</ul>';
400
-  $output .= '</div>';
401
-  return $output;
399
+    $output .= '</ul>';
400
+    $output .= '</div>';
401
+    return $output;
402 402
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
   // In Drupal 7, these operation cases will all exist as their own hooks,
60 60
   // so let's approximate that here so that this function can simply be removed
61 61
   // upon migration to 7
62
-  switch($op) {
62
+  switch ($op) {
63 63
   case 'insert':
64 64
     boincteam_forum_node_insert($node);
65 65
     break;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * is inserted (forward compatible to Drupal 7)
85 85
  */
86 86
 function boincteam_forum_node_insert($node) {
87
-  switch($node->type) {
87
+  switch ($node->type) {
88 88
   case 'team_forum':
89 89
     $account = user_load($node->uid);
90 90
     $team_id = boincteam_forum_lookup_nid($node->tfid);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  * is loaded (forward compatible to Drupal 7)
108 108
  */
109 109
 function boincteam_forum_node_load($node) {
110
-  switch($node->type) {
110
+  switch ($node->type) {
111 111
   case 'team_forum':
112 112
     $node->tfid = db_result(db_query("
113 113
       SELECT tfid FROM {boincteam_forum_node}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
  * is updated (forward compatible to Drupal 7)
126 126
  */
127 127
 function boincteam_forum_node_update($node) {
128
-  switch($node->type) {
128
+  switch ($node->type) {
129 129
   case 'team_forum':
130 130
 
131 131
     break;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * is validated (forward compatible to Drupal 7)
141 141
  */
142 142
 function boincteam_forum_node_validate($node) {
143
-  switch($node->type) {
143
+  switch ($node->type) {
144 144
   case 'team_forum':
145 145
     $account = user_load($node->uid);
146 146
     // Get tfid from node, but if empty/null, get it from the database
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
  * is viewed (forward compatible to Drupal 7)
168 168
  */
169 169
 function boincteam_forum_node_view($node) {
170
-  switch($node->type) {
170
+  switch ($node->type) {
171 171
   case 'team_forum':
172 172
     $team_id = boincteam_forum_lookup_nid($node->tfid);
173 173
     $public_forum = boincteam_forum_is_public($node->tfid);
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     while ($team_forum = db_fetch_object($result)) {
257 257
 
258 258
       $team_forum->link = url("community/teams/{$team_id}/forum/{$team_forum->tfid}");
259
-      $team_forum->zebra = $row % 2 ? 'even' : 'odd';
259
+      $team_forum->zebra = $row%2 ? 'even' : 'odd';
260 260
       $team_forum->new_topics = 0; // TODO: Track user views of team topics
261 261
       $team_forum->new_text = '';
262 262
       $team_forum->new_url = '';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
  */
325 325
 function boincteam_forum_create_form_panel() {
326 326
   $output = '';
327
-  $output .= '<h2 class="pane-title">' . bts('Create team message board', array(), NULL, 'boinc:team-forum')
327
+  $output .= '<h2 class="pane-title">'.bts('Create team message board', array(), NULL, 'boinc:team-forum')
328 328
     . '</h2>';
329 329
   $output .= drupal_get_form('boincteam_forum_create_form');
330 330
 
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 function boincteam_forum_edit_form_panel($tfid) {
338 338
   $team_forum = boincteam_forum_load($tfid);
339 339
   $output = '';
340
-  $output .= '<h2 class="pane-title">' . bts('Edit message board', array(), NULL, 'boinc:team-forum') . ': ' .
341
-    $team_forum->title . '</h2>';
340
+  $output .= '<h2 class="pane-title">'.bts('Edit message board', array(), NULL, 'boinc:team-forum').': '.
341
+    $team_forum->title.'</h2>';
342 342
   $output .= drupal_get_form('boincteam_forum_edit_form', $tfid);
343 343
 
344 344
   return $output;
@@ -354,19 +354,19 @@  discard block
 block discarded – undo
354 354
   );
355 355
   $forums = boincteam_forum_list($team_id);
356 356
   $output = '';
357
-  $output .= '<h2 class="pane-title">' . bts('Team forum', array(), NULL, 'boinc:team-forum') . '</h2>';
357
+  $output .= '<h2 class="pane-title">'.bts('Team forum', array(), NULL, 'boinc:team-forum').'</h2>';
358 358
   $output .= '<p>'
359 359
     . bts('A discussion forum has been set up for team members.', array(), NULL, 'boinc:team-forum')
360 360
     . '</p>';
361 361
   $output .= '<ul class="tab-list action-list">';
362 362
   foreach ($forums as $forum) {
363 363
     if (!$show_public_only OR $forum->public) {
364
-      $output .= '  <li class="tab primary">' .
364
+      $output .= '  <li class="tab primary">'.
365 365
         l(
366 366
           //$forum->title,
367 367
           bts('Enter forum', array(), NULL, 'boinc:team-forum'),
368 368
           "community/teams/{$team_id}/forum/{$forum->tfid}"
369
-        ) . '</li>';
369
+        ).'</li>';
370 370
       // Since we're only supporting one team forum for now, we've labeled the
371 371
       // link in a generic way above and will now just break out of the loop
372 372
       break;
@@ -381,20 +381,20 @@  discard block
 block discarded – undo
381 381
  */
382 382
 function boincteam_forum_topic_overview_panel($nid = NULL) {
383 383
   $output = '';
384
-  $output .= '<h2 class="pane-title">' . bts('About message boards', array(), NULL, 'boinc:team-forum') . '</h2>';
384
+  $output .= '<h2 class="pane-title">'.bts('About message boards', array(), NULL, 'boinc:team-forum').'</h2>';
385 385
   $output .= '<div>';
386 386
   if ($nid) {
387 387
     $team = node_load($nid);
388
-    $output .= '<p>' . bts('You may create a message board for use by @team',
389
-      array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>';
388
+    $output .= '<p>'.bts('You may create a message board for use by @team',
389
+      array('@team' => $team->title), NULL, 'boinc:team-forum').':</p>';
390 390
   }
391 391
   else {
392
-    $output .= '<p>' . bts('This is a team-only message board', array(), NULL, 'boinc:team-forum') . ':</p>';
392
+    $output .= '<p>'.bts('This is a team-only message board', array(), NULL, 'boinc:team-forum').':</p>';
393 393
   }
394 394
   $output .= '<ul>';
395
-  $output .= '  <li>' . bts('Only members may post', array(), NULL, 'boinc:team-forum') . '</li>';
396
-  $output .= '  <li>' . bts('Only members may read (optional)', array(), NULL, 'boinc:team-forum') . '</li>';
397
-  $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges', array(), NULL, 'boinc:team-forum') .
395
+  $output .= '  <li>'.bts('Only members may post', array(), NULL, 'boinc:team-forum').'</li>';
396
+  $output .= '  <li>'.bts('Only members may read (optional)', array(), NULL, 'boinc:team-forum').'</li>';
397
+  $output .= '  <li>'.bts('Founder & Team Admins have moderator privileges', array(), NULL, 'boinc:team-forum').
398 398
     '</li>';
399 399
   $output .= '</ul>';
400 400
   $output .= '</div>';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $tfid = $node->tfid;
154 154
     }
155 155
     $team_id = boincteam_forum_lookup_nid($tfid);
156
-    if (!$account->team OR $account->team != $team_id) {
156
+    if (!$account->team or $account->team != $team_id) {
157 157
       drupal_set_message(t('Failed to add team forum topic.'), 'error');
158 158
       drupal_goto('community/forum');
159 159
     }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     $public_forum = boincteam_forum_is_public($node->tfid);
174 174
     $is_member = boincteam_is_member($team_id);
175 175
     $is_global_moderator = boincteam_forum_is_global_moderator();
176
-    if (!$public_forum AND !$is_member AND !$is_global_moderator) {
176
+    if (!$public_forum and !$is_member and !$is_global_moderator) {
177 177
       drupal_not_found();
178 178
       module_invoke_all('exit');
179 179
       exit();
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
   $forums = boincteam_forum_list($team_id);
221 221
   foreach ($forums as $forum) {
222 222
     if ($forum->public) {
223
-      return TRUE;
223
+      return true;
224 224
     }
225 225
   }
226
-  return FALSE;
226
+  return false;
227 227
 }
228 228
 
229 229
 /*
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 /*
239 239
  * Load the forums for a team, if any exist
240 240
  */
241
-function boincteam_forum_list($team_id = NULL) {
241
+function boincteam_forum_list($team_id = null) {
242 242
   if (!$team_id) {
243 243
     global $user;
244 244
     $account = user_load($user->uid);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         LIMIT 1",
284 284
         $team_forum->tfid
285 285
       ));
286
-      $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : NULL);
286
+      $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : null);
287 287
       $team_forums[$team_forum->tfid] = $team_forum;
288 288
       $row++;
289 289
     }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
  */
325 325
 function boincteam_forum_create_form_panel() {
326 326
   $output = '';
327
-  $output .= '<h2 class="pane-title">' . bts('Create team message board', array(), NULL, 'boinc:team-forum')
327
+  $output .= '<h2 class="pane-title">' . bts('Create team message board', array(), null, 'boinc:team-forum')
328 328
     . '</h2>';
329 329
   $output .= drupal_get_form('boincteam_forum_create_form');
330 330
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 function boincteam_forum_edit_form_panel($tfid) {
338 338
   $team_forum = boincteam_forum_load($tfid);
339 339
   $output = '';
340
-  $output .= '<h2 class="pane-title">' . bts('Edit message board', array(), NULL, 'boinc:team-forum') . ': ' .
340
+  $output .= '<h2 class="pane-title">' . bts('Edit message board', array(), null, 'boinc:team-forum') . ': ' .
341 341
     $team_forum->title . '</h2>';
342 342
   $output .= drupal_get_form('boincteam_forum_edit_form', $tfid);
343 343
 
@@ -349,22 +349,22 @@  discard block
 block discarded – undo
349 349
  */
350 350
 function boincteam_forum_link_panel($team_id) {
351 351
   $show_public_only = (
352
-    !boincteam_is_member($team_id) AND
352
+    !boincteam_is_member($team_id) and
353 353
     !boincteam_forum_is_global_moderator()
354 354
   );
355 355
   $forums = boincteam_forum_list($team_id);
356 356
   $output = '';
357
-  $output .= '<h2 class="pane-title">' . bts('Team forum', array(), NULL, 'boinc:team-forum') . '</h2>';
357
+  $output .= '<h2 class="pane-title">' . bts('Team forum', array(), null, 'boinc:team-forum') . '</h2>';
358 358
   $output .= '<p>'
359
-    . bts('A discussion forum has been set up for team members.', array(), NULL, 'boinc:team-forum')
359
+    . bts('A discussion forum has been set up for team members.', array(), null, 'boinc:team-forum')
360 360
     . '</p>';
361 361
   $output .= '<ul class="tab-list action-list">';
362 362
   foreach ($forums as $forum) {
363
-    if (!$show_public_only OR $forum->public) {
363
+    if (!$show_public_only or $forum->public) {
364 364
       $output .= '  <li class="tab primary">' .
365 365
         l(
366 366
           //$forum->title,
367
-          bts('Enter forum', array(), NULL, 'boinc:team-forum'),
367
+          bts('Enter forum', array(), null, 'boinc:team-forum'),
368 368
           "community/teams/{$team_id}/forum/{$forum->tfid}"
369 369
         ) . '</li>';
370 370
       // Since we're only supporting one team forum for now, we've labeled the
@@ -379,22 +379,22 @@  discard block
 block discarded – undo
379 379
 /**
380 380
  * General info about team forums
381 381
  */
382
-function boincteam_forum_topic_overview_panel($nid = NULL) {
382
+function boincteam_forum_topic_overview_panel($nid = null) {
383 383
   $output = '';
384
-  $output .= '<h2 class="pane-title">' . bts('About message boards', array(), NULL, 'boinc:team-forum') . '</h2>';
384
+  $output .= '<h2 class="pane-title">' . bts('About message boards', array(), null, 'boinc:team-forum') . '</h2>';
385 385
   $output .= '<div>';
386 386
   if ($nid) {
387 387
     $team = node_load($nid);
388 388
     $output .= '<p>' . bts('You may create a message board for use by @team',
389
-      array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>';
389
+      array('@team' => $team->title), null, 'boinc:team-forum') . ':</p>';
390 390
   }
391 391
   else {
392
-    $output .= '<p>' . bts('This is a team-only message board', array(), NULL, 'boinc:team-forum') . ':</p>';
392
+    $output .= '<p>' . bts('This is a team-only message board', array(), null, 'boinc:team-forum') . ':</p>';
393 393
   }
394 394
   $output .= '<ul>';
395
-  $output .= '  <li>' . bts('Only members may post', array(), NULL, 'boinc:team-forum') . '</li>';
396
-  $output .= '  <li>' . bts('Only members may read (optional)', array(), NULL, 'boinc:team-forum') . '</li>';
397
-  $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges', array(), NULL, 'boinc:team-forum') .
395
+  $output .= '  <li>' . bts('Only members may post', array(), null, 'boinc:team-forum') . '</li>';
396
+  $output .= '  <li>' . bts('Only members may read (optional)', array(), null, 'boinc:team-forum') . '</li>';
397
+  $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges', array(), null, 'boinc:team-forum') .
398 398
     '</li>';
399 399
   $output .= '</ul>';
400 400
   $output .= '</div>';
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.module 4 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
         $lidkey = array_search($chunk['hash'], $nodehashtable);
137 137
         if ($lidkey) {
138 138
           unset($nodehashtable[$lidkey]);
139
-        }
140
-        else {
139
+        } else {
141 140
 
142 141
           $result = db_query("
143 142
             INSERT INTO {locales_source}
@@ -150,8 +149,7 @@  discard block
 block discarded – undo
150 149
               'Added translation source strings for node @nid chunk @chunk.',
151 150
               array('@nid' => $node->nid, '@chunk' => $idx)
152 151
            );
153
-          }
154
-          else {
152
+          } else {
155 153
             drupal_set_message(
156 154
               t('ERROR: Unable to add translation source strings.'), 'error'
157 155
             );
@@ -248,12 +246,10 @@  discard block
 block discarded – undo
248 246
         $mess = 'DEBUG ' . l('BOINC translate', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.';
249 247
         drupal_set_message($mess, 'warning');
250 248
         return $ret;
251
-      }
252
-      else {
249
+      } else {
253 250
         return _boinctranslate_filter_process($text, $format, $mynid);
254 251
       }// if debug
255
-    }
256
-    else {
252
+    } else {
257 253
       return $text;
258 254
     }// if type
259 255
     break;
@@ -309,8 +305,7 @@  discard block
 block discarded – undo
309 305
   foreach ($parts as $key => $value) {
310 306
     if (preg_match('/(#SPLIT_TOKEN#)/', $value)) {
311 307
       $chunks[] = array ('delimiter' => $value,);
312
-    }
313
-    else {
308
+    } else {
314 309
       $cleaned = preg_replace('/\s|\n/', '', $value);
315 310
       if (!empty($cleaned)) {
316 311
         $chunks[] = array(
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  * with defined URL paths
29 29
  */
30 30
 function boinctranslate_menu() {
31
-  $items['admin/boinc/translation'] = array(
31
+    $items['admin/boinc/translation'] = array(
32 32
     'title' => 'Environment: Translation',
33 33
     'description' => 'Configure URLs for translation files (i.e. integration
34 34
       with BOINC Translation Services).',
@@ -37,38 +37,38 @@  discard block
 block discarded – undo
37 37
     'access arguments' => array('administer site configuration'),
38 38
     'type' => MENU_NORMAL_ITEM,
39 39
     'file' => 'boinctranslate.admin.inc'
40
-  );
41
-  $items['admin/boinc/translation/export'] = array(
40
+    );
41
+    $items['admin/boinc/translation/export'] = array(
42 42
     'title' => 'Export translations',
43 43
     'page callback' => 'boinctranslate_export_translations',
44 44
     'access arguments' => array('administer site configuration'),
45 45
     'type' => MENU_CALLBACK,
46
-  );
47
-  $items['admin/boinc/translation/import'] = array(
46
+    );
47
+    $items['admin/boinc/translation/import'] = array(
48 48
     'title' => 'Import translations',
49 49
     'page callback' => 'boinctranslate_refresh_translations',
50 50
     'access arguments' => array('administer site configuration'),
51 51
     'type' => MENU_CALLBACK,
52
-  );
53
-  $items['admin/boinc/translation/initialize-languages'] = array(
52
+    );
53
+    $items['admin/boinc/translation/initialize-languages'] = array(
54 54
     'title' => 'Install official BOINC languages',
55 55
     'page callback' => 'boinctranslate_initialize_languages',
56 56
     'access arguments' => array('administer site configuration'),
57 57
     'type' => MENU_CALLBACK,
58
-  );
59
-  $items['admin/boinc/translation/update-official-boinc'] = array(
58
+    );
59
+    $items['admin/boinc/translation/update-official-boinc'] = array(
60 60
     'title' => 'Update official BOINC translations',
61 61
     'page callback' => 'boinctranslate_update_official_boinc_translations',
62 62
     'access arguments' => array('update official BOINC translations'),
63 63
     'type' => MENU_CALLBACK,
64
-  );
65
-  $items['admin/boinc/translation/download-pot'] = array(
64
+    );
65
+    $items['admin/boinc/translation/download-pot'] = array(
66 66
     'title' => 'Download translation template',
67 67
     'page callback' => 'boinctranslate_download_pot',
68 68
     'access arguments' => array('administer site configuration'),
69 69
     'type' => MENU_CALLBACK,
70
-  );
71
-  return $items;
70
+    );
71
+    return $items;
72 72
 }
73 73
 
74 74
 /**
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
  * Obsolete in Drupal 7...
77 77
  */
78 78
 function boinctranslate_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
79
-  // In Drupal 7, these operation cases will all exist as their own hooks,
80
-  // so let's approximate that here so that this function can simply be removed
81
-  // upon migration to 7
82
-  switch($op) {
83
-  case 'update':
79
+    // In Drupal 7, these operation cases will all exist as their own hooks,
80
+    // so let's approximate that here so that this function can simply be removed
81
+    // upon migration to 7
82
+    switch($op) {
83
+    case 'update':
84 84
     boinctranslate_node_update($node);
85 85
     break;
86
-  case 'view':
86
+    case 'view':
87 87
     global $language;
88 88
     boinctranslate_node_view($node, 'full', $language->language);
89 89
     break;
90
-  default:
90
+    default:
91 91
   }
92 92
 }
93 93
 
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
  * is updated (forward compatible to Drupal 7)
97 97
  */
98 98
 function boinctranslate_node_update($node) {
99
-  // Only process nodes of certain types as defined by the individual
100
-  // node's setting for field_boinctranslate_transifex.
101
-  if ( ($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value']=='1') ) {
99
+    // Only process nodes of certain types as defined by the individual
100
+    // node's setting for field_boinctranslate_transifex.
101
+    if ( ($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value']=='1') ) {
102 102
     // Add page content to translation table.
103 103
     $textgroup = 'project';
104 104
     $location = "node:{$node->nid}:body";
@@ -112,19 +112,19 @@  discard block
 block discarded – undo
112 112
     // Table of lid and hashes
113 113
     $nodehashtable = array();
114 114
     while ($row = db_fetch_array($dbresult)) {
115
-      $locsplit = explode(":", $row['location']);
116
-      // Look for hash in the fourth position.
117
-      if (isset($locsplit[3])) {
115
+        $locsplit = explode(":", $row['location']);
116
+        // Look for hash in the fourth position.
117
+        if (isset($locsplit[3])) {
118 118
         $nodehashtable[$row['lid']] = $locsplit[3];
119
-      }
119
+        }
120 120
     }// while
121 121
 
122 122
     // Break node body into chunks.
123 123
     $chunks = boinctranslate_splitfortranslation($node->body);
124 124
     foreach ($chunks as $idx => $chunk) {
125 125
 
126
-      // Only process this chunk if there is a hash associated with it.
127
-      if ($chunk['hash']) {
126
+        // Only process this chunk if there is a hash associated with it.
127
+        if ($chunk['hash']) {
128 128
         $chunkloc = $location . ":{$chunk['hash']}";
129 129
 
130 130
         // If the hash for this chunk is in the hash table, logically
@@ -133,45 +133,45 @@  discard block
 block discarded – undo
133 133
         // Otherwise, add the chunk to the database.
134 134
         $lidkey = array_search($chunk['hash'], $nodehashtable);
135 135
         if ($lidkey) {
136
-          unset($nodehashtable[$lidkey]);
136
+            unset($nodehashtable[$lidkey]);
137 137
         }
138 138
         else {
139 139
 
140
-          $result = db_query("
140
+            $result = db_query("
141 141
             INSERT INTO {locales_source}
142 142
             SET location = '%s', textgroup = '%s', source = '%s'",
143 143
             $chunkloc, $textgroup, $chunk['content']
144
-          );
145
-          if ($result) {
144
+            );
145
+            if ($result) {
146 146
             watchdog(
147
-              'boinctranslate',
148
-              'Added translation source strings for node @nid chunk @chunk.',
149
-              array('@nid' => $node->nid, '@chunk' => $idx)
150
-           );
151
-          }
152
-          else {
147
+                'boinctranslate',
148
+                'Added translation source strings for node @nid chunk @chunk.',
149
+                array('@nid' => $node->nid, '@chunk' => $idx)
150
+            );
151
+            }
152
+            else {
153 153
             drupal_set_message(
154
-              t('ERROR: Unable to add translation source strings.'), 'error'
154
+                t('ERROR: Unable to add translation source strings.'), 'error'
155 155
             );
156 156
             watchdog(
157
-              'boinctranslate',
158
-              'Unable to add translation source strings for node @nid chunk @chunk.',
159
-              array('@nid' => $node->nid, '@chunk' => $idx),
160
-              WATCHDOG_ERROR
157
+                'boinctranslate',
158
+                'Unable to add translation source strings for node @nid chunk @chunk.',
159
+                array('@nid' => $node->nid, '@chunk' => $idx),
160
+                WATCHDOG_ERROR
161 161
             );
162
-          }// if $result
162
+            }// if $result
163 163
         }// if lidkey
164 164
 
165
-      }// if chunk['hash']
165
+        }// if chunk['hash']
166 166
     }// foreach chunks
167 167
 
168 168
     // Any remaining hashes in the node hash table are deleted.
169 169
     foreach ($nodehashtable as $lid => $hash) {
170
-      db_query('DELETE FROM {locales_source} WHERE lid = %d', $lid);
171
-      db_query('DELETE FROM {locales_target} WHERE lid = %d', $lid);
172
-      cache_clear_all('locale:', 'cache', TRUE);
170
+        db_query('DELETE FROM {locales_source} WHERE lid = %d', $lid);
171
+        db_query('DELETE FROM {locales_target} WHERE lid = %d', $lid);
172
+        cache_clear_all('locale:', 'cache', TRUE);
173 173
     }
174
-  }// if type
174
+    }// if type
175 175
 }
176 176
 
177 177
 /**
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
  * is viewed (forward compatible to Drupal 7)
180 180
  */
181 181
 function boinctranslate_node_view($node, $view_mode, $langcode) {
182
-  switch($node->type) {
183
-  case 'page':
182
+    switch($node->type) {
183
+    case 'page':
184 184
     break;
185
-  default:
185
+    default:
186 186
   }
187 187
 }
188 188
 
@@ -195,51 +195,51 @@  discard block
 block discarded – undo
195 195
  * boinctranslate_filter_tips
196 196
  */
197 197
 function boinctranslate_filter_tips($delta, $format, $long = FALSE) {
198
-  if ($long) {
198
+    if ($long) {
199 199
     return _boinctranslate_filter_tips_long();
200
-  } else {
200
+    } else {
201 201
     $output = t('You may use !token (opens in new window) as a delimiter to split the translation into different chunks. See the link for a more detailed guide.',
202
-      array(
202
+        array(
203 203
         '!token' =>  l('#SPLIT_TOKEN#', "filter/tips/$format",
204 204
         array(
205
-          'fragment' => 'filter-boinctranslate-' . $delta,
206
-          'attributes' =>
205
+            'fragment' => 'filter-boinctranslate-' . $delta,
206
+            'attributes' =>
207 207
             array(
208
-              'target'=>'_blank',
209
-              'rel'=>'noopener noreferrer',
208
+                'target'=>'_blank',
209
+                'rel'=>'noopener noreferrer',
210 210
             ),
211 211
         ))
212
-      ));
212
+        ));
213 213
     //$output = 'Help with BOINC Translate input filter.';
214 214
     return $output;
215
-  }
215
+    }
216 216
 }
217 217
 
218 218
 /**
219 219
  * boinctranslate_filter
220 220
  */
221 221
 function boinctranslate_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
222
-  switch ($op) {
223
-  case 'list':
222
+    switch ($op) {
223
+    case 'list':
224 224
     return array(0 => bts('BOINC translation filter to help split content into chunks for translations.', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'));
225 225
 
226
-  case 'description':
226
+    case 'description':
227 227
     return bts('Splits node content into chunks for translation.', array(), NULL, 'boinc:input-filter-help');
228 228
 
229
-  case 'process':
229
+    case 'process':
230 230
     /* Only process nodes of certain types. On an individual
231 231
      * node-by-node level, content editors may choose to select
232 232
      * "Export for translation", which will allow this specific node
233 233
      * to be translated. By default this is enabled.
234 234
      */
235 235
     if ($node = menu_get_object()) {
236
-      $mynid = $node->nid;
236
+        $mynid = $node->nid;
237 237
     } else {
238
-      return $text;
238
+        return $text;
239 239
     }
240 240
 
241 241
     if ( ($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value']=='1') ) {
242
-      if (variable_get("boinctranslate_filter_debug_$format", 0)) {
242
+        if (variable_get("boinctranslate_filter_debug_$format", 0)) {
243 243
         $timing_start = explode(' ', microtime());
244 244
         $ret = _boinctranslate_filter_process($text, $format, $mynid);
245 245
         $timing_stop = explode(' ', microtime());
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
         $mess = 'DEBUG ' . l('BOINC translate', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.';
249 249
         drupal_set_message($mess, 'warning');
250 250
         return $ret;
251
-      }
252
-      else {
251
+        }
252
+        else {
253 253
         return _boinctranslate_filter_process($text, $format, $mynid);
254
-      }// if debug
254
+        }// if debug
255 255
     }
256 256
     else {
257
-      return $text;
257
+        return $text;
258 258
     }// if type
259 259
     break;
260 260
 
261
-  case 'settings':
261
+    case 'settings':
262 262
     return boinctranslate_filter_settings_form($format);
263 263
 
264
-  default:
264
+    default:
265 265
     return $text;
266
-  }
266
+    }
267 267
 }
268 268
 
269 269
 /**
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
  * This workaround makes panel page titles and pane titles translatable
272 272
  */
273 273
 function boinctranslate_panels_pane_content_alter($content, $pane, $args, $context) {
274
-  if ($content->title) {
274
+    if ($content->title) {
275 275
     $content->title = t($content->title);
276
-  }
277
-  return $content;
276
+    }
277
+    return $content;
278 278
 }
279 279
 
280 280
 /**
281 281
  * Implementation of hook_perm()
282 282
  */
283 283
 function boinctranslate_perm() {
284
-  return array('update official BOINC translations');
284
+    return array('update official BOINC translations');
285 285
 }
286 286
 
287 287
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -304,23 +304,23 @@  discard block
 block discarded – undo
304 304
  *   The input string to find.
305 305
  */
306 306
 function boinctranslate_splitfortranslation($instring) {
307
-  $parts = preg_split('/(#SPLIT_TOKEN#)|<p>(#SPLIT_TOKEN#)<\/p>/', $instring);
308
-  $chunks = array();
309
-  foreach ($parts as $key => $value) {
307
+    $parts = preg_split('/(#SPLIT_TOKEN#)|<p>(#SPLIT_TOKEN#)<\/p>/', $instring);
308
+    $chunks = array();
309
+    foreach ($parts as $key => $value) {
310 310
     if (preg_match('/(#SPLIT_TOKEN#)/', $value)) {
311
-      $chunks[] = array ('delimiter' => $value,);
311
+        $chunks[] = array ('delimiter' => $value,);
312 312
     }
313 313
     else {
314
-      $cleaned = preg_replace('/\s|\n/', '', $value);
315
-      if (!empty($cleaned)) {
314
+        $cleaned = preg_replace('/\s|\n/', '', $value);
315
+        if (!empty($cleaned)) {
316 316
         $chunks[] = array(
317
-          'content' => $value,
318
-          'hash' => hash('sha1', $cleaned),
317
+            'content' => $value,
318
+            'hash' => hash('sha1', $cleaned),
319 319
         );
320
-      }// !empty cleaned
320
+        }// !empty cleaned
321 321
     }// preg_match
322
-  }// foreach part
323
-  return $chunks;
322
+    }// foreach part
323
+    return $chunks;
324 324
 }
325 325
 
326 326
 
@@ -338,19 +338,19 @@  discard block
 block discarded – undo
338 338
  *   location/context string.
339 339
  */
340 340
 function _boinctranslate_filter_process(&$text, $format = -1, $nid) {
341
-  $newbody = '';
342
-  // Break node body into chunks.
343
-  $chunks = boinctranslate_splitfortranslation($text);
344
-  foreach ($chunks as $chunk) {
341
+    $newbody = '';
342
+    // Break node body into chunks.
343
+    $chunks = boinctranslate_splitfortranslation($text);
344
+    foreach ($chunks as $chunk) {
345 345
     $location = "project:node:${nid}:body";
346 346
     // Only add this chunk to the content if it has a hash, i.e., it
347 347
     // is not a delimiter.
348 348
     if ($chunk['hash']) {
349
-      $location .= ":{$chunk['hash']}";
350
-      $newbody .= bts($chunk['content'], array(), $langcode, $location, FALSE);
349
+        $location .= ":{$chunk['hash']}";
350
+        $newbody .= bts($chunk['content'], array(), $langcode, $location, FALSE);
351 351
     }
352
-  }
353
-  return $newbody;
352
+    }
353
+    return $newbody;
354 354
 }
355 355
 
356 356
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
  * Implementation of hooks for l10n_update
359 359
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
360 360
 function boinctranslate_l10n_update_projects_alter(&$projects) {
361
-  foreach ($projects as &$proj) {
361
+    foreach ($projects as &$proj) {
362 362
     $proj['info']['l10n path'] = 'https://ftp-origin.drupal.org/files/translations/%core/%project/%project-%release.%language.po';
363
-  }
363
+    }
364 364
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
   // In Drupal 7, these operation cases will all exist as their own hooks,
80 80
   // so let's approximate that here so that this function can simply be removed
81 81
   // upon migration to 7
82
-  switch($op) {
82
+  switch ($op) {
83 83
   case 'update':
84 84
     boinctranslate_node_update($node);
85 85
     break;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 function boinctranslate_node_update($node) {
99 99
   // Only process nodes of certain types as defined by the individual
100 100
   // node's setting for field_boinctranslate_transifex.
101
-  if ( ($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value']=='1') ) {
101
+  if (($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value'] == '1')) {
102 102
     // Add page content to translation table.
103 103
     $textgroup = 'project';
104 104
     $location = "node:{$node->nid}:body";
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
       // Only process this chunk if there is a hash associated with it.
127 127
       if ($chunk['hash']) {
128
-        $chunkloc = $location . ":{$chunk['hash']}";
128
+        $chunkloc = $location.":{$chunk['hash']}";
129 129
 
130 130
         // If the hash for this chunk is in the hash table, logically
131 131
         // the chunk is already in the database locales_source table. As
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
  * is viewed (forward compatible to Drupal 7)
180 180
  */
181 181
 function boinctranslate_node_view($node, $view_mode, $langcode) {
182
-  switch($node->type) {
182
+  switch ($node->type) {
183 183
   case 'page':
184 184
     break;
185 185
   default:
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
       array(
203 203
         '!token' =>  l('#SPLIT_TOKEN#', "filter/tips/$format",
204 204
         array(
205
-          'fragment' => 'filter-boinctranslate-' . $delta,
205
+          'fragment' => 'filter-boinctranslate-'.$delta,
206 206
           'attributes' =>
207 207
             array(
208 208
               'target'=>'_blank',
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
       return $text;
239 239
     }
240 240
 
241
-    if ( ($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value']=='1') ) {
241
+    if (($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value'] == '1')) {
242 242
       if (variable_get("boinctranslate_filter_debug_$format", 0)) {
243 243
         $timing_start = explode(' ', microtime());
244 244
         $ret = _boinctranslate_filter_process($text, $format, $mynid);
245 245
         $timing_stop = explode(' ', microtime());
246 246
         $elapsed = $timing_stop[1] - $timing_start[1];
247 247
         $elapsed += $timing_stop[0] - $timing_start[0];
248
-        $mess = 'DEBUG ' . l('BOINC translate', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.';
248
+        $mess = 'DEBUG '.l('BOINC translate', "filter/tips/$format").' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.';
249 249
         drupal_set_message($mess, 'warning');
250 250
         return $ret;
251 251
       }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
   $chunks = array();
309 309
   foreach ($parts as $key => $value) {
310 310
     if (preg_match('/(#SPLIT_TOKEN#)/', $value)) {
311
-      $chunks[] = array ('delimiter' => $value,);
311
+      $chunks[] = array('delimiter' => $value,);
312 312
     }
313 313
     else {
314 314
       $cleaned = preg_replace('/\s|\n/', '', $value);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     foreach ($nodehashtable as $lid => $hash) {
170 170
       db_query('DELETE FROM {locales_source} WHERE lid = %d', $lid);
171 171
       db_query('DELETE FROM {locales_target} WHERE lid = %d', $lid);
172
-      cache_clear_all('locale:', 'cache', TRUE);
172
+      cache_clear_all('locale:', 'cache', true);
173 173
     }
174 174
   }// if type
175 175
 }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 /**
195 195
  * boinctranslate_filter_tips
196 196
  */
197
-function boinctranslate_filter_tips($delta, $format, $long = FALSE) {
197
+function boinctranslate_filter_tips($delta, $format, $long = false) {
198 198
   if ($long) {
199 199
     return _boinctranslate_filter_tips_long();
200 200
   } else {
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 function boinctranslate_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
222 222
   switch ($op) {
223 223
   case 'list':
224
-    return array(0 => bts('BOINC translation filter to help split content into chunks for translations.', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'));
224
+    return array(0 => bts('BOINC translation filter to help split content into chunks for translations.', array(), null, 'boinc:adminpage-boinctranslate-inputfilter'));
225 225
 
226 226
   case 'description':
227
-    return bts('Splits node content into chunks for translation.', array(), NULL, 'boinc:input-filter-help');
227
+    return bts('Splits node content into chunks for translation.', array(), null, 'boinc:input-filter-help');
228 228
 
229 229
   case 'process':
230 230
     /* Only process nodes of certain types. On an individual
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
     // is not a delimiter.
348 348
     if ($chunk['hash']) {
349 349
       $location .= ":{$chunk['hash']}";
350
-      $newbody .= bts($chunk['content'], array(), $langcode, $location, FALSE);
350
+      $newbody .= bts($chunk['content'], array(), $langcode, $location, false);
351 351
     }
352 352
   }
353 353
   return $newbody;
Please login to merge, or discard this patch.
default/boinc/modules/boinctranslate/includes/boinctranslate.helpers.inc 5 patches
Switch Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1398,72 +1398,72 @@
 block discarded – undo
1398 1398
 
1399 1399
   switch ($op) {
1400 1400
     // Return stored strings
1401
-    case 'mem-report':
1402
-      return $strings;
1403
-
1404
-      // Store string in memory (only supports single strings)
1405
-    case 'mem-store':
1406
-      $strings[$value['msgid']] = $value['msgstr'];
1407
-      return;
1408
-
1409
-      // Called at end of import to inform the user
1410
-    case 'db-report':
1411
-      return array(
1412
-        $headerdone,
1413
-        $report['additions'],
1414
-        $report['updates'],
1415
-        $report['deletes'],
1416
-        $report['skips'],
1417
-      );
1401
+  case 'mem-report':
1402
+    return $strings;
1403
+
1404
+    // Store string in memory (only supports single strings)
1405
+  case 'mem-store':
1406
+    $strings[$value['msgid']] = $value['msgstr'];
1407
+    return;
1408
+
1409
+    // Called at end of import to inform the user
1410
+  case 'db-report':
1411
+    return array(
1412
+      $headerdone,
1413
+      $report['additions'],
1414
+      $report['updates'],
1415
+      $report['deletes'],
1416
+      $report['skips'],
1417
+    );
1418 1418
 
1419
-      // Store the string we got in the database.
1420
-    case 'db-store':
1421
-      // We got header information.
1422
-      if ($value['msgid'] == '') {
1423
-        $languages = language_list();
1424
-        if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) {
1425
-          // Since we only need to parse the header if we ought to update the
1426
-          // plural formula, only run this if we don't need to keep existing
1427
-          // data untouched or if we don't have an existing plural formula.
1428
-          $header = _locale_import_parse_header($value['msgstr']);
1429
-
1430
-          // Get and store the plural formula if available.
1431
-          if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1432
-            list($nplurals, $plural) = $p;
1433
-            db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang);
1434
-          }
1419
+    // Store the string we got in the database.
1420
+  case 'db-store':
1421
+    // We got header information.
1422
+    if ($value['msgid'] == '') {
1423
+      $languages = language_list();
1424
+      if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) {
1425
+        // Since we only need to parse the header if we ought to update the
1426
+        // plural formula, only run this if we don't need to keep existing
1427
+        // data untouched or if we don't have an existing plural formula.
1428
+        $header = _locale_import_parse_header($value['msgstr']);
1429
+
1430
+        // Get and store the plural formula if available.
1431
+        if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1432
+          list($nplurals, $plural) = $p;
1433
+          db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang);
1435 1434
         }
1436
-        $headerdone = TRUE;
1437 1435
       }
1436
+      $headerdone = TRUE;
1437
+    }
1438 1438
 
1439
-      else {
1440
-        // Some real string to import.
1441
-        $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
1442
-
1443
-        if (strpos($value['msgid'], "\0")) {
1444
-          // This string has plural versions.
1445
-          $english = explode("\0", $value['msgid'], 2);
1446
-          $entries = array_keys($value['msgstr']);
1447
-          for ($i = 3; $i <= count($entries); $i++) {
1448
-            $english[] = $english[1];
1449
-          }
1450
-          $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1451
-          $english = array_map('_locale_import_append_plural', $english, $entries);
1452
-          foreach ($translation as $key => $trans) {
1453
-            if ($key == 0) {
1454
-              $plid = 0;
1455
-            }
1456
-            $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
1439
+    else {
1440
+      // Some real string to import.
1441
+      $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
1442
+
1443
+      if (strpos($value['msgid'], "\0")) {
1444
+        // This string has plural versions.
1445
+        $english = explode("\0", $value['msgid'], 2);
1446
+        $entries = array_keys($value['msgstr']);
1447
+        for ($i = 3; $i <= count($entries); $i++) {
1448
+          $english[] = $english[1];
1449
+        }
1450
+        $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1451
+        $english = array_map('_locale_import_append_plural', $english, $entries);
1452
+        foreach ($translation as $key => $trans) {
1453
+          if ($key == 0) {
1454
+            $plid = 0;
1457 1455
           }
1456
+          $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
1458 1457
         }
1458
+      }
1459 1459
 
1460
-        else {
1461
-          // A simple string to import.
1462
-          $english = $value['msgid'];
1463
-          $translation = $value['msgstr'];
1464
-          _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1465
-        }
1460
+      else {
1461
+        // A simple string to import.
1462
+        $english = $value['msgid'];
1463
+        $translation = $value['msgstr'];
1464
+        _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1466 1465
       }
1466
+    }
1467 1467
   } // end of db-store operation
1468 1468
 }
1469 1469
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $available_languages = _locale_get_predefined_list();
45 45
         $transifex_languages = array();
46 46
         $disabled_languages = array();
47
-        $process_batches = FALSE;
47
+        $process_batches = false;
48 48
 
49 49
         // Set up Transifex languages in Drupal
50 50
         foreach ($response as $language) {
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
             if (isset($available_languages[$rfc_code])) {
57 57
               locale_add_language(
58 58
                 $rfc_code,
59
-                NULL,
60
-                NULL,
61
-                NULL,
62
-                NULL,
63
-                NULL,
64
-                FALSE
59
+                null,
60
+                null,
61
+                null,
62
+                null,
63
+                null,
64
+                false
65 65
               );
66 66
               drupal_set_message(
67 67
                 'Added predefined language: '.$available_languages[$rfc_code][0]
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
                     $response['name'],
91 91
                     $response['name'],
92 92
                     $response['rtl'],
93
-                    NULL,
94
-                    NULL,
95
-                    TRUE
93
+                    null,
94
+                    null,
95
+                    true
96 96
                   );
97 97
                   drupal_set_message(
98 98
                     'Added new language: '.$response['name']
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             // Import any language files for the newly added language
134 134
             if ($batch = locale_batch_by_language($rfc_code, '_locale_batch_language_finished')) {
135 135
               $operations = array_merge($operations, $batch['operations']);
136
-              $process_batches = TRUE;
136
+              $process_batches = true;
137 137
             }
138 138
           }
139 139
         }
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
   $resource_names = boinctranslate_parse_resources($resource_config);
207 207
   $primary_resource = reset($resource_names);
208 208
 
209
-  if ($project_name AND $primary_resource) {
209
+  if ($project_name and $primary_resource) {
210 210
     // Create or update the translation source, if needed
211
-    $source_exists = FALSE;
211
+    $source_exists = false;
212 212
     $path = "project/{$project_name}/resources";
213 213
     $resources = boinctranslate_transifex_request($path);
214
-    if ($resources AND is_array($resources)) {
214
+    if ($resources and is_array($resources)) {
215 215
       foreach ($resources as $resource) {
216 216
         if ($resource['slug'] == $primary_resource) {
217
-          $source_exists = TRUE;
217
+          $source_exists = true;
218 218
           break;
219 219
         }
220 220
       }
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
         $post = array(
237 237
           'content' => boinctranslate_get_po('en', 'project')
238 238
         );
239
-        $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
239
+        $result = boinctranslate_transifex_request($path, $post, true, true);
240 240
       }
241 241
     }
242 242
 
243
-    if (is_array($result) OR substr($result, 0, 6) != 'ERROR:') {
243
+    if (is_array($result) or substr($result, 0, 6) != 'ERROR:') {
244 244
       $enabled_languages = locale_language_list();
245 245
       if ($source_exists) {
246 246
         drupal_set_message('Updated source translation strings at Transifex');
@@ -259,16 +259,16 @@  discard block
 block discarded – undo
259 259
           $post = array(
260 260
             'content' => $po_file,
261 261
           );
262
-          $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
262
+          $result = boinctranslate_transifex_request($path, $post, true, true);
263 263
           if (!is_array($result)
264
-          AND substr($result, 0, 6) == 'ERROR:') {
264
+          and substr($result, 0, 6) == 'ERROR:') {
265 265
             drupal_set_message(
266 266
               "Unable to update {$language_name} translations: {$result}",
267 267
               'warning'
268 268
             );
269 269
           }
270 270
           else {
271
-            drupal_set_message("Updated {$language_name} translations");
271
+            drupal_set_message("updated {$language_name} translations");
272 272
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
273 273
           }
274 274
         }
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
     'boinc_translate_transifex_boinc_drupal_resource', ''
306 306
   );
307 307
 
308
-  if ($project_name AND $drupal_resource) {
308
+  if ($project_name and $drupal_resource) {
309 309
     // Create or update the translation source, if needed
310
-    $source_exists = FALSE;
310
+    $source_exists = false;
311 311
     $path = "project/{$project_name}/resources";
312 312
     $resources = boinctranslate_transifex_request($path);
313
-    if ($resources AND is_array($resources)) {
313
+    if ($resources and is_array($resources)) {
314 314
       foreach ($resources as $resource) {
315 315
         if ($resource['slug'] == $drupal_resource) {
316
-          $source_exists = TRUE;
316
+          $source_exists = true;
317 317
           break;
318 318
         }
319 319
       }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
           $post = array(
333 333
             'content' => $po_file,
334 334
           );
335
-          $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
335
+          $result = boinctranslate_transifex_request($path, $post, true, true);
336 336
 
337 337
           if (!is_array($result)) {
338 338
             if (substr($result, 0, 6) == 'ERROR:') {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
               break;
350 350
             }
351 351
             elseif ($result == 'success') {
352
-              drupal_set_message("Updated {$language_name} official BOINC translations");
352
+              drupal_set_message("updated {$language_name} official BOINC translations");
353 353
             }
354 354
             else {
355 355
               drupal_set_message(
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             }
360 360
           }
361 361
           else {
362
-            drupal_set_message("Updated {$language_name} official BOINC translations");
362
+            drupal_set_message("updated {$language_name} official BOINC translations");
363 363
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
364 364
           }
365 365
         }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     }
371 371
     else {
372 372
       drupal_set_message(
373
-        "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex",
373
+        "the {$drupal_resource} resource does not exist in the {$project_name} project at Transifex",
374 374
         'warning'
375 375
       );
376 376
     }
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
  *
389 389
  */
390 390
 function boinctranslate_download_pot($type = 'boinc') {
391
-  $po = boinctranslate_get_po(NULL, $type);
392
-  _locale_export_po(NULL, $po);
391
+  $po = boinctranslate_get_po(null, $type);
392
+  _locale_export_po(null, $po);
393 393
 }
394 394
 
395 395
 /**
396 396
  *
397 397
  */
398
-function boinctranslate_transifex_request($path, $post = NULL, $json = TRUE, $use_put = FALSE, $username = '', $password = '') {
398
+function boinctranslate_transifex_request($path, $post = null, $json = true, $use_put = false, $username = '', $password = '') {
399 399
   $debug_mode = variable_get('boinc_debug_mode', 0);
400 400
 
401 401
   // Transifex details
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
   $headers = array(
408 408
     'Authorization' => 'Basic ' . base64_encode($username . ":" . $password),
409 409
   );
410
-  $data = NULL;
410
+  $data = null;
411 411
 
412 412
   if ($post) {
413 413
     if ($json) {
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
   case 304:
431 431
     if ($json) {
432 432
       // Process as JSON
433
-      return json_decode($response->data, TRUE);
433
+      return json_decode($response->data, true);
434 434
     }
435 435
     else {
436 436
       return (string) $response->data;
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     return "ERROR: User not allowed to perform this action";
449 449
   }
450 450
 
451
-  return NULL;
451
+  return null;
452 452
 }
453 453
 
454 454
 /**
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
   require_once(getcwd() . '/includes/locale.inc');
460 460
 
461 461
   $all_languages = language_list();
462
-  $language = $langcode ? $all_languages[$langcode] : NULL;
462
+  $language = $langcode ? $all_languages[$langcode] : null;
463 463
   $textgroups = array();
464 464
   $strings = array();
465 465
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
     // Set the string context
496 496
     $strings[$id]['context'] = trim($string['comment']);
497 497
   }
498
-  if ($langcode AND $langcode != 'en') {
498
+  if ($langcode and $langcode != 'en') {
499 499
     // If not the source language, remove untranslated strings from the ouput
500 500
     foreach ($strings as $i => $string) {
501 501
       if (!$string['translation']) {
@@ -504,23 +504,23 @@  discard block
 block discarded – undo
504 504
     }
505 505
   }
506 506
   if ($strings) {
507
-    return boinctranslate_export_po_generate($language, $strings, NULL, $type);
507
+    return boinctranslate_export_po_generate($language, $strings, null, $type);
508 508
   }
509 509
 
510
-  return NULL;
510
+  return null;
511 511
 }
512 512
 
513 513
 /**
514 514
  *
515 515
  */
516
-function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) {
516
+function boinctranslate_export_po_generate($language = null, $strings = array(), $header = null, $type = null) {
517 517
 
518 518
   require_once(getcwd() . '/includes/locale.inc');
519 519
   global $user;
520 520
 
521 521
   // unset $language to indicate template creation
522 522
   if (isset($language) && $language->language == "en") {
523
-    $language = NULL;
523
+    $language = null;
524 524
   }
525 525
 
526 526
   if (!isset($header)) {
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     'boinc_translate_transifex_boinc_drupal_resource', ''
627 627
   );
628 628
   $boinc_resources[] = $drupal_resource;
629
-  if ($boinc_name AND $boinc_resources) {
629
+  if ($boinc_name and $boinc_resources) {
630 630
     $translation_resources[$boinc_name] = array(
631 631
       'resources' => $boinc_resources,
632 632
       'textgroups' => array(
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
   $project_resources = boinctranslate_parse_resources(
644 644
     variable_get('boinc_translate_transifex_project_resources', array())
645 645
   );
646
-  if ($project_name AND $project_resources) {
646
+  if ($project_name and $project_resources) {
647 647
     $translation_resources[$project_name] = array(
648 648
       'resources' => $project_resources,
649 649
       'textgroups' => array(
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
               $tl0 = trim($line[0]);
677 677
               $tl1 = trim($line[1]);
678 678
               if ($tl0 and $tl1) {
679
-                bts($tl0, array(), NULL, $tl1);
679
+                bts($tl0, array(), null, $tl1);
680 680
               }
681 681
             }
682 682
           }// if ($line)
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
         $operations[] = array(
716 716
           'boinctranslate_refresh_translations_op',
717 717
           array(
718
-            NULL, $op[1][0], $langcode, $language, array('default'), $debug_mode
718
+            null, $op[1][0], $langcode, $language, array('default'), $debug_mode
719 719
           ),
720 720
         );
721 721
       }
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 
755 755
   if ($project) {
756 756
     // Import the configured resources
757
-    $success = FALSE;
757
+    $success = false;
758 758
     $message = '';
759 759
     $path = "project/{$project}/resource/{$resource}/translation/{$langcode}";
760 760
     $response = boinctranslate_transifex_request($path);
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 
769 769
         // Write the translation file to a temporary location
770 770
         $file = new stdClass();
771
-        $file->filepath = file_save_data($po_text, NULL);
771
+        $file->filepath = file_save_data($po_text, null);
772 772
         $file->filename = basename($file->filepath);
773 773
         if (!$file->filepath) {
774 774
           $message = 'Unable to create temporary file in '
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
         foreach ($textgroups as $textgroup) {
780 780
           // Import the translations from the file to each related textgroup
781 781
           if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
782
-            $message = "The {$language} translation import of"
782
+            $message = "the {$language} translation import of"
783 783
               . " {$project}:{$resource} failed.";
784
-            $success = FALSE;
784
+            $success = false;
785 785
             break;
786 786
           }
787 787
           else {
788
-            $success = TRUE;
788
+            $success = true;
789 789
           }
790 790
         }
791 791
       }
@@ -806,19 +806,19 @@  discard block
 block discarded – undo
806 806
     $file->filepath = $resource;
807 807
     $file->filename = basename($file->filepath);
808 808
     if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
809
-      $message = "The {$language} translation import of"
809
+      $message = "the {$language} translation import of"
810 810
         . " local file {$resource} failed.";
811
-      $success = FALSE;
811
+      $success = false;
812 812
     }
813 813
     else {
814
-      $success = TRUE;
814
+      $success = true;
815 815
     }
816 816
   }
817 817
 
818 818
   if ($success) {
819 819
     // Store some result for post-processing in the finished callback.
820 820
     $context['results']['success'][] = "{$langcode}:{$textgroup}";
821
-    $message = "Imported {$language} translations in {$project}:{$resource} ({$results['new']} added, {$results['updated']} refreshed, {$results['deleted']} removed)";
821
+    $message = "imported {$language} translations in {$project}:{$resource} ({$results['new']} added, {$results['updated']} refreshed, {$results['deleted']} removed)";
822 822
 
823 823
     if ($debug_mode) {
824 824
       watchdog(
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
     // An error occurred.
873 873
     // $operations contains the operations that remained unprocessed.
874 874
     $error_operation = reset($operations);
875
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
875
+    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true);
876 876
     watchdog(
877 877
       'boinctranslate',
878 878
       $message,
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 /**
888 888
  *
889 889
  */
890
-function _boinctranslate_locale_import_po($file, $langcode, $mode, $group = NULL) {
890
+function _boinctranslate_locale_import_po($file, $langcode, $mode, $group = null) {
891 891
   // Try to allocate enough time to parse and import the data.
892 892
   if (function_exists('set_time_limit')) {
893 893
     @set_time_limit(240);
@@ -898,14 +898,14 @@  discard block
 block discarded – undo
898 898
   // Check if we have the language already in the database.
899 899
   if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) {
900 900
     drupal_set_message(t('The language selected for import is not supported.'), 'error');
901
-    return FALSE;
901
+    return false;
902 902
   }
903 903
 
904 904
   // Get strings from file (returns on failure after a partial import, or on success)
905 905
   $status = _boinctranslate_locale_import_read_po('db-store', $file, $mode, $langcode, $group);
906
-  if ($status === FALSE) {
906
+  if ($status === false) {
907 907
     // Error messages are set in _locale_import_read_po().
908
-    return FALSE;
908
+    return false;
909 909
   }
910 910
 
911 911
   // Get status information on import process.
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 
918 918
   // Clear cache and force refresh of JavaScript translations.
919 919
   _locale_invalidate_js($langcode);
920
-  cache_clear_all('locale:', 'cache', TRUE);
920
+  cache_clear_all('locale:', 'cache', true);
921 921
 
922 922
   // Rebuild the menu, strings may have changed.
923 923
   menu_rebuild();
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 /**
934 934
  *
935 935
  */
936
-function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') {
936
+function _boinctranslate_locale_import_read_po($op, $file, $mode = null, $lang = null, $group = 'default') {
937 937
 
938 938
   require_once(getcwd() . '/includes/locale.inc');
939 939
 
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
       WATCHDOG_WARNING
947 947
     );
948 948
     _locale_import_message('The translation import failed, because the file %filename could not be read.', $file);
949
-    return FALSE;
949
+    return false;
950 950
   }
951 951
 
952 952
   $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
           WATCHDOG_WARNING
982 982
         );
983 983
         _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno);
984
-        return FALSE;
984
+        return false;
985 985
       }
986 986
     }
987 987
     elseif (!strncmp("msgctxt", $line, 7)) {
@@ -997,11 +997,11 @@  discard block
 block discarded – undo
997 997
           WATCHDOG_WARNING
998 998
         );
999 999
         _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno);
1000
-        return FALSE;
1000
+        return false;
1001 1001
       }
1002 1002
       $line = trim(substr($line, 7));
1003 1003
       $quoted = _locale_import_parse_quoted($line);
1004
-      if ($quoted === FALSE) {
1004
+      if ($quoted === false) {
1005 1005
         watchdog(
1006 1006
           'boinctranslate',
1007 1007
           'The translation file %filename for language %lang contains a syntax error on line %line.',
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
           WATCHDOG_WARNING
1010 1010
         );
1011 1011
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1012
-        return FALSE;
1012
+        return false;
1013 1013
       }
1014 1014
       $current["msgctxt"] = $quoted;
1015 1015
       $context = "MSGCTXT";
@@ -1023,11 +1023,11 @@  discard block
 block discarded – undo
1023 1023
           WATCHDOG_WARNING
1024 1024
         );
1025 1025
         _locale_import_message('The translation file %filename contains an error: "msgid_plural" was expected but not found on line %line.', $file, $lineno);
1026
-        return FALSE;
1026
+        return false;
1027 1027
       }
1028 1028
       $line = trim(substr($line, 12));
1029 1029
       $quoted = _locale_import_parse_quoted($line);
1030
-      if ($quoted === FALSE) {
1030
+      if ($quoted === false) {
1031 1031
         watchdog(
1032 1032
           'boinctranslate',
1033 1033
           'The translation file %filename for language %lang contains a syntax error on line %line.',
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
           WATCHDOG_WARNING
1036 1036
         );
1037 1037
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1038
-        return FALSE;
1038
+        return false;
1039 1039
       }
1040 1040
       $current["msgid"] = $current["msgid"] . "\0" . $quoted;
1041 1041
       $context = "MSGID_PLURAL";
@@ -1053,11 +1053,11 @@  discard block
 block discarded – undo
1053 1053
           WATCHDOG_WARNING
1054 1054
         );
1055 1055
         _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno);
1056
-        return FALSE;
1056
+        return false;
1057 1057
       }
1058 1058
       $line = trim(substr($line, 5));
1059 1059
       $quoted = _locale_import_parse_quoted($line);
1060
-      if ($quoted === FALSE) {
1060
+      if ($quoted === false) {
1061 1061
         watchdog(
1062 1062
           'boinctranslate',
1063 1063
           'The translation file %filename for language %lang contains a syntax error on line %line.',
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
           WATCHDOG_WARNING
1066 1066
         );
1067 1067
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1068
-        return FALSE;
1068
+        return false;
1069 1069
       }
1070 1070
       $current["msgid"] = $quoted;
1071 1071
       $context = "MSGID";
@@ -1079,9 +1079,9 @@  discard block
 block discarded – undo
1079 1079
           WATCHDOG_WARNING
1080 1080
         );
1081 1081
         _locale_import_message('The translation file %filename contains an error: "msgstr[]" is unexpected on line %line.', $file, $lineno);
1082
-        return FALSE;
1082
+        return false;
1083 1083
       }
1084
-      if (strpos($line, "]") === FALSE) {
1084
+      if (strpos($line, "]") === false) {
1085 1085
         watchdog(
1086 1086
           'boinctranslate',
1087 1087
           'The translation file %filename for language %lang contains a syntax error on line %line.',
@@ -1089,13 +1089,13 @@  discard block
 block discarded – undo
1089 1089
           WATCHDOG_WARNING
1090 1090
         );
1091 1091
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1092
-        return FALSE;
1092
+        return false;
1093 1093
       }
1094 1094
       $frombracket = strstr($line, "[");
1095 1095
       $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1);
1096 1096
       $line = trim(strstr($line, " "));
1097 1097
       $quoted = _locale_import_parse_quoted($line);
1098
-      if ($quoted === FALSE) {
1098
+      if ($quoted === false) {
1099 1099
         watchdog(
1100 1100
           'boinctranslate',
1101 1101
           'The translation file %filename for language %lang contains a syntax error on line %line.',
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
           WATCHDOG_WARNING
1104 1104
         );
1105 1105
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1106
-        return FALSE;
1106
+        return false;
1107 1107
       }
1108 1108
       $current["msgstr"][$plural] = $quoted;
1109 1109
       $context = "MSGSTR_ARR";
@@ -1117,11 +1117,11 @@  discard block
 block discarded – undo
1117 1117
           WATCHDOG_WARNING
1118 1118
         );
1119 1119
         _locale_import_message('The translation file %filename contains an error: "msgstr" is unexpected on line %line.', $file, $lineno);
1120
-        return FALSE;
1120
+        return false;
1121 1121
       }
1122 1122
       $line = trim(substr($line, 6));
1123 1123
       $quoted = _locale_import_parse_quoted($line);
1124
-      if ($quoted === FALSE) {
1124
+      if ($quoted === false) {
1125 1125
         watchdog(
1126 1126
           'boinctranslate',
1127 1127
           'The translation file %filename for language %lang contains a syntax error on line %line.',
@@ -1129,14 +1129,14 @@  discard block
 block discarded – undo
1129 1129
           WATCHDOG_WARNING
1130 1130
         );
1131 1131
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1132
-        return FALSE;
1132
+        return false;
1133 1133
       }
1134 1134
       $current["msgstr"] = $quoted;
1135 1135
       $context = "MSGSTR";
1136 1136
     }
1137 1137
     elseif ($line != "") {
1138 1138
       $quoted = _locale_import_parse_quoted($line);
1139
-      if ($quoted === FALSE) {
1139
+      if ($quoted === false) {
1140 1140
         watchdog(
1141 1141
           'boinctranslate',
1142 1142
           'The translation file %filename for language %lang contains a syntax error on line %line.',
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
           WATCHDOG_WARNING
1145 1145
         );
1146 1146
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1147
-        return FALSE;
1147
+        return false;
1148 1148
       }
1149 1149
       if (($context == "MSGID") || ($context == "MSGID_PLURAL")) {
1150 1150
         $current["msgid"] .= $quoted;
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
           WATCHDOG_WARNING
1164 1164
         );
1165 1165
         _locale_import_message('The translation file %filename contains an error: there is an unexpected string on line %line.', $file, $lineno);
1166
-        return FALSE;
1166
+        return false;
1167 1167
       }
1168 1168
     }
1169 1169
   }
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
       WATCHDOG_WARNING
1181 1181
     );
1182 1182
     _locale_import_message('The translation file %filename ended unexpectedly at line %line.', $file, $lineno);
1183
-    return FALSE;
1183
+    return false;
1184 1184
   }
1185 1185
 
1186 1186
 }
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 /**
1189 1189
  *
1190 1190
  */
1191
-function _boinctranslate_locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') {
1191
+function _boinctranslate_locale_import_one_string($op, $value = null, $mode = null, $lang = null, $file = null, $group = 'default') {
1192 1192
 
1193 1193
   require_once(getcwd() . '/includes/locale.inc');
1194 1194
 
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
     'deletes' => 0,
1199 1199
     'skips' => 0,
1200 1200
   );
1201
-  static $headerdone = FALSE;
1201
+  static $headerdone = false;
1202 1202
   static $strings = array();
1203 1203
 
1204 1204
   switch ($op) {
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
             db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang);
1239 1239
           }
1240 1240
         }
1241
-        $headerdone = TRUE;
1241
+        $headerdone = true;
1242 1242
       }
1243 1243
 
1244 1244
       else {
@@ -1284,9 +1284,9 @@  discard block
 block discarded – undo
1284 1284
  * Textgroups 'boinc' and 'project' use the location string to
1285 1285
  * uniquely identify rows in the locales_source database.
1286 1286
  */
1287
-function _boinctranslate_locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = NULL, $plural = NULL) {
1287
+function _boinctranslate_locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = null, $plural = null) {
1288 1288
 
1289
-  $ignoreoverwrite = FALSE;
1289
+  $ignoreoverwrite = false;
1290 1290
   $lid = 0;
1291 1291
 
1292 1292
   // Use different DB query depending on the textgroup.
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
     $parts = explode(':', $location);
1305 1305
     if (!empty($parts[2])) {
1306 1306
       if (preg_match('/(ignoreoverwrite)/', $parts[2])) {
1307
-        $ignoreoverwrite = TRUE;
1307
+        $ignoreoverwrite = true;
1308 1308
       }
1309 1309
     }
1310 1310
   }// if (in_array($textgroup, $uselocation))
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
       }// while
1342 1342
     }
1343 1343
   }
1344
-  elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) {
1344
+  elseif ($mode == LOCALE_IMPORT_OVERWRITE and $resource) {
1345 1345
     // Loop over db results from locales_source table.
1346 1346
     while ($row = db_fetch_array($resource)) {
1347 1347
       $lid = $row['lid'];
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
   );
1373 1373
   foreach ($resource_array as $resource) {
1374 1374
     $resource = trim($resource);
1375
-    if ($resource AND $resource[0] != '#') {
1375
+    if ($resource and $resource[0] != '#') {
1376 1376
       $resources[] = $resource;
1377 1377
     }
1378 1378
   }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function boinctranslate_initialize_languages() {
17 17
 
18
-  require_once(getcwd() . '/includes/locale.inc');
18
+  require_once(getcwd().'/includes/locale.inc');
19 19
 
20 20
   $api_base_url = 'https://www.transifex.com/api/2';
21 21
   $project_name = variable_get(
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
           }
147 147
         }
148 148
         if ($disabled_languages) {
149
-          drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages));
149
+          drupal_set_message('The following languages were not found in Transifex and were disabled: '.implode(' ', $disabled_languages));
150 150
         }
151 151
         if ($process_batches) {
152 152
           $batch = array(
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
  *
196 196
  */
197 197
 function boinctranslate_export_translations() {
198
-  require_once(getcwd() . '/includes/locale.inc');
198
+  require_once(getcwd().'/includes/locale.inc');
199 199
   $project_name = variable_get(
200 200
     'boinc_translate_transifex_project_name', ''
201 201
   );
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
  *
298 298
  */
299 299
 function boinctranslate_update_official_boinc_translations() {
300
-  require_once(getcwd() . '/includes/locale.inc');
300
+  require_once(getcwd().'/includes/locale.inc');
301 301
   $project_name = variable_get(
302 302
     'boinc_translate_transifex_standard_name', ''
303 303
   );
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 
406 406
   $url = "{$api_base_url}/{$path}";
407 407
   $headers = array(
408
-    'Authorization' => 'Basic ' . base64_encode($username . ":" . $password),
408
+    'Authorization' => 'Basic '.base64_encode($username.":".$password),
409 409
   );
410 410
   $data = NULL;
411 411
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
       return json_decode($response->data, TRUE);
434 434
     }
435 435
     else {
436
-      return (string) $response->data;
436
+      return (string)$response->data;
437 437
     }
438 438
     break;
439 439
   case 404:
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
  */
457 457
 function boinctranslate_get_po($langcode, $type = 'standard') {
458 458
 
459
-  require_once(getcwd() . '/includes/locale.inc');
459
+  require_once(getcwd().'/includes/locale.inc');
460 460
 
461 461
   $all_languages = language_list();
462 462
   $language = $langcode ? $all_languages[$langcode] : NULL;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
  */
516 516
 function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) {
517 517
 
518
-  require_once(getcwd() . '/includes/locale.inc');
518
+  require_once(getcwd().'/includes/locale.inc');
519 519
   global $user;
520 520
 
521 521
   // unset $language to indicate template creation
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
       $header = "# BOINC drupal localization template\n";
532 532
       $header .= "# Copyright (C) ".date("Y")." University of California\n";
533 533
     }
534
-    $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n";
534
+    $header .= '# Generated by '.$user->name.' <'.$user->mail.">\n";
535 535
     $header .= "#\n";
536 536
     $header .= "# This file is distributed under the same license as BOINC.\n";
537 537
     $header .= "#\n";
@@ -543,9 +543,9 @@  discard block
 block discarded – undo
543 543
       $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here
544 544
     }
545 545
     $header .= "\"Report-Msgid-Bugs-To: BOINC translation team <[email protected]>\\n\"\n";
546
-    $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
546
+    $header .= "\"POT-Creation-Date: ".date("Y-m-d H:iO")."\\n\"\n";
547 547
     if (isset($language)) {
548
-      $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
548
+      $header .= "\"PO-Revision-Date: ".date("Y-m-d H:iO")."\\n\"\n";
549 549
     }
550 550
     $header .= "\"Last-Translator: Generated automatically from Drupal translate interface\\n\"\n";
551 551
     $header .= "\"MIME-Version: 1.0\\n\"\n";
@@ -554,31 +554,31 @@  discard block
 block discarded – undo
554 554
     if (isset($language)) {
555 555
       $header .= "\"Language: ".$language->language."\\n\"";
556 556
       if ($language->formula && $language->plurals) {
557
-        $header .= "\"Plural-Forms: nplurals=" . $language->plurals . "; plural=" . strtr($language->formula, array('$' => '')) . ";\\n\"\n";
557
+        $header .= "\"Plural-Forms: nplurals=".$language->plurals."; plural=".strtr($language->formula, array('$' => '')).";\\n\"\n";
558 558
       }
559 559
     }
560 560
     $header .= "\"X-Poedit-SourceCharset: utf-8\\n\"\n";
561 561
   }
562 562
 
563
-  $output = $header . "\n";
563
+  $output = $header."\n";
564 564
 
565 565
   foreach ($strings as $lid => $string) {
566 566
     // Only process non-children, children are output below their parent.
567 567
     if (!isset($string['child'])) {
568 568
       if ($string['comment']) {
569
-        $output .= '#: ' . $string['comment'] . "\n";
569
+        $output .= '#: '.$string['comment']."\n";
570 570
       }
571 571
       if ($string['context']) {
572
-        $output .= 'msgctxt "' . $string['context'] . "\"\n";
572
+        $output .= 'msgctxt "'.$string['context']."\"\n";
573 573
       }
574
-      $output .= 'msgid ' . _locale_export_string($string['source']);
574
+      $output .= 'msgid '._locale_export_string($string['source']);
575 575
       if (!empty($string['plural'])) {
576 576
         $plural = $string['plural'];
577
-        $output .= 'msgid_plural ' . _locale_export_string($strings[$plural]['source']);
577
+        $output .= 'msgid_plural '._locale_export_string($strings[$plural]['source']);
578 578
         if (isset($language)) {
579 579
           $translation = $string['translation'];
580 580
           for ($i = 0; $i < $language->plurals; $i++) {
581
-            $output .= 'msgstr[' . $i . '] ' . _locale_export_string($translation);
581
+            $output .= 'msgstr['.$i.'] '._locale_export_string($translation);
582 582
             if ($plural) {
583 583
               $translation = _locale_export_remove_plural($strings[$plural]['translation']);
584 584
               $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0;
@@ -589,12 +589,12 @@  discard block
 block discarded – undo
589 589
           }
590 590
         }
591 591
         else {
592
-          $output .= 'msgstr[0] ""' . "\n";
593
-          $output .= 'msgstr[1] ""' . "\n";
592
+          $output .= 'msgstr[0] ""'."\n";
593
+          $output .= 'msgstr[1] ""'."\n";
594 594
         }
595 595
       }
596 596
       else {
597
-        $output .= 'msgstr ' . _locale_export_string($string['translation']);
597
+        $output .= 'msgstr '._locale_export_string($string['translation']);
598 598
       }
599 599
       $output .= "\n";
600 600
     }
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
  *
607 607
  */
608 608
 function boinctranslate_refresh_translations() {
609
-  require_once(getcwd() . '/includes/locale.inc');
609
+  require_once(getcwd().'/includes/locale.inc');
610 610
   $errors = array();
611 611
   $languages = locale_language_list();
612 612
   $translation_resources = array();
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
       ),
654 654
     );
655 655
     // Be sure any strings from the override file are added to the boinc group
656
-    $override_file = './' . drupal_get_path('module', 'boinctranslate') . '/includes/other-boinc-translation-strings.txt';
656
+    $override_file = './'.drupal_get_path('module', 'boinctranslate').'/includes/other-boinc-translation-strings.txt';
657 657
     $other_strings = file($override_file);
658 658
     if ($other_strings) {
659 659
       foreach ($other_strings as $string) {
@@ -666,13 +666,13 @@  discard block
 block discarded – undo
666 666
           // Use '|' as delimiter to split string and context info.
667 667
           $line = explode("|", $string);
668 668
           if ($line) {
669
-            if (count($line)==1) {
669
+            if (count($line) == 1) {
670 670
               $tl0 = trim($line[0]);
671 671
               if ($tl0) {
672 672
                 bts($tl0);
673 673
               }
674 674
             }
675
-            elseif (count($line)>1) {
675
+            elseif (count($line) > 1) {
676 676
               $tl0 = trim($line[0]);
677 677
               $tl1 = trim($line[1]);
678 678
               if ($tl0 and $tl1) {
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
  */
742 742
 function boinctranslate_refresh_translations_op($project, $resource, $langcode, $language, $textgroups, $debug_mode, &$context) {
743 743
 
744
-  require_once(getcwd() . '/includes/locale.inc');
744
+  require_once(getcwd().'/includes/locale.inc');
745 745
 
746 746
   if ($debug_mode) {
747 747
     watchdog(
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
         $file->filename = basename($file->filepath);
773 773
         if (!$file->filepath) {
774 774
           $message = 'Unable to create temporary file in '
775
-            . file_directory_temp() . " for {$language} translation "
775
+            . file_directory_temp()." for {$language} translation "
776 776
             . "resource {$project}:{$resource}";
777 777
         }
778 778
 
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
     $context['finished'] = 1;
850 850
   }
851 851
   else {
852
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
852
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
853 853
   }
854 854
 }
855 855
 
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
     // An error occurred.
873 873
     // $operations contains the operations that remained unprocessed.
874 874
     $error_operation = reset($operations);
875
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
875
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
876 876
     watchdog(
877 877
       'boinctranslate',
878 878
       $message,
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
     @set_time_limit(240);
894 894
   }
895 895
 
896
-  require_once(getcwd() . '/includes/locale.inc');
896
+  require_once(getcwd().'/includes/locale.inc');
897 897
 
898 898
   // Check if we have the language already in the database.
899 899
   if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') {
937 937
 
938
-  require_once(getcwd() . '/includes/locale.inc');
938
+  require_once(getcwd().'/includes/locale.inc');
939 939
 
940 940
   $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return
941 941
   if (!$fd) {
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
   $lineno = 0; // Current line
956 956
 
957 957
   while (!feof($fd)) {
958
-    $line = fgets($fd, 10 * 1024); // A line should not be this long
958
+    $line = fgets($fd, 10*1024); // A line should not be this long
959 959
     if ($lineno == 0) {
960 960
       // The first line might come with a UTF-8 BOM, which should be removed.
961 961
       $line = str_replace("\xEF\xBB\xBF", '', $line);
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1038 1038
         return FALSE;
1039 1039
       }
1040
-      $current["msgid"] = $current["msgid"] . "\0" . $quoted;
1040
+      $current["msgid"] = $current["msgid"]."\0".$quoted;
1041 1041
       $context = "MSGID_PLURAL";
1042 1042
     }
1043 1043
     elseif (!strncmp("msgid", $line, 5)) {
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
  */
1191 1191
 function _boinctranslate_locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') {
1192 1192
 
1193
-  require_once(getcwd() . '/includes/locale.inc');
1193
+  require_once(getcwd().'/includes/locale.inc');
1194 1194
 
1195 1195
   static $report = array(
1196 1196
     'additions' => 0,
@@ -1323,13 +1323,13 @@  discard block
 block discarded – undo
1323 1323
 
1324 1324
         $lid = $row['lid'];
1325 1325
         // Check of if one or more translations exist for this lid in locales_target table.
1326
-        $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1326
+        $exists = (bool)db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1327 1327
         if (!$exists) {
1328 1328
           // No translation in this language, insert translation into locales_target table.
1329 1329
           db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural);
1330 1330
           $report['additions']++;
1331 1331
         }
1332
-        else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) {
1332
+        else if (($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite)) {
1333 1333
           // Translation exists, only overwrite if instructed.
1334 1334
           db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid);
1335 1335
           $report['updates']++;
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
     // Loop over db results from locales_source table.
1346 1346
     while ($row = db_fetch_array($resource)) {
1347 1347
       $lid = $row['lid'];
1348
-      $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1348
+      $exists = (bool)db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1349 1349
       if ($exists) {
1350 1350
         // Empty translation, remove existing if instructed.
1351 1351
         db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $langcode, $lid, $plid, $plural);
@@ -1403,5 +1403,5 @@  discard block
 block discarded – undo
1403 1403
  * database.
1404 1404
  */
1405 1405
 function _boinctranslate_supertrim($instr) {
1406
-  return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) );
1406
+  return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr)));
1407 1407
 }
Please login to merge, or discard this patch.
Indentation   +642 added lines, -642 removed lines patch added patch discarded remove patch
@@ -15,30 +15,30 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function boinctranslate_initialize_languages() {
17 17
 
18
-  require_once(getcwd() . '/includes/locale.inc');
18
+    require_once(getcwd() . '/includes/locale.inc');
19 19
 
20
-  $api_base_url = 'https://www.transifex.com/api/2';
21
-  $project_name = variable_get(
20
+    $api_base_url = 'https://www.transifex.com/api/2';
21
+    $project_name = variable_get(
22 22
     'boinc_translate_transifex_project_name', ''
23
-  );
24
-  $operations = array();
23
+    );
24
+    $operations = array();
25 25
 
26
-  if ($project_name) {
26
+    if ($project_name) {
27 27
     // Get all languages configured for this project at Transifex
28 28
     $path = "project/{$project_name}/languages";
29 29
     $response = boinctranslate_transifex_request($path);
30 30
 
31 31
     if ($response == '404 NOT FOUND') {
32
-      drupal_set_message(
32
+        drupal_set_message(
33 33
         t('Unable to get languages for %project.',
34
-          array(
34
+            array(
35 35
             '%project' => $project_name,
36
-          )
36
+            )
37 37
         ), 'warning'
38
-      );
38
+        );
39 39
     }
40 40
     elseif ($response) {
41
-      if (is_array($response)) {
41
+        if (is_array($response)) {
42 42
 
43 43
         $installed_languages = language_list();
44 44
         $available_languages = _locale_get_predefined_list();
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 
49 49
         // Set up Transifex languages in Drupal
50 50
         foreach ($response as $language) {
51
-          $posix_code = $language['language_code'];
52
-          $rfc_code = strtolower(str_replace('_', '-', $posix_code));
53
-          $transifex_languages[$rfc_code] = $language;
54
-          if (!isset($installed_languages[$rfc_code])) {
51
+            $posix_code = $language['language_code'];
52
+            $rfc_code = strtolower(str_replace('_', '-', $posix_code));
53
+            $transifex_languages[$rfc_code] = $language;
54
+            if (!isset($installed_languages[$rfc_code])) {
55 55
             // See if this language can be installed from a predefined list
56 56
             if (isset($available_languages[$rfc_code])) {
57
-              locale_add_language(
57
+                locale_add_language(
58 58
                 $rfc_code,
59 59
                 NULL,
60 60
                 NULL,
@@ -62,30 +62,30 @@  discard block
 block discarded – undo
62 62
                 NULL,
63 63
                 NULL,
64 64
                 FALSE
65
-              );
66
-              drupal_set_message(
65
+                );
66
+                drupal_set_message(
67 67
                 'Added predefined language: '.$available_languages[$rfc_code][0]
68
-              );
69
-              db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code);
68
+                );
69
+                db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code);
70 70
             }
71 71
             else {
72
-              // Retrieve language details from Transifex
73
-              $path = "language/{$posix_code}";
74
-              $response = boinctranslate_transifex_request($path);
72
+                // Retrieve language details from Transifex
73
+                $path = "language/{$posix_code}";
74
+                $response = boinctranslate_transifex_request($path);
75 75
 
76
-              if ($response == '404 NOT FOUND') {
76
+                if ($response == '404 NOT FOUND') {
77 77
                 drupal_set_message(
78
-                  t('Unable to get details for language %code.',
78
+                    t('Unable to get details for language %code.',
79 79
                     array(
80
-                      '%code' => $posix_code,
80
+                        '%code' => $posix_code,
81 81
                     )
82
-                  ), 'warning'
82
+                    ), 'warning'
83 83
                 );
84
-              }
85
-              elseif ($response) {
84
+                }
85
+                elseif ($response) {
86 86
                 if (!empty($response['name'])) {
87
-                  // Add a custom language to Drupal and enable
88
-                  locale_add_language(
87
+                    // Add a custom language to Drupal and enable
88
+                    locale_add_language(
89 89
                     $rfc_code,
90 90
                     $response['name'],
91 91
                     $response['name'],
@@ -93,362 +93,362 @@  discard block
 block discarded – undo
93 93
                     NULL,
94 94
                     NULL,
95 95
                     TRUE
96
-                  );
97
-                  drupal_set_message(
96
+                    );
97
+                    drupal_set_message(
98 98
                     'Added new language: '.$response['name']
99
-                  );
99
+                    );
100 100
                 }
101 101
                 else {
102
-                  $variables = array(
102
+                    $variables = array(
103 103
                     '%code' => $posix_code,
104
-                  );
105
-                  drupal_set_message(
104
+                    );
105
+                    drupal_set_message(
106 106
                     t('Unable to get details for language %code.', $variables),
107 107
                     'error'
108
-                  );
109
-                  watchdog(
108
+                    );
109
+                    watchdog(
110 110
                     'boinctranslate',
111 111
                     'Unable to get details for language %code.',
112 112
                     $variables,
113 113
                     WATCHDOG_ERROR
114
-                  );
114
+                    );
115
+                }
115 116
                 }
116
-              }
117
-              else {
118
-               $variables = array(
119
-                  '%code' => $posix_code,
117
+                else {
118
+                $variables = array(
119
+                    '%code' => $posix_code,
120 120
                 );
121 121
                 drupal_set_message(
122
-                  t('Invalid response while getting details for language %code.', $variables),
123
-                  'error'
122
+                    t('Invalid response while getting details for language %code.', $variables),
123
+                    'error'
124 124
                 );
125 125
                 watchdog(
126
-                  'boinctranslate',
127
-                  'Invalid response while getting details for language %code.',
128
-                  $variables,
129
-                  WATCHDOG_ERROR
126
+                    'boinctranslate',
127
+                    'Invalid response while getting details for language %code.',
128
+                    $variables,
129
+                    WATCHDOG_ERROR
130 130
                 );
131
-              }
131
+                }
132 132
             }
133 133
             // Import any language files for the newly added language
134 134
             if ($batch = locale_batch_by_language($rfc_code, '_locale_batch_language_finished')) {
135
-              $operations = array_merge($operations, $batch['operations']);
136
-              $process_batches = TRUE;
135
+                $operations = array_merge($operations, $batch['operations']);
136
+                $process_batches = TRUE;
137
+            }
137 138
             }
138
-          }
139 139
         }
140 140
         drupal_set_message('Finished installing official BOINC languages.');
141 141
         // Disable languages that are not in Transifex
142 142
         foreach ($installed_languages as $langcode => $language) {
143
-          if (!isset($transifex_languages[$langcode])) {
143
+            if (!isset($transifex_languages[$langcode])) {
144 144
             $disabled_languages[$langcode] = $langcode;
145 145
             db_query("UPDATE {languages} SET enabled = 0 WHERE language = '%s'", $langcode);
146
-          }
146
+            }
147 147
         }
148 148
         if ($disabled_languages) {
149
-          drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages));
149
+            drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages));
150 150
         }
151 151
         if ($process_batches) {
152
-          $batch = array(
152
+            $batch = array(
153 153
             'operations' => $operations,
154
-          );
155
-          batch_set($batch);
156
-          batch_process('admin/boinc/translation');
154
+            );
155
+            batch_set($batch);
156
+            batch_process('admin/boinc/translation');
157
+        }
157 158
         }
158
-      }
159
-      else {
159
+        else {
160 160
         $variables = array(
161
-          '%project' => $project_name,
161
+            '%project' => $project_name,
162 162
         );
163 163
         drupal_set_message(
164
-          t('No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', $variables),
165
-          'error'
164
+            t('No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', $variables),
165
+            'error'
166 166
         );
167 167
         watchdog(
168
-          'boinctranslate',
169
-          'No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)',
170
-          $variables,
171
-          WATCHDOG_ERROR
168
+            'boinctranslate',
169
+            'No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)',
170
+            $variables,
171
+            WATCHDOG_ERROR
172 172
         );
173
-      }
173
+        }
174 174
     }
175 175
     else {
176
-     $variables = array(
176
+        $variables = array(
177 177
         '%project' => $project_name,
178
-      );
179
-      drupal_set_message(
178
+        );
179
+        drupal_set_message(
180 180
         t('Invalid response while getting languages for %project.', $variables),
181 181
         'error'
182
-      );
183
-      watchdog(
182
+        );
183
+        watchdog(
184 184
         'boinctranslate',
185 185
         'Invalid response while getting languages for %project.',
186 186
         $variables,
187 187
         WATCHDOG_ERROR
188
-      );
188
+        );
189 189
     }
190
-  }
191
-  drupal_goto('admin/boinc/translation');
190
+    }
191
+    drupal_goto('admin/boinc/translation');
192 192
 }
193 193
 
194 194
 /**
195 195
  *
196 196
  */
197 197
 function boinctranslate_export_translations() {
198
-  require_once(getcwd() . '/includes/locale.inc');
199
-  $project_name = variable_get(
198
+    require_once(getcwd() . '/includes/locale.inc');
199
+    $project_name = variable_get(
200 200
     'boinc_translate_transifex_project_name', ''
201
-  );
202
-  // Get resource names from local config
203
-  $resource_config = (variable_get(
201
+    );
202
+    // Get resource names from local config
203
+    $resource_config = (variable_get(
204 204
     'boinc_translate_transifex_project_resources', ''
205
-  ));
206
-  $resource_names = boinctranslate_parse_resources($resource_config);
207
-  $primary_resource = reset($resource_names);
205
+    ));
206
+    $resource_names = boinctranslate_parse_resources($resource_config);
207
+    $primary_resource = reset($resource_names);
208 208
 
209
-  if ($project_name AND $primary_resource) {
209
+    if ($project_name AND $primary_resource) {
210 210
     // Create or update the translation source, if needed
211 211
     $source_exists = FALSE;
212 212
     $path = "project/{$project_name}/resources";
213 213
     $resources = boinctranslate_transifex_request($path);
214 214
     if ($resources AND is_array($resources)) {
215
-      foreach ($resources as $resource) {
215
+        foreach ($resources as $resource) {
216 216
         if ($resource['slug'] == $primary_resource) {
217
-          $source_exists = TRUE;
218
-          break;
217
+            $source_exists = TRUE;
218
+            break;
219 219
         }
220
-      }
221
-      if (!$source_exists) {
220
+        }
221
+        if (!$source_exists) {
222 222
         // Create the source
223 223
         $path = "project/{$project_name}/resources";
224 224
         $post = array(
225
-          'slug' => $primary_resource,
226
-          'name' => 'Drupal-Project',
227
-          'i18n_type' => 'PO',
228
-          'category' => 'Drupal',
229
-          'content' => boinctranslate_get_po('en', 'project'),
225
+            'slug' => $primary_resource,
226
+            'name' => 'Drupal-Project',
227
+            'i18n_type' => 'PO',
228
+            'category' => 'Drupal',
229
+            'content' => boinctranslate_get_po('en', 'project'),
230 230
         );
231 231
         $result = boinctranslate_transifex_request($path, $post);
232
-      }
233
-      else {
232
+        }
233
+        else {
234 234
         // Update the source
235 235
         $path = "project/{$project_name}/resource/{$primary_resource}/content";
236 236
         $post = array(
237
-          'content' => boinctranslate_get_po('en', 'project')
237
+            'content' => boinctranslate_get_po('en', 'project')
238 238
         );
239 239
         $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
240
-      }
240
+        }
241 241
     }
242 242
 
243 243
     if (is_array($result) OR substr($result, 0, 6) != 'ERROR:') {
244
-      $enabled_languages = locale_language_list();
245
-      if ($source_exists) {
244
+        $enabled_languages = locale_language_list();
245
+        if ($source_exists) {
246 246
         drupal_set_message('Updated source translation strings at Transifex');
247
-      }
248
-      else {
247
+        }
248
+        else {
249 249
         drupal_set_message('Established new translation resource at Transifex');
250
-      }
251
-      // Try to export translations for all enabled languages
252
-      foreach ($enabled_languages as $langcode => $language_name) {
250
+        }
251
+        // Try to export translations for all enabled languages
252
+        foreach ($enabled_languages as $langcode => $language_name) {
253 253
         if ($langcode == 'en') {
254
-          continue;
254
+            continue;
255 255
         }
256 256
         $po_file = boinctranslate_get_po($langcode, 'project');
257 257
         if ($po_file) {
258
-          $path = "project/{$project_name}/resource/{$primary_resource}/translation/{$langcode}";
259
-          $post = array(
258
+            $path = "project/{$project_name}/resource/{$primary_resource}/translation/{$langcode}";
259
+            $post = array(
260 260
             'content' => $po_file,
261
-          );
262
-          $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
263
-          if (!is_array($result)
261
+            );
262
+            $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
263
+            if (!is_array($result)
264 264
           AND substr($result, 0, 6) == 'ERROR:') {
265 265
             drupal_set_message(
266
-              "Unable to update {$language_name} translations: {$result}",
267
-              'warning'
266
+                "Unable to update {$language_name} translations: {$result}",
267
+                'warning'
268 268
             );
269
-          }
270
-          else {
269
+            }
270
+            else {
271 271
             drupal_set_message("Updated {$language_name} translations");
272 272
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
273
-          }
273
+            }
274 274
         }
275 275
         else {
276
-          drupal_set_message("No translations to export for {$language_name}");
276
+            drupal_set_message("No translations to export for {$language_name}");
277
+        }
277 278
         }
278
-      }
279 279
     }
280 280
     else {
281
-      drupal_set_message(
281
+        drupal_set_message(
282 282
         "Unable to update the translation source: {$result}",
283 283
         'warning'
284
-      );
284
+        );
285 285
     }
286
-  }
287
-  else {
286
+    }
287
+    else {
288 288
     drupal_set_message(
289
-      'Failed to export translations: Transifex settings are not intiailized.',
290
-      'error'
289
+        'Failed to export translations: Transifex settings are not intiailized.',
290
+        'error'
291 291
     );
292
-  }
293
-  drupal_goto('admin/boinc/translation');
292
+    }
293
+    drupal_goto('admin/boinc/translation');
294 294
 }
295 295
 
296 296
 /**
297 297
  *
298 298
  */
299 299
 function boinctranslate_update_official_boinc_translations() {
300
-  require_once(getcwd() . '/includes/locale.inc');
301
-  $project_name = variable_get(
300
+    require_once(getcwd() . '/includes/locale.inc');
301
+    $project_name = variable_get(
302 302
     'boinc_translate_transifex_standard_name', ''
303
-  );
304
-  $drupal_resource = variable_get(
303
+    );
304
+    $drupal_resource = variable_get(
305 305
     'boinc_translate_transifex_boinc_drupal_resource', ''
306
-  );
306
+    );
307 307
 
308
-  if ($project_name AND $drupal_resource) {
308
+    if ($project_name AND $drupal_resource) {
309 309
     // Create or update the translation source, if needed
310 310
     $source_exists = FALSE;
311 311
     $path = "project/{$project_name}/resources";
312 312
     $resources = boinctranslate_transifex_request($path);
313 313
     if ($resources AND is_array($resources)) {
314
-      foreach ($resources as $resource) {
314
+        foreach ($resources as $resource) {
315 315
         if ($resource['slug'] == $drupal_resource) {
316
-          $source_exists = TRUE;
317
-          break;
316
+            $source_exists = TRUE;
317
+            break;
318
+        }
318 319
         }
319
-      }
320 320
     }
321 321
 
322 322
     if ($source_exists) {
323
-      $enabled_languages = locale_language_list();
324
-      // Try to export translations for all enabled languages
325
-      foreach ($enabled_languages as $langcode => $language_name) {
323
+        $enabled_languages = locale_language_list();
324
+        // Try to export translations for all enabled languages
325
+        foreach ($enabled_languages as $langcode => $language_name) {
326 326
         if ($langcode == 'en') {
327
-          continue;
327
+            continue;
328 328
         }
329 329
         $po_file = boinctranslate_get_po($langcode, 'boinc');
330 330
         if ($po_file) {
331
-          $path = "project/{$project_name}/resource/{$drupal_resource}/translation/{$langcode}";
332
-          $post = array(
331
+            $path = "project/{$project_name}/resource/{$drupal_resource}/translation/{$langcode}";
332
+            $post = array(
333 333
             'content' => $po_file,
334
-          );
335
-          $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
334
+            );
335
+            $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
336 336
 
337
-          if (!is_array($result)) {
337
+            if (!is_array($result)) {
338 338
             if (substr($result, 0, 6) == 'ERROR:') {
339
-              drupal_set_message(
339
+                drupal_set_message(
340 340
                 "Unable to update {$language_name} official BOINC translations: {$result}",
341 341
                 'warning'
342
-              );
342
+                );
343 343
             }
344 344
             elseif ($result == '401 UNAUTHORIZED') {
345
-              drupal_set_message(
345
+                drupal_set_message(
346 346
                 'Not authorized to update official BOINC translations',
347 347
                 'warning'
348
-              );
349
-              break;
348
+                );
349
+                break;
350 350
             }
351 351
             elseif ($result == 'success') {
352
-              drupal_set_message("Updated {$language_name} official BOINC translations");
352
+                drupal_set_message("Updated {$language_name} official BOINC translations");
353 353
             }
354 354
             else {
355
-              drupal_set_message(
355
+                drupal_set_message(
356 356
                 "Unexpected response for {$language_name}: {$result}",
357 357
                 'warning'
358
-              );
358
+                );
359 359
             }
360
-          }
361
-          else {
360
+            }
361
+            else {
362 362
             drupal_set_message("Updated {$language_name} official BOINC translations");
363 363
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
364
-          }
364
+            }
365 365
         }
366 366
         else {
367
-          drupal_set_message("No official BOINC translations to export for {$language_name}");
367
+            drupal_set_message("No official BOINC translations to export for {$language_name}");
368
+        }
368 369
         }
369
-      }
370 370
     }
371 371
     else {
372
-      drupal_set_message(
372
+        drupal_set_message(
373 373
         "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex",
374 374
         'warning'
375
-      );
375
+        );
376 376
     }
377
-  }
378
-  else {
377
+    }
378
+    else {
379 379
     drupal_set_message(
380
-      'Failed to export official BOINC translations: Transifex settings are not intiailized.',
381
-      'error'
380
+        'Failed to export official BOINC translations: Transifex settings are not intiailized.',
381
+        'error'
382 382
     );
383
-  }
384
-  drupal_goto('admin/boinc/translation');
383
+    }
384
+    drupal_goto('admin/boinc/translation');
385 385
 }
386 386
 
387 387
 /**
388 388
  *
389 389
  */
390 390
 function boinctranslate_download_pot($type = 'boinc') {
391
-  $po = boinctranslate_get_po(NULL, $type);
392
-  _locale_export_po(NULL, $po);
391
+    $po = boinctranslate_get_po(NULL, $type);
392
+    _locale_export_po(NULL, $po);
393 393
 }
394 394
 
395 395
 /**
396 396
  *
397 397
  */
398 398
 function boinctranslate_transifex_request($path, $post = NULL, $json = TRUE, $use_put = FALSE, $username = '', $password = '') {
399
-  $debug_mode = variable_get('boinc_debug_mode', 0);
399
+    $debug_mode = variable_get('boinc_debug_mode', 0);
400 400
 
401
-  // Transifex details
402
-  $api_base_url = 'https://www.transifex.com/api/2';
403
-  if (!$username) $username = variable_get('boinc_translate_transifex_user', '');
404
-  if (!$password) $password = variable_get('boinc_translate_transifex_pass', '');
401
+    // Transifex details
402
+    $api_base_url = 'https://www.transifex.com/api/2';
403
+    if (!$username) $username = variable_get('boinc_translate_transifex_user', '');
404
+    if (!$password) $password = variable_get('boinc_translate_transifex_pass', '');
405 405
 
406
-  $url = "{$api_base_url}/{$path}";
407
-  $headers = array(
406
+    $url = "{$api_base_url}/{$path}";
407
+    $headers = array(
408 408
     'Authorization' => 'Basic ' . base64_encode($username . ":" . $password),
409
-  );
410
-  $data = NULL;
409
+    );
410
+    $data = NULL;
411 411
 
412
-  if ($post) {
412
+    if ($post) {
413 413
     if ($json) {
414
-      $headers['Content-Type'] = 'application/json';
415
-      $data = json_encode($post);
414
+        $headers['Content-Type'] = 'application/json';
415
+        $data = json_encode($post);
416 416
     }
417 417
     else {
418
-      $data = drupal_query_string_encode($post);
418
+        $data = drupal_query_string_encode($post);
419 419
     }
420 420
     $method = ($use_put) ? 'PUT' : 'POST';
421
-  }
422
-  else {
421
+    }
422
+    else {
423 423
     $method = 'GET';
424
-  }
424
+    }
425 425
 
426
-  $response = drupal_http_request($url, $headers, $method, $data, 1, 10);
426
+    $response = drupal_http_request($url, $headers, $method, $data, 1, 10);
427 427
 
428
-  switch ($response->code) {
429
-  case 200:
428
+    switch ($response->code) {
429
+    case 200:
430 430
   case 304:
431 431
     if ($json) {
432
-      // Process as JSON
433
-      return json_decode($response->data, TRUE);
432
+        // Process as JSON
433
+        return json_decode($response->data, TRUE);
434 434
     }
435 435
     else {
436
-      return (string) $response->data;
436
+        return (string) $response->data;
437 437
     }
438 438
     break;
439
-  case 404:
439
+    case 404:
440 440
     return '404 NOT FOUND';
441
-  case 401:
441
+    case 401:
442 442
     return '401 UNAUTHORIZED';
443
-  case 400:
443
+    case 400:
444 444
     if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING);
445 445
     return "ERROR: {$response->data}";
446
-  case 405:
446
+    case 405:
447 447
     if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING);
448 448
     return "ERROR: User not allowed to perform this action";
449
-  }
449
+    }
450 450
 
451
-  return NULL;
451
+    return NULL;
452 452
 }
453 453
 
454 454
 /**
@@ -456,58 +456,58 @@  discard block
 block discarded – undo
456 456
  */
457 457
 function boinctranslate_get_po($langcode, $type = 'standard') {
458 458
 
459
-  require_once(getcwd() . '/includes/locale.inc');
459
+    require_once(getcwd() . '/includes/locale.inc');
460 460
 
461
-  $all_languages = language_list();
462
-  $language = $langcode ? $all_languages[$langcode] : NULL;
463
-  $textgroups = array();
464
-  $strings = array();
461
+    $all_languages = language_list();
462
+    $language = $langcode ? $all_languages[$langcode] : NULL;
463
+    $textgroups = array();
464
+    $strings = array();
465 465
 
466
-  switch ($type) {
467
-  case 'standard':
466
+    switch ($type) {
467
+    case 'standard':
468 468
     $textgroups = array(
469
-      'default',
470
-      'taxonomy',
471
-      'views',
469
+        'default',
470
+        'taxonomy',
471
+        'views',
472 472
     );
473 473
     break;
474
-  case 'boinc':
474
+    case 'boinc':
475 475
     $textgroups = array(
476
-      'boinc',
476
+        'boinc',
477 477
     );
478 478
     break;
479
-  case 'project':
479
+    case 'project':
480 480
     $textgroups = array(
481
-      'blocks',
482
-      'menu',
483
-      'project',
481
+        'blocks',
482
+        'menu',
483
+        'project',
484 484
     );
485 485
     break;
486
-  default:
486
+    default:
487 487
   }
488 488
 
489
-  // Merge textgroup strings together for export as one file
490
-  foreach ($textgroups as $textgroup) {
489
+    // Merge textgroup strings together for export as one file
490
+    foreach ($textgroups as $textgroup) {
491 491
     $strings += _locale_export_get_strings($language, $textgroup);
492
-  }
493
-  ksort($strings);
494
-  foreach ($strings as $id => $string) {
492
+    }
493
+    ksort($strings);
494
+    foreach ($strings as $id => $string) {
495 495
     // Set the string context
496 496
     $strings[$id]['context'] = trim($string['comment']);
497
-  }
498
-  if ($langcode AND $langcode != 'en') {
497
+    }
498
+    if ($langcode AND $langcode != 'en') {
499 499
     // If not the source language, remove untranslated strings from the ouput
500 500
     foreach ($strings as $i => $string) {
501
-      if (!$string['translation']) {
501
+        if (!$string['translation']) {
502 502
         unset($strings[$i]);
503
-      }
503
+        }
504 504
     }
505
-  }
506
-  if ($strings) {
505
+    }
506
+    if ($strings) {
507 507
     return boinctranslate_export_po_generate($language, $strings, NULL, $type);
508
-  }
508
+    }
509 509
 
510
-  return NULL;
510
+    return NULL;
511 511
 }
512 512
 
513 513
 /**
@@ -515,21 +515,21 @@  discard block
 block discarded – undo
515 515
  */
516 516
 function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) {
517 517
 
518
-  require_once(getcwd() . '/includes/locale.inc');
519
-  global $user;
518
+    require_once(getcwd() . '/includes/locale.inc');
519
+    global $user;
520 520
 
521
-  // unset $language to indicate template creation
522
-  if (isset($language) && $language->language == "en") {
521
+    // unset $language to indicate template creation
522
+    if (isset($language) && $language->language == "en") {
523 523
     $language = NULL;
524
-  }
524
+    }
525 525
 
526
-  if (!isset($header)) {
526
+    if (!isset($header)) {
527 527
     if (isset($type) && $type == "project") {
528
-      $header = "# ".variable_get('site_name', 'Drupal-BOINC')." drupal localization template\n";
529
-      $header .= "# Copyright (C) ".date("Y")." ".variable_get('site_name', 'Drupal-BOINC')."\n";
528
+        $header = "# ".variable_get('site_name', 'Drupal-BOINC')." drupal localization template\n";
529
+        $header .= "# Copyright (C) ".date("Y")." ".variable_get('site_name', 'Drupal-BOINC')."\n";
530 530
     } else {
531
-      $header = "# BOINC drupal localization template\n";
532
-      $header .= "# Copyright (C) ".date("Y")." University of California\n";
531
+        $header = "# BOINC drupal localization template\n";
532
+        $header .= "# Copyright (C) ".date("Y")." University of California\n";
533 533
     }
534 534
     $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n";
535 535
     $header .= "#\n";
@@ -538,201 +538,201 @@  discard block
 block discarded – undo
538 538
     $header .= "msgid \"\"\n";
539 539
     $header .= "msgstr \"\"\n";
540 540
     if (isset($type) && $type == "project") {
541
-      $header .= "\"Project-Id-Version: ".variable_get('site_name', 'Drupal-BOINC')." ".date("Y-m-d-H:iO")."\\n\"\n";
541
+        $header .= "\"Project-Id-Version: ".variable_get('site_name', 'Drupal-BOINC')." ".date("Y-m-d-H:iO")."\\n\"\n";
542 542
     } else {
543
-      $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here
543
+        $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here
544 544
     }
545 545
     $header .= "\"Report-Msgid-Bugs-To: BOINC translation team <[email protected]>\\n\"\n";
546 546
     $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
547 547
     if (isset($language)) {
548
-      $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
548
+        $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
549 549
     }
550 550
     $header .= "\"Last-Translator: Generated automatically from Drupal translate interface\\n\"\n";
551 551
     $header .= "\"MIME-Version: 1.0\\n\"\n";
552 552
     $header .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
553 553
     $header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
554 554
     if (isset($language)) {
555
-      $header .= "\"Language: ".$language->language."\\n\"";
556
-      if ($language->formula && $language->plurals) {
555
+        $header .= "\"Language: ".$language->language."\\n\"";
556
+        if ($language->formula && $language->plurals) {
557 557
         $header .= "\"Plural-Forms: nplurals=" . $language->plurals . "; plural=" . strtr($language->formula, array('$' => '')) . ";\\n\"\n";
558
-      }
558
+        }
559 559
     }
560 560
     $header .= "\"X-Poedit-SourceCharset: utf-8\\n\"\n";
561
-  }
561
+    }
562 562
 
563
-  $output = $header . "\n";
563
+    $output = $header . "\n";
564 564
 
565
-  foreach ($strings as $lid => $string) {
565
+    foreach ($strings as $lid => $string) {
566 566
     // Only process non-children, children are output below their parent.
567 567
     if (!isset($string['child'])) {
568
-      if ($string['comment']) {
568
+        if ($string['comment']) {
569 569
         $output .= '#: ' . $string['comment'] . "\n";
570
-      }
571
-      if ($string['context']) {
570
+        }
571
+        if ($string['context']) {
572 572
         $output .= 'msgctxt "' . $string['context'] . "\"\n";
573
-      }
574
-      $output .= 'msgid ' . _locale_export_string($string['source']);
575
-      if (!empty($string['plural'])) {
573
+        }
574
+        $output .= 'msgid ' . _locale_export_string($string['source']);
575
+        if (!empty($string['plural'])) {
576 576
         $plural = $string['plural'];
577 577
         $output .= 'msgid_plural ' . _locale_export_string($strings[$plural]['source']);
578 578
         if (isset($language)) {
579
-          $translation = $string['translation'];
580
-          for ($i = 0; $i < $language->plurals; $i++) {
579
+            $translation = $string['translation'];
580
+            for ($i = 0; $i < $language->plurals; $i++) {
581 581
             $output .= 'msgstr[' . $i . '] ' . _locale_export_string($translation);
582 582
             if ($plural) {
583
-              $translation = _locale_export_remove_plural($strings[$plural]['translation']);
584
-              $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0;
583
+                $translation = _locale_export_remove_plural($strings[$plural]['translation']);
584
+                $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0;
585 585
             }
586 586
             else {
587
-              $translation = '';
587
+                $translation = '';
588
+            }
588 589
             }
589
-          }
590 590
         }
591 591
         else {
592
-          $output .= 'msgstr[0] ""' . "\n";
593
-          $output .= 'msgstr[1] ""' . "\n";
592
+            $output .= 'msgstr[0] ""' . "\n";
593
+            $output .= 'msgstr[1] ""' . "\n";
594
+        }
594 595
         }
595
-      }
596
-      else {
596
+        else {
597 597
         $output .= 'msgstr ' . _locale_export_string($string['translation']);
598
-      }
599
-      $output .= "\n";
598
+        }
599
+        $output .= "\n";
600 600
     }
601
-  }
602
-  return $output;
601
+    }
602
+    return $output;
603 603
 }
604 604
 
605 605
 /**
606 606
  *
607 607
  */
608 608
 function boinctranslate_refresh_translations() {
609
-  require_once(getcwd() . '/includes/locale.inc');
610
-  $errors = array();
611
-  $languages = locale_language_list();
612
-  $translation_resources = array();
613
-  $operations = array();
614
-  $debug_mode = variable_get('boinc_debug_mode', 0);
615
-
616
-  $boinc_name = variable_get(
609
+    require_once(getcwd() . '/includes/locale.inc');
610
+    $errors = array();
611
+    $languages = locale_language_list();
612
+    $translation_resources = array();
613
+    $operations = array();
614
+    $debug_mode = variable_get('boinc_debug_mode', 0);
615
+
616
+    $boinc_name = variable_get(
617 617
     'boinc_translate_transifex_standard_name', ''
618
-  );
619
-  $boinc_resources = boinctranslate_parse_resources(
618
+    );
619
+    $boinc_resources = boinctranslate_parse_resources(
620 620
     variable_get('boinc_translate_transifex_standard_resources', array())
621
-  );
622
-  // Add the Official BOINC resource to the list of BOINC resources;
623
-  // The official resource overrides any additional resources provided, so it
624
-  // should be added to the end so as to be processed last
625
-  $drupal_resource = variable_get(
621
+    );
622
+    // Add the Official BOINC resource to the list of BOINC resources;
623
+    // The official resource overrides any additional resources provided, so it
624
+    // should be added to the end so as to be processed last
625
+    $drupal_resource = variable_get(
626 626
     'boinc_translate_transifex_boinc_drupal_resource', ''
627
-  );
628
-  $boinc_resources[] = $drupal_resource;
629
-  if ($boinc_name AND $boinc_resources) {
627
+    );
628
+    $boinc_resources[] = $drupal_resource;
629
+    if ($boinc_name AND $boinc_resources) {
630 630
     $translation_resources[$boinc_name] = array(
631
-      'resources' => $boinc_resources,
632
-      'textgroups' => array(
631
+        'resources' => $boinc_resources,
632
+        'textgroups' => array(
633 633
         'boinc',
634 634
         'default',
635 635
         'taxonomy',
636 636
         'views',
637
-      ),
637
+        ),
638 638
     );
639
-  }
640
-  $project_name = variable_get(
639
+    }
640
+    $project_name = variable_get(
641 641
     'boinc_translate_transifex_project_name', ''
642
-  );
643
-  $project_resources = boinctranslate_parse_resources(
642
+    );
643
+    $project_resources = boinctranslate_parse_resources(
644 644
     variable_get('boinc_translate_transifex_project_resources', array())
645
-  );
646
-  if ($project_name AND $project_resources) {
645
+    );
646
+    if ($project_name AND $project_resources) {
647 647
     $translation_resources[$project_name] = array(
648
-      'resources' => $project_resources,
649
-      'textgroups' => array(
648
+        'resources' => $project_resources,
649
+        'textgroups' => array(
650 650
         'blocks',
651 651
         'menu',
652 652
         'project',
653
-      ),
653
+        ),
654 654
     );
655 655
     // Be sure any strings from the override file are added to the boinc group
656 656
     $override_file = './' . drupal_get_path('module', 'boinctranslate') . '/includes/other-boinc-translation-strings.txt';
657 657
     $other_strings = file($override_file);
658 658
     if ($other_strings) {
659
-      foreach ($other_strings as $string) {
659
+        foreach ($other_strings as $string) {
660 660
         $string = trim($string);
661 661
         if ($string) {
662
-          // Ignore lines starting with '#' i.e., comments.
663
-          if ($string[0] === "#")
662
+            // Ignore lines starting with '#' i.e., comments.
663
+            if ($string[0] === "#")
664 664
             continue;
665 665
 
666
-          // Use '|' as delimiter to split string and context info.
667
-          $line = explode("|", $string);
668
-          if ($line) {
666
+            // Use '|' as delimiter to split string and context info.
667
+            $line = explode("|", $string);
668
+            if ($line) {
669 669
             if (count($line)==1) {
670
-              $tl0 = trim($line[0]);
671
-              if ($tl0) {
670
+                $tl0 = trim($line[0]);
671
+                if ($tl0) {
672 672
                 bts($tl0);
673
-              }
673
+                }
674 674
             }
675 675
             elseif (count($line)>1) {
676
-              $tl0 = trim($line[0]);
677
-              $tl1 = trim($line[1]);
678
-              if ($tl0 and $tl1) {
676
+                $tl0 = trim($line[0]);
677
+                $tl1 = trim($line[1]);
678
+                if ($tl0 and $tl1) {
679 679
                 bts($tl0, array(), NULL, $tl1);
680
-              }
680
+                }
681 681
             }
682
-          }// if ($line)
682
+            }// if ($line)
683 683
 
684 684
         }// if ($string)
685
-      }// foreach
685
+        }// foreach
686 686
     }// if ($other_strings)
687
-  }
687
+    }
688 688
 
689
-  foreach ($languages as $langcode => $language) {
689
+    foreach ($languages as $langcode => $language) {
690 690
     if ($langcode == 'en') {
691
-      continue;
691
+        continue;
692 692
     }
693 693
 
694 694
     $import_stats = array(
695
-      'new' => 0,
696
-      'updated' => 0,
697
-      'deleted' => 0,
698
-      'skipped' => 0,
695
+        'new' => 0,
696
+        'updated' => 0,
697
+        'deleted' => 0,
698
+        'skipped' => 0,
699 699
     );
700 700
 
701 701
     foreach ($translation_resources as $project => $translation) {
702
-      foreach ($translation['resources'] as $resource) {
702
+        foreach ($translation['resources'] as $resource) {
703 703
 
704 704
         // Add this language to the batch operations
705 705
         $operations[] = array(
706
-          'boinctranslate_refresh_translations_op',
707
-          array(
706
+            'boinctranslate_refresh_translations_op',
707
+            array(
708 708
             $project, $resource, $langcode, $language, $translation['textgroups'], $debug_mode
709
-          ),
709
+            ),
710 710
         );
711
-      }
711
+        }
712 712
     }
713 713
     if ($batch = locale_batch_by_language($langcode)) {
714
-      foreach ($batch['operations'] as $op) {
714
+        foreach ($batch['operations'] as $op) {
715 715
         $operations[] = array(
716
-          'boinctranslate_refresh_translations_op',
717
-          array(
716
+            'boinctranslate_refresh_translations_op',
717
+            array(
718 718
             NULL, $op[1][0], $langcode, $language, array('default'), $debug_mode
719
-          ),
719
+            ),
720 720
         );
721
-      }
721
+        }
722
+    }
722 723
     }
723
-  }
724 724
 
725
-  $batch = array(
725
+    $batch = array(
726 726
     'operations' => $operations,
727 727
     'finished' => 'boinctranslate_refresh_translations_finished',
728 728
     'title' => t('Importing translations'),
729 729
     'init_message' => t('Beginning translation import...'),
730 730
     'progress_message' => t('Applied @current out of @total translation updates.'),
731 731
     'error_message' => t('Translation import has encountered an error.'),
732
-  );
732
+    );
733 733
 
734
-  batch_set($batch);
735
-  batch_process();
734
+    batch_set($batch);
735
+    batch_process();
736 736
 }
737 737
 
738 738
 
@@ -741,18 +741,18 @@  discard block
 block discarded – undo
741 741
  */
742 742
 function boinctranslate_refresh_translations_op($project, $resource, $langcode, $language, $textgroups, $debug_mode, &$context) {
743 743
 
744
-  require_once(getcwd() . '/includes/locale.inc');
744
+    require_once(getcwd() . '/includes/locale.inc');
745 745
 
746
-  if ($debug_mode) {
746
+    if ($debug_mode) {
747 747
     watchdog(
748
-      'boinctranslate',
749
-      'Checking for @language updates in @project:@resource',
750
-      array('@language' => $language, '@project' => $project, '@resource' => $resource),
751
-      WATCHDOG_INFO
748
+        'boinctranslate',
749
+        'Checking for @language updates in @project:@resource',
750
+        array('@language' => $language, '@project' => $project, '@resource' => $resource),
751
+        WATCHDOG_INFO
752 752
     );
753
-  }
753
+    }
754 754
 
755
-  if ($project) {
755
+    if ($project) {
756 756
     // Import the configured resources
757 757
     $success = FALSE;
758 758
     $message = '';
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
     $response = boinctranslate_transifex_request($path);
761 761
 
762 762
     if ($response == '404 NOT FOUND') {
763
-      $message = "Project resource {$project}:{$resource} not found in {$language}.";
763
+        $message = "Project resource {$project}:{$resource} not found in {$language}.";
764 764
     }
765 765
     elseif ($response) {
766
-      if (!empty($response['content'])) {
766
+        if (!empty($response['content'])) {
767 767
         $po_text = $response['content'];
768 768
 
769 769
         // Write the translation file to a temporary location
@@ -771,163 +771,163 @@  discard block
 block discarded – undo
771 771
         $file->filepath = file_save_data($po_text, NULL);
772 772
         $file->filename = basename($file->filepath);
773 773
         if (!$file->filepath) {
774
-          $message = 'Unable to create temporary file in '
774
+            $message = 'Unable to create temporary file in '
775 775
             . file_directory_temp() . " for {$language} translation "
776 776
             . "resource {$project}:{$resource}";
777 777
         }
778 778
 
779 779
         foreach ($textgroups as $textgroup) {
780
-          // Import the translations from the file to each related textgroup
781
-          if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
780
+            // Import the translations from the file to each related textgroup
781
+            if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
782 782
             $message = "The {$language} translation import of"
783
-              . " {$project}:{$resource} failed.";
783
+                . " {$project}:{$resource} failed.";
784 784
             $success = FALSE;
785 785
             break;
786
-          }
787
-          else {
786
+            }
787
+            else {
788 788
             $success = TRUE;
789
-          }
789
+            }
790
+        }
790 791
         }
791
-      }
792
-      else {
792
+        else {
793 793
         $message = "Unable to read response for {$language} translation import"
794
-          . " of {$project}:{$resource}.";
795
-      }
794
+            . " of {$project}:{$resource}.";
795
+        }
796 796
     }
797 797
     else {
798
-      $message = "Translation data not found in response for {$language}"
798
+        $message = "Translation data not found in response for {$language}"
799 799
         . " translation import of {$project}:{$resource}.";
800 800
     }
801
-  }
802
-  else {
801
+    }
802
+    else {
803 803
     // If project isn't specified, import as a local Drupal resource
804 804
     $project = 'drupal.local';
805 805
     $file = new stdClass();
806 806
     $file->filepath = $resource;
807 807
     $file->filename = basename($file->filepath);
808 808
     if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
809
-      $message = "The {$language} translation import of"
809
+        $message = "The {$language} translation import of"
810 810
         . " local file {$resource} failed.";
811
-      $success = FALSE;
811
+        $success = FALSE;
812 812
     }
813 813
     else {
814
-      $success = TRUE;
814
+        $success = TRUE;
815
+    }
815 816
     }
816
-  }
817 817
 
818
-  if ($success) {
818
+    if ($success) {
819 819
     // Store some result for post-processing in the finished callback.
820 820
     $context['results']['success'][] = "{$langcode}:{$textgroup}";
821 821
     $message = "Imported {$language} translations in {$project}:{$resource} ({$results['new']} added, {$results['updated']} refreshed, {$results['deleted']} removed)";
822 822
 
823 823
     if ($debug_mode) {
824
-      watchdog(
824
+        watchdog(
825 825
         'boinctranslate',
826 826
         $message,
827 827
         array(),
828 828
         WATCHDOG_INFO
829
-      );
829
+        );
830 830
     }
831
-  }
832
-  else {
831
+    }
832
+    else {
833 833
     $context['results']['failure'][] = "{$langcode}:{$textgroup}";
834 834
     watchdog(
835
-      'boinctranslate',
836
-      $message,
837
-      array(),
838
-      WATCHDOG_WARNING
835
+        'boinctranslate',
836
+        $message,
837
+        array(),
838
+        WATCHDOG_WARNING
839 839
     );
840
-  }
840
+    }
841 841
 
842
-  // Update our progress information.
843
-  $context['sandbox']['progress']++;
844
-  $context['sandbox']['language'] = $langcode;
845
-  $context['message'] = $message;
842
+    // Update our progress information.
843
+    $context['sandbox']['progress']++;
844
+    $context['sandbox']['language'] = $langcode;
845
+    $context['message'] = $message;
846 846
 
847
-  // Update the progress for the batch engine
848
-  if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
847
+    // Update the progress for the batch engine
848
+    if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
849 849
     $context['finished'] = 1;
850
-  }
851
-  else {
850
+    }
851
+    else {
852 852
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
853
-  }
853
+    }
854 854
 }
855 855
 
856 856
 /**
857 857
  * Batch 'finished' callback
858 858
  */
859 859
 function boinctranslate_refresh_translations_finished($success, $results, $operations) {
860
-  if ($success) {
860
+    if ($success) {
861 861
     // Let's count our successes
862 862
     $count = count($results['success']);
863 863
     $message = "Successfully completed {$count} import operations";
864 864
     watchdog(
865
-      'boinctranslate',
866
-      'Successfully completed @count import operations.',
867
-      array('@count' => $count),
868
-      WATCHDOG_INFO
865
+        'boinctranslate',
866
+        'Successfully completed @count import operations.',
867
+        array('@count' => $count),
868
+        WATCHDOG_INFO
869 869
     );
870
-  }
871
-  else {
870
+    }
871
+    else {
872 872
     // An error occurred.
873 873
     // $operations contains the operations that remained unprocessed.
874 874
     $error_operation = reset($operations);
875 875
     $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
876 876
     watchdog(
877
-      'boinctranslate',
878
-      $message,
879
-      array(),
880
-      WATCHDOG_WARNING
877
+        'boinctranslate',
878
+        $message,
879
+        array(),
880
+        WATCHDOG_WARNING
881 881
     );
882
-  }
883
-  drupal_set_message($message);
884
-  drupal_goto('admin/boinc/translation');
882
+    }
883
+    drupal_set_message($message);
884
+    drupal_goto('admin/boinc/translation');
885 885
 }
886 886
 
887 887
 /**
888 888
  *
889 889
  */
890 890
 function _boinctranslate_locale_import_po($file, $langcode, $mode, $group = NULL) {
891
-  // Try to allocate enough time to parse and import the data.
892
-  if (function_exists('set_time_limit')) {
891
+    // Try to allocate enough time to parse and import the data.
892
+    if (function_exists('set_time_limit')) {
893 893
     @set_time_limit(240);
894
-  }
894
+    }
895 895
 
896
-  require_once(getcwd() . '/includes/locale.inc');
896
+    require_once(getcwd() . '/includes/locale.inc');
897 897
 
898
-  // Check if we have the language already in the database.
899
-  if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) {
898
+    // Check if we have the language already in the database.
899
+    if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) {
900 900
     drupal_set_message(t('The language selected for import is not supported.'), 'error');
901 901
     return FALSE;
902
-  }
902
+    }
903 903
 
904
-  // Get strings from file (returns on failure after a partial import, or on success)
905
-  $status = _boinctranslate_locale_import_read_po('db-store', $file, $mode, $langcode, $group);
906
-  if ($status === FALSE) {
904
+    // Get strings from file (returns on failure after a partial import, or on success)
905
+    $status = _boinctranslate_locale_import_read_po('db-store', $file, $mode, $langcode, $group);
906
+    if ($status === FALSE) {
907 907
     // Error messages are set in _locale_import_read_po().
908 908
     return FALSE;
909
-  }
909
+    }
910 910
 
911
-  // Get status information on import process.
912
-  list($headerdone, $additions, $updates, $deletes, $skips) = _boinctranslate_locale_import_one_string('db-report');
911
+    // Get status information on import process.
912
+    list($headerdone, $additions, $updates, $deletes, $skips) = _boinctranslate_locale_import_one_string('db-report');
913 913
 
914
-  if (!$headerdone) {
914
+    if (!$headerdone) {
915 915
     drupal_set_message(t('The translation file %filename appears to have a missing or malformed header.', array('%filename' => $file->filename)), 'error');
916
-  }
916
+    }
917 917
 
918
-  // Clear cache and force refresh of JavaScript translations.
919
-  _locale_invalidate_js($langcode);
920
-  cache_clear_all('locale:', 'cache', TRUE);
918
+    // Clear cache and force refresh of JavaScript translations.
919
+    _locale_invalidate_js($langcode);
920
+    cache_clear_all('locale:', 'cache', TRUE);
921 921
 
922
-  // Rebuild the menu, strings may have changed.
923
-  menu_rebuild();
922
+    // Rebuild the menu, strings may have changed.
923
+    menu_rebuild();
924 924
 
925
-  return array(
925
+    return array(
926 926
     'new' => $additions,
927 927
     'updated' => $updates,
928 928
     'deleted' => $deletes,
929 929
     'skipped' => $skips,
930
-  );
930
+    );
931 931
 }
932 932
 
933 933
 /**
@@ -935,253 +935,253 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') {
937 937
 
938
-  require_once(getcwd() . '/includes/locale.inc');
938
+    require_once(getcwd() . '/includes/locale.inc');
939 939
 
940
-  $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return
941
-  if (!$fd) {
940
+    $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return
941
+    if (!$fd) {
942 942
     watchdog(
943
-      'boinctranslate',
944
-      'The translation import for %lang failed, because %filename could not be read.',
945
-      array('%lang' => $lang, '%filename' => $file->filename),
946
-      WATCHDOG_WARNING
943
+        'boinctranslate',
944
+        'The translation import for %lang failed, because %filename could not be read.',
945
+        array('%lang' => $lang, '%filename' => $file->filename),
946
+        WATCHDOG_WARNING
947 947
     );
948 948
     _locale_import_message('The translation import failed, because the file %filename could not be read.', $file);
949 949
     return FALSE;
950
-  }
950
+    }
951 951
 
952
-  $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR
953
-  $current = array(); // Current entry being read
954
-  $plural = 0; // Current plural form
955
-  $lineno = 0; // Current line
952
+    $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR
953
+    $current = array(); // Current entry being read
954
+    $plural = 0; // Current plural form
955
+    $lineno = 0; // Current line
956 956
 
957
-  while (!feof($fd)) {
957
+    while (!feof($fd)) {
958 958
     $line = fgets($fd, 10 * 1024); // A line should not be this long
959 959
     if ($lineno == 0) {
960
-      // The first line might come with a UTF-8 BOM, which should be removed.
961
-      $line = str_replace("\xEF\xBB\xBF", '', $line);
960
+        // The first line might come with a UTF-8 BOM, which should be removed.
961
+        $line = str_replace("\xEF\xBB\xBF", '', $line);
962 962
     }
963 963
     $lineno++;
964 964
     $line = trim(strtr($line, array("\\\n" => "")));
965 965
 
966 966
     if (!strncmp("#", $line, 1)) { // A comment
967
-      if ($context == "COMMENT") { // Already in comment context: add
967
+        if ($context == "COMMENT") { // Already in comment context: add
968 968
         $current["#"][] = substr($line, 1);
969
-      }
970
-      elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
969
+        }
970
+        elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
971 971
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
972 972
         $current = array();
973 973
         $current["#"][] = substr($line, 1);
974 974
         $context = "COMMENT";
975
-      }
976
-      else { // Parse error
975
+        }
976
+        else { // Parse error
977 977
         watchdog(
978
-          'boinctranslate',
979
-          'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.',
980
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
981
-          WATCHDOG_WARNING
978
+            'boinctranslate',
979
+            'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.',
980
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
981
+            WATCHDOG_WARNING
982 982
         );
983 983
         _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno);
984 984
         return FALSE;
985
-      }
985
+        }
986 986
     }
987 987
     elseif (!strncmp("msgctxt", $line, 7)) {
988
-      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
988
+        if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
989 989
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
990 990
         $current = array();
991
-      }
992
-      elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error
991
+        }
992
+        elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error
993 993
         watchdog(
994
-          'boinctranslate',
995
-          'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.',
996
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
997
-          WATCHDOG_WARNING
994
+            'boinctranslate',
995
+            'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.',
996
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
997
+            WATCHDOG_WARNING
998 998
         );
999 999
         _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno);
1000 1000
         return FALSE;
1001
-      }
1002
-      $line = trim(substr($line, 7));
1003
-      $quoted = _locale_import_parse_quoted($line);
1004
-      if ($quoted === FALSE) {
1001
+        }
1002
+        $line = trim(substr($line, 7));
1003
+        $quoted = _locale_import_parse_quoted($line);
1004
+        if ($quoted === FALSE) {
1005 1005
         watchdog(
1006
-          'boinctranslate',
1007
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1008
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1009
-          WATCHDOG_WARNING
1006
+            'boinctranslate',
1007
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1008
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1009
+            WATCHDOG_WARNING
1010 1010
         );
1011 1011
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1012 1012
         return FALSE;
1013
-      }
1014
-      $current["msgctxt"] = $quoted;
1015
-      $context = "MSGCTXT";
1013
+        }
1014
+        $current["msgctxt"] = $quoted;
1015
+        $context = "MSGCTXT";
1016 1016
     }
1017 1017
     elseif (!strncmp("msgid_plural", $line, 12)) {
1018
-      if ($context != "MSGID") { // Must be plural form for current entry
1018
+        if ($context != "MSGID") { // Must be plural form for current entry
1019 1019
         watchdog(
1020
-          'boinctranslate',
1021
-          'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.',
1022
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1023
-          WATCHDOG_WARNING
1020
+            'boinctranslate',
1021
+            'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.',
1022
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1023
+            WATCHDOG_WARNING
1024 1024
         );
1025 1025
         _locale_import_message('The translation file %filename contains an error: "msgid_plural" was expected but not found on line %line.', $file, $lineno);
1026 1026
         return FALSE;
1027
-      }
1028
-      $line = trim(substr($line, 12));
1029
-      $quoted = _locale_import_parse_quoted($line);
1030
-      if ($quoted === FALSE) {
1027
+        }
1028
+        $line = trim(substr($line, 12));
1029
+        $quoted = _locale_import_parse_quoted($line);
1030
+        if ($quoted === FALSE) {
1031 1031
         watchdog(
1032
-          'boinctranslate',
1033
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1034
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1035
-          WATCHDOG_WARNING
1032
+            'boinctranslate',
1033
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1034
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1035
+            WATCHDOG_WARNING
1036 1036
         );
1037 1037
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1038 1038
         return FALSE;
1039
-      }
1040
-      $current["msgid"] = $current["msgid"] . "\0" . $quoted;
1041
-      $context = "MSGID_PLURAL";
1039
+        }
1040
+        $current["msgid"] = $current["msgid"] . "\0" . $quoted;
1041
+        $context = "MSGID_PLURAL";
1042 1042
     }
1043 1043
     elseif (!strncmp("msgid", $line, 5)) {
1044
-      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
1044
+        if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
1045 1045
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
1046 1046
         $current = array();
1047
-      }
1048
-      elseif ($context == "MSGID") { // Already in this context? Parse error
1047
+        }
1048
+        elseif ($context == "MSGID") { // Already in this context? Parse error
1049 1049
         watchdog(
1050
-          'boinctranslate',
1051
-          'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.',
1052
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1053
-          WATCHDOG_WARNING
1050
+            'boinctranslate',
1051
+            'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.',
1052
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1053
+            WATCHDOG_WARNING
1054 1054
         );
1055 1055
         _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno);
1056 1056
         return FALSE;
1057
-      }
1058
-      $line = trim(substr($line, 5));
1059
-      $quoted = _locale_import_parse_quoted($line);
1060
-      if ($quoted === FALSE) {
1057
+        }
1058
+        $line = trim(substr($line, 5));
1059
+        $quoted = _locale_import_parse_quoted($line);
1060
+        if ($quoted === FALSE) {
1061 1061
         watchdog(
1062
-          'boinctranslate',
1063
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1064
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1065
-          WATCHDOG_WARNING
1062
+            'boinctranslate',
1063
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1064
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1065
+            WATCHDOG_WARNING
1066 1066
         );
1067 1067
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1068 1068
         return FALSE;
1069
-      }
1070
-      $current["msgid"] = $quoted;
1071
-      $context = "MSGID";
1069
+        }
1070
+        $current["msgid"] = $quoted;
1071
+        $context = "MSGID";
1072 1072
     }
1073 1073
     elseif (!strncmp("msgstr[", $line, 7)) {
1074
-      if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[]
1074
+        if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[]
1075 1075
         watchdog(
1076
-          'boinctranslate',
1077
-          'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.',
1078
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1079
-          WATCHDOG_WARNING
1076
+            'boinctranslate',
1077
+            'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.',
1078
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1079
+            WATCHDOG_WARNING
1080 1080
         );
1081 1081
         _locale_import_message('The translation file %filename contains an error: "msgstr[]" is unexpected on line %line.', $file, $lineno);
1082 1082
         return FALSE;
1083
-      }
1084
-      if (strpos($line, "]") === FALSE) {
1083
+        }
1084
+        if (strpos($line, "]") === FALSE) {
1085 1085
         watchdog(
1086
-          'boinctranslate',
1087
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1088
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1089
-          WATCHDOG_WARNING
1086
+            'boinctranslate',
1087
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1088
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1089
+            WATCHDOG_WARNING
1090 1090
         );
1091 1091
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1092 1092
         return FALSE;
1093
-      }
1094
-      $frombracket = strstr($line, "[");
1095
-      $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1);
1096
-      $line = trim(strstr($line, " "));
1097
-      $quoted = _locale_import_parse_quoted($line);
1098
-      if ($quoted === FALSE) {
1093
+        }
1094
+        $frombracket = strstr($line, "[");
1095
+        $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1);
1096
+        $line = trim(strstr($line, " "));
1097
+        $quoted = _locale_import_parse_quoted($line);
1098
+        if ($quoted === FALSE) {
1099 1099
         watchdog(
1100
-          'boinctranslate',
1101
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1102
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1103
-          WATCHDOG_WARNING
1100
+            'boinctranslate',
1101
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1102
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1103
+            WATCHDOG_WARNING
1104 1104
         );
1105 1105
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1106 1106
         return FALSE;
1107
-      }
1108
-      $current["msgstr"][$plural] = $quoted;
1109
-      $context = "MSGSTR_ARR";
1107
+        }
1108
+        $current["msgstr"][$plural] = $quoted;
1109
+        $context = "MSGSTR_ARR";
1110 1110
     }
1111 1111
     elseif (!strncmp("msgstr", $line, 6)) {
1112
-      if ($context != "MSGID") { // Should come just after a msgid block
1112
+        if ($context != "MSGID") { // Should come just after a msgid block
1113 1113
         watchdog(
1114
-          'boinctranslate',
1115
-          'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.',
1116
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1117
-          WATCHDOG_WARNING
1114
+            'boinctranslate',
1115
+            'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.',
1116
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1117
+            WATCHDOG_WARNING
1118 1118
         );
1119 1119
         _locale_import_message('The translation file %filename contains an error: "msgstr" is unexpected on line %line.', $file, $lineno);
1120 1120
         return FALSE;
1121
-      }
1122
-      $line = trim(substr($line, 6));
1123
-      $quoted = _locale_import_parse_quoted($line);
1124
-      if ($quoted === FALSE) {
1121
+        }
1122
+        $line = trim(substr($line, 6));
1123
+        $quoted = _locale_import_parse_quoted($line);
1124
+        if ($quoted === FALSE) {
1125 1125
         watchdog(
1126
-          'boinctranslate',
1127
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1128
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1129
-          WATCHDOG_WARNING
1126
+            'boinctranslate',
1127
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1128
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1129
+            WATCHDOG_WARNING
1130 1130
         );
1131 1131
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1132 1132
         return FALSE;
1133
-      }
1134
-      $current["msgstr"] = $quoted;
1135
-      $context = "MSGSTR";
1133
+        }
1134
+        $current["msgstr"] = $quoted;
1135
+        $context = "MSGSTR";
1136 1136
     }
1137 1137
     elseif ($line != "") {
1138
-      $quoted = _locale_import_parse_quoted($line);
1139
-      if ($quoted === FALSE) {
1138
+        $quoted = _locale_import_parse_quoted($line);
1139
+        if ($quoted === FALSE) {
1140 1140
         watchdog(
1141
-          'boinctranslate',
1142
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1143
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1144
-          WATCHDOG_WARNING
1141
+            'boinctranslate',
1142
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1143
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1144
+            WATCHDOG_WARNING
1145 1145
         );
1146 1146
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1147 1147
         return FALSE;
1148
-      }
1149
-      if (($context == "MSGID") || ($context == "MSGID_PLURAL")) {
1148
+        }
1149
+        if (($context == "MSGID") || ($context == "MSGID_PLURAL")) {
1150 1150
         $current["msgid"] .= $quoted;
1151
-      }
1152
-      elseif ($context == "MSGSTR") {
1151
+        }
1152
+        elseif ($context == "MSGSTR") {
1153 1153
         $current["msgstr"] .= $quoted;
1154
-      }
1155
-      elseif ($context == "MSGSTR_ARR") {
1154
+        }
1155
+        elseif ($context == "MSGSTR_ARR") {
1156 1156
         $current["msgstr"][$plural] .= $quoted;
1157
-      }
1158
-      else {
1157
+        }
1158
+        else {
1159 1159
         watchdog(
1160
-          'boinctranslate',
1161
-          'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.',
1162
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1163
-          WATCHDOG_WARNING
1160
+            'boinctranslate',
1161
+            'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.',
1162
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1163
+            WATCHDOG_WARNING
1164 1164
         );
1165 1165
         _locale_import_message('The translation file %filename contains an error: there is an unexpected string on line %line.', $file, $lineno);
1166 1166
         return FALSE;
1167
-      }
1167
+        }
1168
+    }
1168 1169
     }
1169
-  }
1170 1170
 
1171
-  // End of PO file, flush last entry
1172
-  if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
1171
+    // End of PO file, flush last entry
1172
+    if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
1173 1173
     _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
1174
-  }
1175
-  elseif ($context != "COMMENT") {
1174
+    }
1175
+    elseif ($context != "COMMENT") {
1176 1176
     watchdog(
1177
-      'boinctranslate',
1178
-      'The translation file %filename for %lang ended unexpectedly at line %line.',
1179
-      array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1180
-      WATCHDOG_WARNING
1177
+        'boinctranslate',
1178
+        'The translation file %filename for %lang ended unexpectedly at line %line.',
1179
+        array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1180
+        WATCHDOG_WARNING
1181 1181
     );
1182 1182
     _locale_import_message('The translation file %filename ended unexpectedly at line %line.', $file, $lineno);
1183 1183
     return FALSE;
1184
-  }
1184
+    }
1185 1185
 
1186 1186
 }
1187 1187
 
@@ -1190,28 +1190,28 @@  discard block
 block discarded – undo
1190 1190
  */
1191 1191
 function _boinctranslate_locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') {
1192 1192
 
1193
-  require_once(getcwd() . '/includes/locale.inc');
1193
+    require_once(getcwd() . '/includes/locale.inc');
1194 1194
 
1195
-  static $report = array(
1195
+    static $report = array(
1196 1196
     'additions' => 0,
1197 1197
     'updates' => 0,
1198 1198
     'deletes' => 0,
1199 1199
     'skips' => 0,
1200
-  );
1201
-  static $headerdone = FALSE;
1202
-  static $strings = array();
1200
+    );
1201
+    static $headerdone = FALSE;
1202
+    static $strings = array();
1203 1203
 
1204
-  switch ($op) {
1204
+    switch ($op) {
1205 1205
     // Return stored strings
1206 1206
     case 'mem-report':
1207 1207
       return $strings;
1208 1208
 
1209
-      // Store string in memory (only supports single strings)
1209
+        // Store string in memory (only supports single strings)
1210 1210
     case 'mem-store':
1211 1211
       $strings[$value['msgid']] = $value['msgstr'];
1212
-      return;
1212
+        return;
1213 1213
 
1214
-      // Called at end of import to inform the user
1214
+        // Called at end of import to inform the user
1215 1215
     case 'db-report':
1216 1216
       return array(
1217 1217
         $headerdone,
@@ -1219,57 +1219,57 @@  discard block
 block discarded – undo
1219 1219
         $report['updates'],
1220 1220
         $report['deletes'],
1221 1221
         $report['skips'],
1222
-      );
1222
+        );
1223 1223
 
1224
-      // Store the string we got in the database.
1224
+        // Store the string we got in the database.
1225 1225
     case 'db-store':
1226 1226
       // We got header information.
1227 1227
       if ($value['msgid'] == '') {
1228 1228
         $languages = language_list();
1229 1229
         if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) {
1230
-          // Since we only need to parse the header if we ought to update the
1231
-          // plural formula, only run this if we don't need to keep existing
1232
-          // data untouched or if we don't have an existing plural formula.
1233
-          $header = _locale_import_parse_header($value['msgstr']);
1230
+            // Since we only need to parse the header if we ought to update the
1231
+            // plural formula, only run this if we don't need to keep existing
1232
+            // data untouched or if we don't have an existing plural formula.
1233
+            $header = _locale_import_parse_header($value['msgstr']);
1234 1234
 
1235
-          // Get and store the plural formula if available.
1236
-          if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1235
+            // Get and store the plural formula if available.
1236
+            if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1237 1237
             list($nplurals, $plural) = $p;
1238 1238
             db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang);
1239
-          }
1239
+            }
1240 1240
         }
1241 1241
         $headerdone = TRUE;
1242
-      }
1242
+        }
1243 1243
 
1244
-      else {
1244
+        else {
1245 1245
         // Some real string to import.
1246 1246
         $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
1247 1247
 
1248 1248
         if (strpos($value['msgid'], "\0")) {
1249
-          // This string has plural versions.
1250
-          $english = explode("\0", $value['msgid'], 2);
1251
-          $entries = array_keys($value['msgstr']);
1252
-          for ($i = 3; $i <= count($entries); $i++) {
1249
+            // This string has plural versions.
1250
+            $english = explode("\0", $value['msgid'], 2);
1251
+            $entries = array_keys($value['msgstr']);
1252
+            for ($i = 3; $i <= count($entries); $i++) {
1253 1253
             $english[] = $english[1];
1254
-          }
1255
-          $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1256
-          $english = array_map('_locale_import_append_plural', $english, $entries);
1257
-          foreach ($translation as $key => $trans) {
1254
+            }
1255
+            $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1256
+            $english = array_map('_locale_import_append_plural', $english, $entries);
1257
+            foreach ($translation as $key => $trans) {
1258 1258
             if ($key == 0) {
1259
-              $plid = 0;
1259
+                $plid = 0;
1260 1260
             }
1261 1261
             $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
1262
-          }
1262
+            }
1263 1263
         }
1264 1264
 
1265 1265
         else {
1266
-          // A simple string to import.
1267
-          $english = $value['msgid'];
1268
-          $translation = $value['msgstr'];
1269
-          _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1266
+            // A simple string to import.
1267
+            $english = $value['msgid'];
1268
+            $translation = $value['msgstr'];
1269
+            _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1270 1270
         }
1271
-      }
1272
-  } // end of db-store operation
1271
+        }
1272
+    } // end of db-store operation
1273 1273
 }
1274 1274
 
1275 1275
 /**
@@ -1286,15 +1286,15 @@  discard block
 block discarded – undo
1286 1286
  */
1287 1287
 function _boinctranslate_locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = NULL, $plural = NULL) {
1288 1288
 
1289
-  $ignoreoverwrite = FALSE;
1290
-  $lid = 0;
1289
+    $ignoreoverwrite = FALSE;
1290
+    $lid = 0;
1291 1291
 
1292
-  // Use different DB query depending on the textgroup.
1293
-  $uselocation = array("boinc", "project");
1294
-  if (in_array($textgroup, $uselocation)) {
1292
+    // Use different DB query depending on the textgroup.
1293
+    $uselocation = array("boinc", "project");
1294
+    if (in_array($textgroup, $uselocation)) {
1295 1295
     $resource = db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s' AND textgroup = '%s'", $location, $source, $textgroup);
1296
-  }
1297
-  else {
1296
+    }
1297
+    else {
1298 1298
     $resource = db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup);
1299 1299
 
1300 1300
     // Parse the location string for the string ignoreoverwrite, which
@@ -1303,61 +1303,61 @@  discard block
 block discarded – undo
1303 1303
     // location string.
1304 1304
     $parts = explode(':', $location);
1305 1305
     if (!empty($parts[2])) {
1306
-      if (preg_match('/(ignoreoverwrite)/', $parts[2])) {
1306
+        if (preg_match('/(ignoreoverwrite)/', $parts[2])) {
1307 1307
         $ignoreoverwrite = TRUE;
1308
-      }
1308
+        }
1309 1309
     }
1310
-  }// if (in_array($textgroup, $uselocation))
1310
+    }// if (in_array($textgroup, $uselocation))
1311 1311
 
1312
-  if (!empty($translation)) {
1312
+    if (!empty($translation)) {
1313 1313
     // Skip this string unless it passes a check for dangerous code.
1314 1314
     // Text groups other than default still can contain HTML tags
1315 1315
     // (i.e. translatable blocks).
1316 1316
     if ($textgroup == "default" && !locale_string_is_safe($translation)) {
1317
-      $report['skips']++;
1318
-      $lid = 0;
1317
+        $report['skips']++;
1318
+        $lid = 0;
1319 1319
     }
1320 1320
     elseif ($resource) {
1321
-      // We have this source string saved already. Loop over the db results from locales_source table.
1322
-      while ($row = db_fetch_array($resource)) {
1321
+        // We have this source string saved already. Loop over the db results from locales_source table.
1322
+        while ($row = db_fetch_array($resource)) {
1323 1323
 
1324 1324
         $lid = $row['lid'];
1325 1325
         // Check of if one or more translations exist for this lid in locales_target table.
1326 1326
         $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1327 1327
         if (!$exists) {
1328
-          // No translation in this language, insert translation into locales_target table.
1329
-          db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural);
1330
-          $report['additions']++;
1328
+            // No translation in this language, insert translation into locales_target table.
1329
+            db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural);
1330
+            $report['additions']++;
1331 1331
         }
1332 1332
         else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) {
1333
-          // Translation exists, only overwrite if instructed.
1334
-          db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid);
1335
-          $report['updates']++;
1333
+            // Translation exists, only overwrite if instructed.
1334
+            db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid);
1335
+            $report['updates']++;
1336 1336
         }
1337 1337
         else {
1338
-          $report['skips']++;
1338
+            $report['skips']++;
1339 1339
         }// end if !$exists
1340 1340
 
1341
-      }// while
1341
+        }// while
1342 1342
     }
1343
-  }
1344
-  elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) {
1343
+    }
1344
+    elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) {
1345 1345
     // Loop over db results from locales_source table.
1346 1346
     while ($row = db_fetch_array($resource)) {
1347
-      $lid = $row['lid'];
1348
-      $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1349
-      if ($exists) {
1347
+        $lid = $row['lid'];
1348
+        $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1349
+        if ($exists) {
1350 1350
         // Empty translation, remove existing if instructed.
1351 1351
         db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $langcode, $lid, $plid, $plural);
1352 1352
         $report['deletes']++;
1353
-      }// if $exists
1353
+        }// if $exists
1354 1354
     }// while
1355
-  }
1356
-  else {
1355
+    }
1356
+    else {
1357 1357
     $report['skips']++;
1358
-  }
1358
+    }
1359 1359
 
1360
-  return $lid;
1360
+    return $lid;
1361 1361
 }
1362 1362
 
1363 1363
 
@@ -1366,17 +1366,17 @@  discard block
 block discarded – undo
1366 1366
  * Parse valid resources out of configuration
1367 1367
  */
1368 1368
 function boinctranslate_parse_resources($resource_text) {
1369
-  $resources = array();
1370
-  $resource_array = explode(
1369
+    $resources = array();
1370
+    $resource_array = explode(
1371 1371
     "\n", $resource_text
1372
-  );
1373
-  foreach ($resource_array as $resource) {
1372
+    );
1373
+    foreach ($resource_array as $resource) {
1374 1374
     $resource = trim($resource);
1375 1375
     if ($resource AND $resource[0] != '#') {
1376
-      $resources[] = $resource;
1376
+        $resources[] = $resource;
1377 1377
     }
1378
-  }
1379
-  return $resources;
1378
+    }
1379
+    return $resources;
1380 1380
 }
1381 1381
 
1382 1382
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -1403,5 +1403,5 @@  discard block
 block discarded – undo
1403 1403
  * database.
1404 1404
  */
1405 1405
 function _boinctranslate_supertrim($instr) {
1406
-  return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) );
1406
+    return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) );
1407 1407
 }
Please login to merge, or discard this patch.
Braces   +76 added lines, -125 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
           )
37 37
         ), 'warning'
38 38
       );
39
-    }
40
-    elseif ($response) {
39
+    } elseif ($response) {
41 40
       if (is_array($response)) {
42 41
 
43 42
         $installed_languages = language_list();
@@ -67,8 +66,7 @@  discard block
 block discarded – undo
67 66
                 'Added predefined language: '.$available_languages[$rfc_code][0]
68 67
               );
69 68
               db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code);
70
-            }
71
-            else {
69
+            } else {
72 70
               // Retrieve language details from Transifex
73 71
               $path = "language/{$posix_code}";
74 72
               $response = boinctranslate_transifex_request($path);
@@ -81,8 +79,7 @@  discard block
 block discarded – undo
81 79
                     )
82 80
                   ), 'warning'
83 81
                 );
84
-              }
85
-              elseif ($response) {
82
+              } elseif ($response) {
86 83
                 if (!empty($response['name'])) {
87 84
                   // Add a custom language to Drupal and enable
88 85
                   locale_add_language(
@@ -97,8 +94,7 @@  discard block
 block discarded – undo
97 94
                   drupal_set_message(
98 95
                     'Added new language: '.$response['name']
99 96
                   );
100
-                }
101
-                else {
97
+                } else {
102 98
                   $variables = array(
103 99
                     '%code' => $posix_code,
104 100
                   );
@@ -113,8 +109,7 @@  discard block
 block discarded – undo
113 109
                     WATCHDOG_ERROR
114 110
                   );
115 111
                 }
116
-              }
117
-              else {
112
+              } else {
118 113
                $variables = array(
119 114
                   '%code' => $posix_code,
120 115
                 );
@@ -155,8 +150,7 @@  discard block
 block discarded – undo
155 150
           batch_set($batch);
156 151
           batch_process('admin/boinc/translation');
157 152
         }
158
-      }
159
-      else {
153
+      } else {
160 154
         $variables = array(
161 155
           '%project' => $project_name,
162 156
         );
@@ -171,8 +165,7 @@  discard block
 block discarded – undo
171 165
           WATCHDOG_ERROR
172 166
         );
173 167
       }
174
-    }
175
-    else {
168
+    } else {
176 169
      $variables = array(
177 170
         '%project' => $project_name,
178 171
       );
@@ -229,8 +222,7 @@  discard block
 block discarded – undo
229 222
           'content' => boinctranslate_get_po('en', 'project'),
230 223
         );
231 224
         $result = boinctranslate_transifex_request($path, $post);
232
-      }
233
-      else {
225
+      } else {
234 226
         // Update the source
235 227
         $path = "project/{$project_name}/resource/{$primary_resource}/content";
236 228
         $post = array(
@@ -244,8 +236,7 @@  discard block
 block discarded – undo
244 236
       $enabled_languages = locale_language_list();
245 237
       if ($source_exists) {
246 238
         drupal_set_message('Updated source translation strings at Transifex');
247
-      }
248
-      else {
239
+      } else {
249 240
         drupal_set_message('Established new translation resource at Transifex');
250 241
       }
251 242
       // Try to export translations for all enabled languages
@@ -266,25 +257,21 @@  discard block
 block discarded – undo
266 257
               "Unable to update {$language_name} translations: {$result}",
267 258
               'warning'
268 259
             );
269
-          }
270
-          else {
260
+          } else {
271 261
             drupal_set_message("Updated {$language_name} translations");
272 262
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
273 263
           }
274
-        }
275
-        else {
264
+        } else {
276 265
           drupal_set_message("No translations to export for {$language_name}");
277 266
         }
278 267
       }
279
-    }
280
-    else {
268
+    } else {
281 269
       drupal_set_message(
282 270
         "Unable to update the translation source: {$result}",
283 271
         'warning'
284 272
       );
285 273
     }
286
-  }
287
-  else {
274
+  } else {
288 275
     drupal_set_message(
289 276
       'Failed to export translations: Transifex settings are not intiailized.',
290 277
       'error'
@@ -340,42 +327,35 @@  discard block
 block discarded – undo
340 327
                 "Unable to update {$language_name} official BOINC translations: {$result}",
341 328
                 'warning'
342 329
               );
343
-            }
344
-            elseif ($result == '401 UNAUTHORIZED') {
330
+            } elseif ($result == '401 UNAUTHORIZED') {
345 331
               drupal_set_message(
346 332
                 'Not authorized to update official BOINC translations',
347 333
                 'warning'
348 334
               );
349 335
               break;
350
-            }
351
-            elseif ($result == 'success') {
336
+            } elseif ($result == 'success') {
352 337
               drupal_set_message("Updated {$language_name} official BOINC translations");
353
-            }
354
-            else {
338
+            } else {
355 339
               drupal_set_message(
356 340
                 "Unexpected response for {$language_name}: {$result}",
357 341
                 'warning'
358 342
               );
359 343
             }
360
-          }
361
-          else {
344
+          } else {
362 345
             drupal_set_message("Updated {$language_name} official BOINC translations");
363 346
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
364 347
           }
365
-        }
366
-        else {
348
+        } else {
367 349
           drupal_set_message("No official BOINC translations to export for {$language_name}");
368 350
         }
369 351
       }
370
-    }
371
-    else {
352
+    } else {
372 353
       drupal_set_message(
373 354
         "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex",
374 355
         'warning'
375 356
       );
376 357
     }
377
-  }
378
-  else {
358
+  } else {
379 359
     drupal_set_message(
380 360
       'Failed to export official BOINC translations: Transifex settings are not intiailized.',
381 361
       'error'
@@ -413,13 +393,11 @@  discard block
 block discarded – undo
413 393
     if ($json) {
414 394
       $headers['Content-Type'] = 'application/json';
415 395
       $data = json_encode($post);
416
-    }
417
-    else {
396
+    } else {
418 397
       $data = drupal_query_string_encode($post);
419 398
     }
420 399
     $method = ($use_put) ? 'PUT' : 'POST';
421
-  }
422
-  else {
400
+  } else {
423 401
     $method = 'GET';
424 402
   }
425 403
 
@@ -431,8 +409,7 @@  discard block
 block discarded – undo
431 409
     if ($json) {
432 410
       // Process as JSON
433 411
       return json_decode($response->data, TRUE);
434
-    }
435
-    else {
412
+    } else {
436 413
       return (string) $response->data;
437 414
     }
438 415
     break;
@@ -582,18 +559,15 @@  discard block
 block discarded – undo
582 559
             if ($plural) {
583 560
               $translation = _locale_export_remove_plural($strings[$plural]['translation']);
584 561
               $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0;
585
-            }
586
-            else {
562
+            } else {
587 563
               $translation = '';
588 564
             }
589 565
           }
590
-        }
591
-        else {
566
+        } else {
592 567
           $output .= 'msgstr[0] ""' . "\n";
593 568
           $output .= 'msgstr[1] ""' . "\n";
594 569
         }
595
-      }
596
-      else {
570
+      } else {
597 571
         $output .= 'msgstr ' . _locale_export_string($string['translation']);
598 572
       }
599 573
       $output .= "\n";
@@ -671,8 +645,7 @@  discard block
 block discarded – undo
671 645
               if ($tl0) {
672 646
                 bts($tl0);
673 647
               }
674
-            }
675
-            elseif (count($line)>1) {
648
+            } elseif (count($line)>1) {
676 649
               $tl0 = trim($line[0]);
677 650
               $tl1 = trim($line[1]);
678 651
               if ($tl0 and $tl1) {
@@ -761,8 +734,7 @@  discard block
 block discarded – undo
761 734
 
762 735
     if ($response == '404 NOT FOUND') {
763 736
       $message = "Project resource {$project}:{$resource} not found in {$language}.";
764
-    }
765
-    elseif ($response) {
737
+    } elseif ($response) {
766 738
       if (!empty($response['content'])) {
767 739
         $po_text = $response['content'];
768 740
 
@@ -783,23 +755,19 @@  discard block
 block discarded – undo
783 755
               . " {$project}:{$resource} failed.";
784 756
             $success = FALSE;
785 757
             break;
786
-          }
787
-          else {
758
+          } else {
788 759
             $success = TRUE;
789 760
           }
790 761
         }
791
-      }
792
-      else {
762
+      } else {
793 763
         $message = "Unable to read response for {$language} translation import"
794 764
           . " of {$project}:{$resource}.";
795 765
       }
796
-    }
797
-    else {
766
+    } else {
798 767
       $message = "Translation data not found in response for {$language}"
799 768
         . " translation import of {$project}:{$resource}.";
800 769
     }
801
-  }
802
-  else {
770
+  } else {
803 771
     // If project isn't specified, import as a local Drupal resource
804 772
     $project = 'drupal.local';
805 773
     $file = new stdClass();
@@ -809,8 +777,7 @@  discard block
 block discarded – undo
809 777
       $message = "The {$language} translation import of"
810 778
         . " local file {$resource} failed.";
811 779
       $success = FALSE;
812
-    }
813
-    else {
780
+    } else {
814 781
       $success = TRUE;
815 782
     }
816 783
   }
@@ -828,8 +795,7 @@  discard block
 block discarded – undo
828 795
         WATCHDOG_INFO
829 796
       );
830 797
     }
831
-  }
832
-  else {
798
+  } else {
833 799
     $context['results']['failure'][] = "{$langcode}:{$textgroup}";
834 800
     watchdog(
835 801
       'boinctranslate',
@@ -847,8 +813,7 @@  discard block
 block discarded – undo
847 813
   // Update the progress for the batch engine
848 814
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
849 815
     $context['finished'] = 1;
850
-  }
851
-  else {
816
+  } else {
852 817
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
853 818
   }
854 819
 }
@@ -867,8 +832,7 @@  discard block
 block discarded – undo
867 832
       array('@count' => $count),
868 833
       WATCHDOG_INFO
869 834
     );
870
-  }
871
-  else {
835
+  } else {
872 836
     // An error occurred.
873 837
     // $operations contains the operations that remained unprocessed.
874 838
     $error_operation = reset($operations);
@@ -963,17 +927,19 @@  discard block
 block discarded – undo
963 927
     $lineno++;
964 928
     $line = trim(strtr($line, array("\\\n" => "")));
965 929
 
966
-    if (!strncmp("#", $line, 1)) { // A comment
967
-      if ($context == "COMMENT") { // Already in comment context: add
930
+    if (!strncmp("#", $line, 1)) {
931
+// A comment
932
+      if ($context == "COMMENT") {
933
+// Already in comment context: add
968 934
         $current["#"][] = substr($line, 1);
969
-      }
970
-      elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
935
+      } elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
936
+// End current entry, start a new one
971 937
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
972 938
         $current = array();
973 939
         $current["#"][] = substr($line, 1);
974 940
         $context = "COMMENT";
975
-      }
976
-      else { // Parse error
941
+      } else {
942
+// Parse error
977 943
         watchdog(
978 944
           'boinctranslate',
979 945
           'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.',
@@ -983,13 +949,13 @@  discard block
 block discarded – undo
983 949
         _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno);
984 950
         return FALSE;
985 951
       }
986
-    }
987
-    elseif (!strncmp("msgctxt", $line, 7)) {
988
-      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
952
+    } elseif (!strncmp("msgctxt", $line, 7)) {
953
+      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
954
+// End current entry, start a new one
989 955
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
990 956
         $current = array();
991
-      }
992
-      elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error
957
+      } elseif (($context == "MSGID") || ($context == "MSGCTXT")) {
958
+// Already in this context? Parse error
993 959
         watchdog(
994 960
           'boinctranslate',
995 961
           'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.',
@@ -1013,9 +979,9 @@  discard block
 block discarded – undo
1013 979
       }
1014 980
       $current["msgctxt"] = $quoted;
1015 981
       $context = "MSGCTXT";
1016
-    }
1017
-    elseif (!strncmp("msgid_plural", $line, 12)) {
1018
-      if ($context != "MSGID") { // Must be plural form for current entry
982
+    } elseif (!strncmp("msgid_plural", $line, 12)) {
983
+      if ($context != "MSGID") {
984
+// Must be plural form for current entry
1019 985
         watchdog(
1020 986
           'boinctranslate',
1021 987
           'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.',
@@ -1039,13 +1005,13 @@  discard block
 block discarded – undo
1039 1005
       }
1040 1006
       $current["msgid"] = $current["msgid"] . "\0" . $quoted;
1041 1007
       $context = "MSGID_PLURAL";
1042
-    }
1043
-    elseif (!strncmp("msgid", $line, 5)) {
1044
-      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
1008
+    } elseif (!strncmp("msgid", $line, 5)) {
1009
+      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
1010
+// End current entry, start a new one
1045 1011
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
1046 1012
         $current = array();
1047
-      }
1048
-      elseif ($context == "MSGID") { // Already in this context? Parse error
1013
+      } elseif ($context == "MSGID") {
1014
+// Already in this context? Parse error
1049 1015
         watchdog(
1050 1016
           'boinctranslate',
1051 1017
           'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.',
@@ -1069,9 +1035,9 @@  discard block
 block discarded – undo
1069 1035
       }
1070 1036
       $current["msgid"] = $quoted;
1071 1037
       $context = "MSGID";
1072
-    }
1073
-    elseif (!strncmp("msgstr[", $line, 7)) {
1074
-      if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[]
1038
+    } elseif (!strncmp("msgstr[", $line, 7)) {
1039
+      if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) {
1040
+// Must come after msgid, msgid_plural, or msgstr[]
1075 1041
         watchdog(
1076 1042
           'boinctranslate',
1077 1043
           'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.',
@@ -1107,9 +1073,9 @@  discard block
 block discarded – undo
1107 1073
       }
1108 1074
       $current["msgstr"][$plural] = $quoted;
1109 1075
       $context = "MSGSTR_ARR";
1110
-    }
1111
-    elseif (!strncmp("msgstr", $line, 6)) {
1112
-      if ($context != "MSGID") { // Should come just after a msgid block
1076
+    } elseif (!strncmp("msgstr", $line, 6)) {
1077
+      if ($context != "MSGID") {
1078
+// Should come just after a msgid block
1113 1079
         watchdog(
1114 1080
           'boinctranslate',
1115 1081
           'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.',
@@ -1133,8 +1099,7 @@  discard block
 block discarded – undo
1133 1099
       }
1134 1100
       $current["msgstr"] = $quoted;
1135 1101
       $context = "MSGSTR";
1136
-    }
1137
-    elseif ($line != "") {
1102
+    } elseif ($line != "") {
1138 1103
       $quoted = _locale_import_parse_quoted($line);
1139 1104
       if ($quoted === FALSE) {
1140 1105
         watchdog(
@@ -1148,14 +1113,11 @@  discard block
 block discarded – undo
1148 1113
       }
1149 1114
       if (($context == "MSGID") || ($context == "MSGID_PLURAL")) {
1150 1115
         $current["msgid"] .= $quoted;
1151
-      }
1152
-      elseif ($context == "MSGSTR") {
1116
+      } elseif ($context == "MSGSTR") {
1153 1117
         $current["msgstr"] .= $quoted;
1154
-      }
1155
-      elseif ($context == "MSGSTR_ARR") {
1118
+      } elseif ($context == "MSGSTR_ARR") {
1156 1119
         $current["msgstr"][$plural] .= $quoted;
1157
-      }
1158
-      else {
1120
+      } else {
1159 1121
         watchdog(
1160 1122
           'boinctranslate',
1161 1123
           'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.',
@@ -1171,8 +1133,7 @@  discard block
 block discarded – undo
1171 1133
   // End of PO file, flush last entry
1172 1134
   if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
1173 1135
     _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
1174
-  }
1175
-  elseif ($context != "COMMENT") {
1136
+  } elseif ($context != "COMMENT") {
1176 1137
     watchdog(
1177 1138
       'boinctranslate',
1178 1139
       'The translation file %filename for %lang ended unexpectedly at line %line.',
@@ -1239,9 +1200,7 @@  discard block
 block discarded – undo
1239 1200
           }
1240 1201
         }
1241 1202
         $headerdone = TRUE;
1242
-      }
1243
-
1244
-      else {
1203
+      } else {
1245 1204
         // Some real string to import.
1246 1205
         $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
1247 1206
 
@@ -1260,9 +1219,7 @@  discard block
 block discarded – undo
1260 1219
             }
1261 1220
             $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
1262 1221
           }
1263
-        }
1264
-
1265
-        else {
1222
+        } else {
1266 1223
           // A simple string to import.
1267 1224
           $english = $value['msgid'];
1268 1225
           $translation = $value['msgstr'];
@@ -1293,8 +1250,7 @@  discard block
 block discarded – undo
1293 1250
   $uselocation = array("boinc", "project");
1294 1251
   if (in_array($textgroup, $uselocation)) {
1295 1252
     $resource = db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s' AND textgroup = '%s'", $location, $source, $textgroup);
1296
-  }
1297
-  else {
1253
+  } else {
1298 1254
     $resource = db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup);
1299 1255
 
1300 1256
     // Parse the location string for the string ignoreoverwrite, which
@@ -1316,8 +1272,7 @@  discard block
 block discarded – undo
1316 1272
     if ($textgroup == "default" && !locale_string_is_safe($translation)) {
1317 1273
       $report['skips']++;
1318 1274
       $lid = 0;
1319
-    }
1320
-    elseif ($resource) {
1275
+    } elseif ($resource) {
1321 1276
       // We have this source string saved already. Loop over the db results from locales_source table.
1322 1277
       while ($row = db_fetch_array($resource)) {
1323 1278
 
@@ -1328,20 +1283,17 @@  discard block
 block discarded – undo
1328 1283
           // No translation in this language, insert translation into locales_target table.
1329 1284
           db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural);
1330 1285
           $report['additions']++;
1331
-        }
1332
-        else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) {
1286
+        } else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) {
1333 1287
           // Translation exists, only overwrite if instructed.
1334 1288
           db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid);
1335 1289
           $report['updates']++;
1336
-        }
1337
-        else {
1290
+        } else {
1338 1291
           $report['skips']++;
1339 1292
         }// end if !$exists
1340 1293
 
1341 1294
       }// while
1342 1295
     }
1343
-  }
1344
-  elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) {
1296
+  } elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) {
1345 1297
     // Loop over db results from locales_source table.
1346 1298
     while ($row = db_fetch_array($resource)) {
1347 1299
       $lid = $row['lid'];
@@ -1352,8 +1304,7 @@  discard block
 block discarded – undo
1352 1304
         $report['deletes']++;
1353 1305
       }// if $exists
1354 1306
     }// while
1355
-  }
1356
-  else {
1307
+  } else {
1357 1308
     $report['skips']++;
1358 1309
   }
1359 1310
 
Please login to merge, or discard this patch.