@@ -41,7 +41,7 @@ discard block |
||
| 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 |
||
| 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&pic=-1\">", "</a>", |
| 65 | 65 | "<a href=\"?cmd=rand&pic=1\">", "<a href=\"?cmd=rand&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 |
||
| 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 | ?> |
@@ -219,8 +219,8 @@ |
||
| 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>"; |
@@ -31,10 +31,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,10 +173,10 @@ discard block |
||
| 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 | show_thread_and_context_header(); |
| 179 | - foreach ($threads as $thread){ |
|
| 179 | + foreach ($threads as $thread) { |
|
| 180 | 180 | if ($thread->hidden) continue; |
| 181 | 181 | show_thread_and_context($thread, $logged_in_user); |
| 182 | 182 | } |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | $show_hidden_posts |
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | -if (count($posts)){ |
|
| 196 | - echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
|
| 195 | +if (count($posts)) { |
|
| 196 | + echo "<h3>".tra("Messages matching your query:")."</h3>"; |
|
| 197 | 197 | start_table(); |
| 198 | 198 | $n = 1; |
| 199 | 199 | $options = get_output_options($logged_in_user); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | end_table(); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | -if (!count($threads) && !count($posts)){ |
|
| 218 | +if (!count($threads) && !count($posts)) { |
|
| 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", |
@@ -226,5 +226,5 @@ discard block |
||
| 226 | 226 | echo "<p><a href=\"forum_search.php\">".tra("Perform another search")."</a></p>"; |
| 227 | 227 | page_tail(); |
| 228 | 228 | |
| 229 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 229 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 230 | 230 | ?> |
@@ -33,7 +33,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,10 +173,10 @@ discard block |
||
| 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 | show_thread_and_context_header(); |
| 179 | - foreach ($threads as $thread){ |
|
| 179 | + foreach ($threads as $thread) { |
|
| 180 | 180 | if ($thread->hidden) continue; |
| 181 | 181 | show_thread_and_context($thread, $logged_in_user); |
| 182 | 182 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $show_hidden_posts |
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | -if (count($posts)){ |
|
| 195 | +if (count($posts)) { |
|
| 196 | 196 | echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
| 197 | 197 | start_table(); |
| 198 | 198 | $n = 1; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | end_table(); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | -if (!count($threads) && !count($posts)){ |
|
| 218 | +if (!count($threads) && !count($posts)) { |
|
| 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", |
@@ -387,8 +387,7 @@ |
||
| 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>'; |
@@ -25,29 +25,29 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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>'; |
@@ -153,7 +153,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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>'; |
@@ -136,8 +136,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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( |
@@ -28,7 +28,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -169,7 +169,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -1398,72 +1398,72 @@ |
||
| 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 | |
@@ -44,7 +44,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -15,30 +15,30 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -36,8 +36,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 1352 | 1304 | $report['deletes']++; |
| 1353 | 1305 | }// if $exists |
| 1354 | 1306 | }// while |
| 1355 | - } |
|
| 1356 | - else { |
|
| 1307 | + } else { |
|
| 1357 | 1308 | $report['skips']++; |
| 1358 | 1309 | } |
| 1359 | 1310 | |
@@ -4,86 +4,86 @@ |
||
| 4 | 4 | * Implementation of hook_strongarm(). |
| 5 | 5 | */ |
| 6 | 6 | function teams_strongarm() { |
| 7 | - $export = array(); |
|
| 7 | + $export = array(); |
|
| 8 | 8 | |
| 9 | - $strongarm = new stdClass; |
|
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | - $strongarm->api_version = 1; |
|
| 12 | - $strongarm->name = 'comment_anonymous_team'; |
|
| 13 | - $strongarm->value = 0; |
|
| 14 | - $export['comment_anonymous_team'] = $strongarm; |
|
| 9 | + $strongarm = new stdClass; |
|
| 10 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | + $strongarm->api_version = 1; |
|
| 12 | + $strongarm->name = 'comment_anonymous_team'; |
|
| 13 | + $strongarm->value = 0; |
|
| 14 | + $export['comment_anonymous_team'] = $strongarm; |
|
| 15 | 15 | |
| 16 | - $strongarm = new stdClass; |
|
| 17 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | - $strongarm->api_version = 1; |
|
| 19 | - $strongarm->name = 'comment_controls_team'; |
|
| 20 | - $strongarm->value = '3'; |
|
| 21 | - $export['comment_controls_team'] = $strongarm; |
|
| 16 | + $strongarm = new stdClass; |
|
| 17 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | + $strongarm->api_version = 1; |
|
| 19 | + $strongarm->name = 'comment_controls_team'; |
|
| 20 | + $strongarm->value = '3'; |
|
| 21 | + $export['comment_controls_team'] = $strongarm; |
|
| 22 | 22 | |
| 23 | - $strongarm = new stdClass; |
|
| 24 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | - $strongarm->api_version = 1; |
|
| 26 | - $strongarm->name = 'comment_default_mode_team'; |
|
| 27 | - $strongarm->value = '4'; |
|
| 28 | - $export['comment_default_mode_team'] = $strongarm; |
|
| 23 | + $strongarm = new stdClass; |
|
| 24 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | + $strongarm->api_version = 1; |
|
| 26 | + $strongarm->name = 'comment_default_mode_team'; |
|
| 27 | + $strongarm->value = '4'; |
|
| 28 | + $export['comment_default_mode_team'] = $strongarm; |
|
| 29 | 29 | |
| 30 | - $strongarm = new stdClass; |
|
| 31 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | - $strongarm->api_version = 1; |
|
| 33 | - $strongarm->name = 'comment_default_order_team'; |
|
| 34 | - $strongarm->value = '1'; |
|
| 35 | - $export['comment_default_order_team'] = $strongarm; |
|
| 30 | + $strongarm = new stdClass; |
|
| 31 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | + $strongarm->api_version = 1; |
|
| 33 | + $strongarm->name = 'comment_default_order_team'; |
|
| 34 | + $strongarm->value = '1'; |
|
| 35 | + $export['comment_default_order_team'] = $strongarm; |
|
| 36 | 36 | |
| 37 | - $strongarm = new stdClass; |
|
| 38 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | - $strongarm->api_version = 1; |
|
| 40 | - $strongarm->name = 'comment_default_per_page_team'; |
|
| 41 | - $strongarm->value = '50'; |
|
| 42 | - $export['comment_default_per_page_team'] = $strongarm; |
|
| 37 | + $strongarm = new stdClass; |
|
| 38 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | + $strongarm->api_version = 1; |
|
| 40 | + $strongarm->name = 'comment_default_per_page_team'; |
|
| 41 | + $strongarm->value = '50'; |
|
| 42 | + $export['comment_default_per_page_team'] = $strongarm; |
|
| 43 | 43 | |
| 44 | - $strongarm = new stdClass; |
|
| 45 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | - $strongarm->api_version = 1; |
|
| 47 | - $strongarm->name = 'comment_form_location_team'; |
|
| 48 | - $strongarm->value = '0'; |
|
| 49 | - $export['comment_form_location_team'] = $strongarm; |
|
| 44 | + $strongarm = new stdClass; |
|
| 45 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | + $strongarm->api_version = 1; |
|
| 47 | + $strongarm->name = 'comment_form_location_team'; |
|
| 48 | + $strongarm->value = '0'; |
|
| 49 | + $export['comment_form_location_team'] = $strongarm; |
|
| 50 | 50 | |
| 51 | - $strongarm = new stdClass; |
|
| 52 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | - $strongarm->api_version = 1; |
|
| 54 | - $strongarm->name = 'comment_preview_team'; |
|
| 55 | - $strongarm->value = '1'; |
|
| 56 | - $export['comment_preview_team'] = $strongarm; |
|
| 51 | + $strongarm = new stdClass; |
|
| 52 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | + $strongarm->api_version = 1; |
|
| 54 | + $strongarm->name = 'comment_preview_team'; |
|
| 55 | + $strongarm->value = '1'; |
|
| 56 | + $export['comment_preview_team'] = $strongarm; |
|
| 57 | 57 | |
| 58 | - $strongarm = new stdClass; |
|
| 59 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | - $strongarm->api_version = 1; |
|
| 61 | - $strongarm->name = 'comment_subject_field_team'; |
|
| 62 | - $strongarm->value = '1'; |
|
| 63 | - $export['comment_subject_field_team'] = $strongarm; |
|
| 58 | + $strongarm = new stdClass; |
|
| 59 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | + $strongarm->api_version = 1; |
|
| 61 | + $strongarm->name = 'comment_subject_field_team'; |
|
| 62 | + $strongarm->value = '1'; |
|
| 63 | + $export['comment_subject_field_team'] = $strongarm; |
|
| 64 | 64 | |
| 65 | - $strongarm = new stdClass; |
|
| 66 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | - $strongarm->api_version = 1; |
|
| 68 | - $strongarm->name = 'comment_team'; |
|
| 69 | - $strongarm->value = '0'; |
|
| 70 | - $export['comment_team'] = $strongarm; |
|
| 65 | + $strongarm = new stdClass; |
|
| 66 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | + $strongarm->api_version = 1; |
|
| 68 | + $strongarm->name = 'comment_team'; |
|
| 69 | + $strongarm->value = '0'; |
|
| 70 | + $export['comment_team'] = $strongarm; |
|
| 71 | 71 | |
| 72 | - $strongarm = new stdClass; |
|
| 73 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | - $strongarm->api_version = 1; |
|
| 75 | - $strongarm->name = 'node_options_team'; |
|
| 76 | - $strongarm->value = array( |
|
| 72 | + $strongarm = new stdClass; |
|
| 73 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | + $strongarm->api_version = 1; |
|
| 75 | + $strongarm->name = 'node_options_team'; |
|
| 76 | + $strongarm->value = array( |
|
| 77 | 77 | 0 => 'status', |
| 78 | - ); |
|
| 79 | - $export['node_options_team'] = $strongarm; |
|
| 78 | + ); |
|
| 79 | + $export['node_options_team'] = $strongarm; |
|
| 80 | 80 | |
| 81 | - $strongarm = new stdClass; |
|
| 82 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 83 | - $strongarm->api_version = 1; |
|
| 84 | - $strongarm->name = 'upload_team'; |
|
| 85 | - $strongarm->value = '0'; |
|
| 86 | - $export['upload_team'] = $strongarm; |
|
| 81 | + $strongarm = new stdClass; |
|
| 82 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 83 | + $strongarm->api_version = 1; |
|
| 84 | + $strongarm->name = 'upload_team'; |
|
| 85 | + $strongarm->value = '0'; |
|
| 86 | + $export['upload_team'] = $strongarm; |
|
| 87 | 87 | |
| 88 | - return $export; |
|
| 88 | + return $export; |
|
| 89 | 89 | } |
@@ -7,70 +7,70 @@ discard block |
||
| 7 | 7 | $export = array(); |
| 8 | 8 | |
| 9 | 9 | $strongarm = new stdClass; |
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 10 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | 11 | $strongarm->api_version = 1; |
| 12 | 12 | $strongarm->name = 'comment_anonymous_team'; |
| 13 | 13 | $strongarm->value = 0; |
| 14 | 14 | $export['comment_anonymous_team'] = $strongarm; |
| 15 | 15 | |
| 16 | 16 | $strongarm = new stdClass; |
| 17 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 17 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | 18 | $strongarm->api_version = 1; |
| 19 | 19 | $strongarm->name = 'comment_controls_team'; |
| 20 | 20 | $strongarm->value = '3'; |
| 21 | 21 | $export['comment_controls_team'] = $strongarm; |
| 22 | 22 | |
| 23 | 23 | $strongarm = new stdClass; |
| 24 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 24 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | 25 | $strongarm->api_version = 1; |
| 26 | 26 | $strongarm->name = 'comment_default_mode_team'; |
| 27 | 27 | $strongarm->value = '4'; |
| 28 | 28 | $export['comment_default_mode_team'] = $strongarm; |
| 29 | 29 | |
| 30 | 30 | $strongarm = new stdClass; |
| 31 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 31 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | 32 | $strongarm->api_version = 1; |
| 33 | 33 | $strongarm->name = 'comment_default_order_team'; |
| 34 | 34 | $strongarm->value = '1'; |
| 35 | 35 | $export['comment_default_order_team'] = $strongarm; |
| 36 | 36 | |
| 37 | 37 | $strongarm = new stdClass; |
| 38 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 38 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | 39 | $strongarm->api_version = 1; |
| 40 | 40 | $strongarm->name = 'comment_default_per_page_team'; |
| 41 | 41 | $strongarm->value = '50'; |
| 42 | 42 | $export['comment_default_per_page_team'] = $strongarm; |
| 43 | 43 | |
| 44 | 44 | $strongarm = new stdClass; |
| 45 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 45 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | 46 | $strongarm->api_version = 1; |
| 47 | 47 | $strongarm->name = 'comment_form_location_team'; |
| 48 | 48 | $strongarm->value = '0'; |
| 49 | 49 | $export['comment_form_location_team'] = $strongarm; |
| 50 | 50 | |
| 51 | 51 | $strongarm = new stdClass; |
| 52 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 52 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | 53 | $strongarm->api_version = 1; |
| 54 | 54 | $strongarm->name = 'comment_preview_team'; |
| 55 | 55 | $strongarm->value = '1'; |
| 56 | 56 | $export['comment_preview_team'] = $strongarm; |
| 57 | 57 | |
| 58 | 58 | $strongarm = new stdClass; |
| 59 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 59 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | 60 | $strongarm->api_version = 1; |
| 61 | 61 | $strongarm->name = 'comment_subject_field_team'; |
| 62 | 62 | $strongarm->value = '1'; |
| 63 | 63 | $export['comment_subject_field_team'] = $strongarm; |
| 64 | 64 | |
| 65 | 65 | $strongarm = new stdClass; |
| 66 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 66 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | 67 | $strongarm->api_version = 1; |
| 68 | 68 | $strongarm->name = 'comment_team'; |
| 69 | 69 | $strongarm->value = '0'; |
| 70 | 70 | $export['comment_team'] = $strongarm; |
| 71 | 71 | |
| 72 | 72 | $strongarm = new stdClass; |
| 73 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 73 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | 74 | $strongarm->api_version = 1; |
| 75 | 75 | $strongarm->name = 'node_options_team'; |
| 76 | 76 | $strongarm->value = array( |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $export['node_options_team'] = $strongarm; |
| 80 | 80 | |
| 81 | 81 | $strongarm = new stdClass; |
| 82 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 82 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 83 | 83 | $strongarm->api_version = 1; |
| 84 | 84 | $strongarm->name = 'upload_team'; |
| 85 | 85 | $strongarm->value = '0'; |
@@ -4,93 +4,93 @@ |
||
| 4 | 4 | * Implementation of hook_strongarm(). |
| 5 | 5 | */ |
| 6 | 6 | function team_forums_strongarm() { |
| 7 | - $export = array(); |
|
| 7 | + $export = array(); |
|
| 8 | 8 | |
| 9 | - $strongarm = new stdClass; |
|
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | - $strongarm->api_version = 1; |
|
| 12 | - $strongarm->name = 'comment_anonymous_team_forum'; |
|
| 13 | - $strongarm->value = 0; |
|
| 14 | - $export['comment_anonymous_team_forum'] = $strongarm; |
|
| 9 | + $strongarm = new stdClass; |
|
| 10 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | + $strongarm->api_version = 1; |
|
| 12 | + $strongarm->name = 'comment_anonymous_team_forum'; |
|
| 13 | + $strongarm->value = 0; |
|
| 14 | + $export['comment_anonymous_team_forum'] = $strongarm; |
|
| 15 | 15 | |
| 16 | - $strongarm = new stdClass; |
|
| 17 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | - $strongarm->api_version = 1; |
|
| 19 | - $strongarm->name = 'comment_controls_team_forum'; |
|
| 20 | - $strongarm->value = '1'; |
|
| 21 | - $export['comment_controls_team_forum'] = $strongarm; |
|
| 16 | + $strongarm = new stdClass; |
|
| 17 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | + $strongarm->api_version = 1; |
|
| 19 | + $strongarm->name = 'comment_controls_team_forum'; |
|
| 20 | + $strongarm->value = '1'; |
|
| 21 | + $export['comment_controls_team_forum'] = $strongarm; |
|
| 22 | 22 | |
| 23 | - $strongarm = new stdClass; |
|
| 24 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | - $strongarm->api_version = 1; |
|
| 26 | - $strongarm->name = 'comment_default_mode_team_forum'; |
|
| 27 | - $strongarm->value = '2'; |
|
| 28 | - $export['comment_default_mode_team_forum'] = $strongarm; |
|
| 23 | + $strongarm = new stdClass; |
|
| 24 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | + $strongarm->api_version = 1; |
|
| 26 | + $strongarm->name = 'comment_default_mode_team_forum'; |
|
| 27 | + $strongarm->value = '2'; |
|
| 28 | + $export['comment_default_mode_team_forum'] = $strongarm; |
|
| 29 | 29 | |
| 30 | - $strongarm = new stdClass; |
|
| 31 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | - $strongarm->api_version = 1; |
|
| 33 | - $strongarm->name = 'comment_default_order_team_forum'; |
|
| 34 | - $strongarm->value = '2'; |
|
| 35 | - $export['comment_default_order_team_forum'] = $strongarm; |
|
| 30 | + $strongarm = new stdClass; |
|
| 31 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | + $strongarm->api_version = 1; |
|
| 33 | + $strongarm->name = 'comment_default_order_team_forum'; |
|
| 34 | + $strongarm->value = '2'; |
|
| 35 | + $export['comment_default_order_team_forum'] = $strongarm; |
|
| 36 | 36 | |
| 37 | - $strongarm = new stdClass; |
|
| 38 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | - $strongarm->api_version = 1; |
|
| 40 | - $strongarm->name = 'comment_default_per_page_team_forum'; |
|
| 41 | - $strongarm->value = '50'; |
|
| 42 | - $export['comment_default_per_page_team_forum'] = $strongarm; |
|
| 37 | + $strongarm = new stdClass; |
|
| 38 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | + $strongarm->api_version = 1; |
|
| 40 | + $strongarm->name = 'comment_default_per_page_team_forum'; |
|
| 41 | + $strongarm->value = '50'; |
|
| 42 | + $export['comment_default_per_page_team_forum'] = $strongarm; |
|
| 43 | 43 | |
| 44 | - $strongarm = new stdClass; |
|
| 45 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | - $strongarm->api_version = 1; |
|
| 47 | - $strongarm->name = 'comment_form_location_team_forum'; |
|
| 48 | - $strongarm->value = '0'; |
|
| 49 | - $export['comment_form_location_team_forum'] = $strongarm; |
|
| 44 | + $strongarm = new stdClass; |
|
| 45 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | + $strongarm->api_version = 1; |
|
| 47 | + $strongarm->name = 'comment_form_location_team_forum'; |
|
| 48 | + $strongarm->value = '0'; |
|
| 49 | + $export['comment_form_location_team_forum'] = $strongarm; |
|
| 50 | 50 | |
| 51 | - $strongarm = new stdClass; |
|
| 52 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | - $strongarm->api_version = 1; |
|
| 54 | - $strongarm->name = 'comment_preview_team_forum'; |
|
| 55 | - $strongarm->value = '0'; |
|
| 56 | - $export['comment_preview_team_forum'] = $strongarm; |
|
| 51 | + $strongarm = new stdClass; |
|
| 52 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | + $strongarm->api_version = 1; |
|
| 54 | + $strongarm->name = 'comment_preview_team_forum'; |
|
| 55 | + $strongarm->value = '0'; |
|
| 56 | + $export['comment_preview_team_forum'] = $strongarm; |
|
| 57 | 57 | |
| 58 | - $strongarm = new stdClass; |
|
| 59 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | - $strongarm->api_version = 1; |
|
| 61 | - $strongarm->name = 'comment_subject_field_team_forum'; |
|
| 62 | - $strongarm->value = '1'; |
|
| 63 | - $export['comment_subject_field_team_forum'] = $strongarm; |
|
| 58 | + $strongarm = new stdClass; |
|
| 59 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | + $strongarm->api_version = 1; |
|
| 61 | + $strongarm->name = 'comment_subject_field_team_forum'; |
|
| 62 | + $strongarm->value = '1'; |
|
| 63 | + $export['comment_subject_field_team_forum'] = $strongarm; |
|
| 64 | 64 | |
| 65 | - $strongarm = new stdClass; |
|
| 66 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | - $strongarm->api_version = 1; |
|
| 68 | - $strongarm->name = 'comment_team_forum'; |
|
| 69 | - $strongarm->value = '2'; |
|
| 70 | - $export['comment_team_forum'] = $strongarm; |
|
| 65 | + $strongarm = new stdClass; |
|
| 66 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | + $strongarm->api_version = 1; |
|
| 68 | + $strongarm->name = 'comment_team_forum'; |
|
| 69 | + $strongarm->value = '2'; |
|
| 70 | + $export['comment_team_forum'] = $strongarm; |
|
| 71 | 71 | |
| 72 | - $strongarm = new stdClass; |
|
| 73 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | - $strongarm->api_version = 1; |
|
| 75 | - $strongarm->name = 'language_content_type_team_forum'; |
|
| 76 | - $strongarm->value = '0'; |
|
| 77 | - $export['language_content_type_team_forum'] = $strongarm; |
|
| 72 | + $strongarm = new stdClass; |
|
| 73 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | + $strongarm->api_version = 1; |
|
| 75 | + $strongarm->name = 'language_content_type_team_forum'; |
|
| 76 | + $strongarm->value = '0'; |
|
| 77 | + $export['language_content_type_team_forum'] = $strongarm; |
|
| 78 | 78 | |
| 79 | - $strongarm = new stdClass; |
|
| 80 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 81 | - $strongarm->api_version = 1; |
|
| 82 | - $strongarm->name = 'node_options_team_forum'; |
|
| 83 | - $strongarm->value = array( |
|
| 79 | + $strongarm = new stdClass; |
|
| 80 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 81 | + $strongarm->api_version = 1; |
|
| 82 | + $strongarm->name = 'node_options_team_forum'; |
|
| 83 | + $strongarm->value = array( |
|
| 84 | 84 | 0 => 'status', |
| 85 | - ); |
|
| 86 | - $export['node_options_team_forum'] = $strongarm; |
|
| 85 | + ); |
|
| 86 | + $export['node_options_team_forum'] = $strongarm; |
|
| 87 | 87 | |
| 88 | - $strongarm = new stdClass; |
|
| 89 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 90 | - $strongarm->api_version = 1; |
|
| 91 | - $strongarm->name = 'upload_team_forum'; |
|
| 92 | - $strongarm->value = '0'; |
|
| 93 | - $export['upload_team_forum'] = $strongarm; |
|
| 88 | + $strongarm = new stdClass; |
|
| 89 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 90 | + $strongarm->api_version = 1; |
|
| 91 | + $strongarm->name = 'upload_team_forum'; |
|
| 92 | + $strongarm->value = '0'; |
|
| 93 | + $export['upload_team_forum'] = $strongarm; |
|
| 94 | 94 | |
| 95 | - return $export; |
|
| 95 | + return $export; |
|
| 96 | 96 | } |
@@ -7,77 +7,77 @@ discard block |
||
| 7 | 7 | $export = array(); |
| 8 | 8 | |
| 9 | 9 | $strongarm = new stdClass; |
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 10 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | 11 | $strongarm->api_version = 1; |
| 12 | 12 | $strongarm->name = 'comment_anonymous_team_forum'; |
| 13 | 13 | $strongarm->value = 0; |
| 14 | 14 | $export['comment_anonymous_team_forum'] = $strongarm; |
| 15 | 15 | |
| 16 | 16 | $strongarm = new stdClass; |
| 17 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 17 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | 18 | $strongarm->api_version = 1; |
| 19 | 19 | $strongarm->name = 'comment_controls_team_forum'; |
| 20 | 20 | $strongarm->value = '1'; |
| 21 | 21 | $export['comment_controls_team_forum'] = $strongarm; |
| 22 | 22 | |
| 23 | 23 | $strongarm = new stdClass; |
| 24 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 24 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | 25 | $strongarm->api_version = 1; |
| 26 | 26 | $strongarm->name = 'comment_default_mode_team_forum'; |
| 27 | 27 | $strongarm->value = '2'; |
| 28 | 28 | $export['comment_default_mode_team_forum'] = $strongarm; |
| 29 | 29 | |
| 30 | 30 | $strongarm = new stdClass; |
| 31 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 31 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | 32 | $strongarm->api_version = 1; |
| 33 | 33 | $strongarm->name = 'comment_default_order_team_forum'; |
| 34 | 34 | $strongarm->value = '2'; |
| 35 | 35 | $export['comment_default_order_team_forum'] = $strongarm; |
| 36 | 36 | |
| 37 | 37 | $strongarm = new stdClass; |
| 38 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 38 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | 39 | $strongarm->api_version = 1; |
| 40 | 40 | $strongarm->name = 'comment_default_per_page_team_forum'; |
| 41 | 41 | $strongarm->value = '50'; |
| 42 | 42 | $export['comment_default_per_page_team_forum'] = $strongarm; |
| 43 | 43 | |
| 44 | 44 | $strongarm = new stdClass; |
| 45 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 45 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | 46 | $strongarm->api_version = 1; |
| 47 | 47 | $strongarm->name = 'comment_form_location_team_forum'; |
| 48 | 48 | $strongarm->value = '0'; |
| 49 | 49 | $export['comment_form_location_team_forum'] = $strongarm; |
| 50 | 50 | |
| 51 | 51 | $strongarm = new stdClass; |
| 52 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 52 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | 53 | $strongarm->api_version = 1; |
| 54 | 54 | $strongarm->name = 'comment_preview_team_forum'; |
| 55 | 55 | $strongarm->value = '0'; |
| 56 | 56 | $export['comment_preview_team_forum'] = $strongarm; |
| 57 | 57 | |
| 58 | 58 | $strongarm = new stdClass; |
| 59 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 59 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | 60 | $strongarm->api_version = 1; |
| 61 | 61 | $strongarm->name = 'comment_subject_field_team_forum'; |
| 62 | 62 | $strongarm->value = '1'; |
| 63 | 63 | $export['comment_subject_field_team_forum'] = $strongarm; |
| 64 | 64 | |
| 65 | 65 | $strongarm = new stdClass; |
| 66 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 66 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | 67 | $strongarm->api_version = 1; |
| 68 | 68 | $strongarm->name = 'comment_team_forum'; |
| 69 | 69 | $strongarm->value = '2'; |
| 70 | 70 | $export['comment_team_forum'] = $strongarm; |
| 71 | 71 | |
| 72 | 72 | $strongarm = new stdClass; |
| 73 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 73 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | 74 | $strongarm->api_version = 1; |
| 75 | 75 | $strongarm->name = 'language_content_type_team_forum'; |
| 76 | 76 | $strongarm->value = '0'; |
| 77 | 77 | $export['language_content_type_team_forum'] = $strongarm; |
| 78 | 78 | |
| 79 | 79 | $strongarm = new stdClass; |
| 80 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 80 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 81 | 81 | $strongarm->api_version = 1; |
| 82 | 82 | $strongarm->name = 'node_options_team_forum'; |
| 83 | 83 | $strongarm->value = array( |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $export['node_options_team_forum'] = $strongarm; |
| 87 | 87 | |
| 88 | 88 | $strongarm = new stdClass; |
| 89 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 89 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 90 | 90 | $strongarm->api_version = 1; |
| 91 | 91 | $strongarm->name = 'upload_team_forum'; |
| 92 | 92 | $strongarm->value = '0'; |
@@ -4,76 +4,76 @@ discard block |
||
| 4 | 4 | * Implementation of hook_strongarm(). |
| 5 | 5 | */ |
| 6 | 6 | function user_profiles_strongarm() { |
| 7 | - $export = array(); |
|
| 8 | - |
|
| 9 | - $strongarm = new stdClass; |
|
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | - $strongarm->api_version = 1; |
|
| 12 | - $strongarm->name = 'comment_anonymous_profile'; |
|
| 13 | - $strongarm->value = 0; |
|
| 14 | - $export['comment_anonymous_profile'] = $strongarm; |
|
| 15 | - |
|
| 16 | - $strongarm = new stdClass; |
|
| 17 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | - $strongarm->api_version = 1; |
|
| 19 | - $strongarm->name = 'comment_controls_profile'; |
|
| 20 | - $strongarm->value = '3'; |
|
| 21 | - $export['comment_controls_profile'] = $strongarm; |
|
| 22 | - |
|
| 23 | - $strongarm = new stdClass; |
|
| 24 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | - $strongarm->api_version = 1; |
|
| 26 | - $strongarm->name = 'comment_default_mode_profile'; |
|
| 27 | - $strongarm->value = '4'; |
|
| 28 | - $export['comment_default_mode_profile'] = $strongarm; |
|
| 29 | - |
|
| 30 | - $strongarm = new stdClass; |
|
| 31 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | - $strongarm->api_version = 1; |
|
| 33 | - $strongarm->name = 'comment_default_order_profile'; |
|
| 34 | - $strongarm->value = '1'; |
|
| 35 | - $export['comment_default_order_profile'] = $strongarm; |
|
| 36 | - |
|
| 37 | - $strongarm = new stdClass; |
|
| 38 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | - $strongarm->api_version = 1; |
|
| 40 | - $strongarm->name = 'comment_default_per_page_profile'; |
|
| 41 | - $strongarm->value = '50'; |
|
| 42 | - $export['comment_default_per_page_profile'] = $strongarm; |
|
| 43 | - |
|
| 44 | - $strongarm = new stdClass; |
|
| 45 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | - $strongarm->api_version = 1; |
|
| 47 | - $strongarm->name = 'comment_form_location_profile'; |
|
| 48 | - $strongarm->value = '0'; |
|
| 49 | - $export['comment_form_location_profile'] = $strongarm; |
|
| 50 | - |
|
| 51 | - $strongarm = new stdClass; |
|
| 52 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | - $strongarm->api_version = 1; |
|
| 54 | - $strongarm->name = 'comment_preview_profile'; |
|
| 55 | - $strongarm->value = '1'; |
|
| 56 | - $export['comment_preview_profile'] = $strongarm; |
|
| 57 | - |
|
| 58 | - $strongarm = new stdClass; |
|
| 59 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | - $strongarm->api_version = 1; |
|
| 61 | - $strongarm->name = 'comment_profile'; |
|
| 62 | - $strongarm->value = '2'; |
|
| 63 | - $export['comment_profile'] = $strongarm; |
|
| 64 | - |
|
| 65 | - $strongarm = new stdClass; |
|
| 66 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | - $strongarm->api_version = 1; |
|
| 68 | - $strongarm->name = 'comment_subject_field_profile'; |
|
| 69 | - $strongarm->value = '1'; |
|
| 70 | - $export['comment_subject_field_profile'] = $strongarm; |
|
| 71 | - |
|
| 72 | - $strongarm = new stdClass; |
|
| 73 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | - $strongarm->api_version = 1; |
|
| 75 | - $strongarm->name = 'content_extra_weights_profile'; |
|
| 76 | - $strongarm->value = array( |
|
| 7 | + $export = array(); |
|
| 8 | + |
|
| 9 | + $strongarm = new stdClass; |
|
| 10 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | + $strongarm->api_version = 1; |
|
| 12 | + $strongarm->name = 'comment_anonymous_profile'; |
|
| 13 | + $strongarm->value = 0; |
|
| 14 | + $export['comment_anonymous_profile'] = $strongarm; |
|
| 15 | + |
|
| 16 | + $strongarm = new stdClass; |
|
| 17 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | + $strongarm->api_version = 1; |
|
| 19 | + $strongarm->name = 'comment_controls_profile'; |
|
| 20 | + $strongarm->value = '3'; |
|
| 21 | + $export['comment_controls_profile'] = $strongarm; |
|
| 22 | + |
|
| 23 | + $strongarm = new stdClass; |
|
| 24 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | + $strongarm->api_version = 1; |
|
| 26 | + $strongarm->name = 'comment_default_mode_profile'; |
|
| 27 | + $strongarm->value = '4'; |
|
| 28 | + $export['comment_default_mode_profile'] = $strongarm; |
|
| 29 | + |
|
| 30 | + $strongarm = new stdClass; |
|
| 31 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | + $strongarm->api_version = 1; |
|
| 33 | + $strongarm->name = 'comment_default_order_profile'; |
|
| 34 | + $strongarm->value = '1'; |
|
| 35 | + $export['comment_default_order_profile'] = $strongarm; |
|
| 36 | + |
|
| 37 | + $strongarm = new stdClass; |
|
| 38 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | + $strongarm->api_version = 1; |
|
| 40 | + $strongarm->name = 'comment_default_per_page_profile'; |
|
| 41 | + $strongarm->value = '50'; |
|
| 42 | + $export['comment_default_per_page_profile'] = $strongarm; |
|
| 43 | + |
|
| 44 | + $strongarm = new stdClass; |
|
| 45 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | + $strongarm->api_version = 1; |
|
| 47 | + $strongarm->name = 'comment_form_location_profile'; |
|
| 48 | + $strongarm->value = '0'; |
|
| 49 | + $export['comment_form_location_profile'] = $strongarm; |
|
| 50 | + |
|
| 51 | + $strongarm = new stdClass; |
|
| 52 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | + $strongarm->api_version = 1; |
|
| 54 | + $strongarm->name = 'comment_preview_profile'; |
|
| 55 | + $strongarm->value = '1'; |
|
| 56 | + $export['comment_preview_profile'] = $strongarm; |
|
| 57 | + |
|
| 58 | + $strongarm = new stdClass; |
|
| 59 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | + $strongarm->api_version = 1; |
|
| 61 | + $strongarm->name = 'comment_profile'; |
|
| 62 | + $strongarm->value = '2'; |
|
| 63 | + $export['comment_profile'] = $strongarm; |
|
| 64 | + |
|
| 65 | + $strongarm = new stdClass; |
|
| 66 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | + $strongarm->api_version = 1; |
|
| 68 | + $strongarm->name = 'comment_subject_field_profile'; |
|
| 69 | + $strongarm->value = '1'; |
|
| 70 | + $export['comment_subject_field_profile'] = $strongarm; |
|
| 71 | + |
|
| 72 | + $strongarm = new stdClass; |
|
| 73 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | + $strongarm->api_version = 1; |
|
| 75 | + $strongarm->name = 'content_extra_weights_profile'; |
|
| 76 | + $strongarm->value = array( |
|
| 77 | 77 | 'title' => '-5', |
| 78 | 78 | 'body_field' => '-3', |
| 79 | 79 | 'revision_information' => '-1', |
@@ -82,46 +82,46 @@ discard block |
||
| 82 | 82 | 'comment_settings' => '1', |
| 83 | 83 | 'menu' => '-4', |
| 84 | 84 | 'path' => '2', |
| 85 | - ); |
|
| 86 | - $export['content_extra_weights_profile'] = $strongarm; |
|
| 87 | - |
|
| 88 | - $strongarm = new stdClass; |
|
| 89 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 90 | - $strongarm->api_version = 1; |
|
| 91 | - $strongarm->name = 'content_profile_use_profile'; |
|
| 92 | - $strongarm->value = 1; |
|
| 93 | - $export['content_profile_use_profile'] = $strongarm; |
|
| 94 | - |
|
| 95 | - $strongarm = new stdClass; |
|
| 96 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 97 | - $strongarm->api_version = 1; |
|
| 98 | - $strongarm->name = 'language_content_type_profile'; |
|
| 99 | - $strongarm->value = '0'; |
|
| 100 | - $export['language_content_type_profile'] = $strongarm; |
|
| 101 | - |
|
| 102 | - $strongarm = new stdClass; |
|
| 103 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 104 | - $strongarm->api_version = 1; |
|
| 105 | - $strongarm->name = 'node_options_profile'; |
|
| 106 | - $strongarm->value = array( |
|
| 85 | + ); |
|
| 86 | + $export['content_extra_weights_profile'] = $strongarm; |
|
| 87 | + |
|
| 88 | + $strongarm = new stdClass; |
|
| 89 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 90 | + $strongarm->api_version = 1; |
|
| 91 | + $strongarm->name = 'content_profile_use_profile'; |
|
| 92 | + $strongarm->value = 1; |
|
| 93 | + $export['content_profile_use_profile'] = $strongarm; |
|
| 94 | + |
|
| 95 | + $strongarm = new stdClass; |
|
| 96 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 97 | + $strongarm->api_version = 1; |
|
| 98 | + $strongarm->name = 'language_content_type_profile'; |
|
| 99 | + $strongarm->value = '0'; |
|
| 100 | + $export['language_content_type_profile'] = $strongarm; |
|
| 101 | + |
|
| 102 | + $strongarm = new stdClass; |
|
| 103 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 104 | + $strongarm->api_version = 1; |
|
| 105 | + $strongarm->name = 'node_options_profile'; |
|
| 106 | + $strongarm->value = array( |
|
| 107 | 107 | 0 => 'status', |
| 108 | 108 | 1 => 'promote', |
| 109 | - ); |
|
| 110 | - $export['node_options_profile'] = $strongarm; |
|
| 111 | - |
|
| 112 | - $strongarm = new stdClass; |
|
| 113 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 114 | - $strongarm->api_version = 1; |
|
| 115 | - $strongarm->name = 'show_preview_changes_profile'; |
|
| 116 | - $strongarm->value = 0; |
|
| 117 | - $export['show_preview_changes_profile'] = $strongarm; |
|
| 118 | - |
|
| 119 | - $strongarm = new stdClass; |
|
| 120 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 121 | - $strongarm->api_version = 1; |
|
| 122 | - $strongarm->name = 'upload_profile'; |
|
| 123 | - $strongarm->value = '0'; |
|
| 124 | - $export['upload_profile'] = $strongarm; |
|
| 125 | - |
|
| 126 | - return $export; |
|
| 109 | + ); |
|
| 110 | + $export['node_options_profile'] = $strongarm; |
|
| 111 | + |
|
| 112 | + $strongarm = new stdClass; |
|
| 113 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 114 | + $strongarm->api_version = 1; |
|
| 115 | + $strongarm->name = 'show_preview_changes_profile'; |
|
| 116 | + $strongarm->value = 0; |
|
| 117 | + $export['show_preview_changes_profile'] = $strongarm; |
|
| 118 | + |
|
| 119 | + $strongarm = new stdClass; |
|
| 120 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 121 | + $strongarm->api_version = 1; |
|
| 122 | + $strongarm->name = 'upload_profile'; |
|
| 123 | + $strongarm->value = '0'; |
|
| 124 | + $export['upload_profile'] = $strongarm; |
|
| 125 | + |
|
| 126 | + return $export; |
|
| 127 | 127 | } |
@@ -7,70 +7,70 @@ discard block |
||
| 7 | 7 | $export = array(); |
| 8 | 8 | |
| 9 | 9 | $strongarm = new stdClass; |
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 10 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | 11 | $strongarm->api_version = 1; |
| 12 | 12 | $strongarm->name = 'comment_anonymous_profile'; |
| 13 | 13 | $strongarm->value = 0; |
| 14 | 14 | $export['comment_anonymous_profile'] = $strongarm; |
| 15 | 15 | |
| 16 | 16 | $strongarm = new stdClass; |
| 17 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 17 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 18 | 18 | $strongarm->api_version = 1; |
| 19 | 19 | $strongarm->name = 'comment_controls_profile'; |
| 20 | 20 | $strongarm->value = '3'; |
| 21 | 21 | $export['comment_controls_profile'] = $strongarm; |
| 22 | 22 | |
| 23 | 23 | $strongarm = new stdClass; |
| 24 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 24 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 25 | 25 | $strongarm->api_version = 1; |
| 26 | 26 | $strongarm->name = 'comment_default_mode_profile'; |
| 27 | 27 | $strongarm->value = '4'; |
| 28 | 28 | $export['comment_default_mode_profile'] = $strongarm; |
| 29 | 29 | |
| 30 | 30 | $strongarm = new stdClass; |
| 31 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 31 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 32 | 32 | $strongarm->api_version = 1; |
| 33 | 33 | $strongarm->name = 'comment_default_order_profile'; |
| 34 | 34 | $strongarm->value = '1'; |
| 35 | 35 | $export['comment_default_order_profile'] = $strongarm; |
| 36 | 36 | |
| 37 | 37 | $strongarm = new stdClass; |
| 38 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 38 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 39 | 39 | $strongarm->api_version = 1; |
| 40 | 40 | $strongarm->name = 'comment_default_per_page_profile'; |
| 41 | 41 | $strongarm->value = '50'; |
| 42 | 42 | $export['comment_default_per_page_profile'] = $strongarm; |
| 43 | 43 | |
| 44 | 44 | $strongarm = new stdClass; |
| 45 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 45 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 46 | 46 | $strongarm->api_version = 1; |
| 47 | 47 | $strongarm->name = 'comment_form_location_profile'; |
| 48 | 48 | $strongarm->value = '0'; |
| 49 | 49 | $export['comment_form_location_profile'] = $strongarm; |
| 50 | 50 | |
| 51 | 51 | $strongarm = new stdClass; |
| 52 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 52 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 53 | 53 | $strongarm->api_version = 1; |
| 54 | 54 | $strongarm->name = 'comment_preview_profile'; |
| 55 | 55 | $strongarm->value = '1'; |
| 56 | 56 | $export['comment_preview_profile'] = $strongarm; |
| 57 | 57 | |
| 58 | 58 | $strongarm = new stdClass; |
| 59 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 59 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 60 | 60 | $strongarm->api_version = 1; |
| 61 | 61 | $strongarm->name = 'comment_profile'; |
| 62 | 62 | $strongarm->value = '2'; |
| 63 | 63 | $export['comment_profile'] = $strongarm; |
| 64 | 64 | |
| 65 | 65 | $strongarm = new stdClass; |
| 66 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 66 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 67 | 67 | $strongarm->api_version = 1; |
| 68 | 68 | $strongarm->name = 'comment_subject_field_profile'; |
| 69 | 69 | $strongarm->value = '1'; |
| 70 | 70 | $export['comment_subject_field_profile'] = $strongarm; |
| 71 | 71 | |
| 72 | 72 | $strongarm = new stdClass; |
| 73 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 73 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 74 | 74 | $strongarm->api_version = 1; |
| 75 | 75 | $strongarm->name = 'content_extra_weights_profile'; |
| 76 | 76 | $strongarm->value = array( |
@@ -86,21 +86,21 @@ discard block |
||
| 86 | 86 | $export['content_extra_weights_profile'] = $strongarm; |
| 87 | 87 | |
| 88 | 88 | $strongarm = new stdClass; |
| 89 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 89 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 90 | 90 | $strongarm->api_version = 1; |
| 91 | 91 | $strongarm->name = 'content_profile_use_profile'; |
| 92 | 92 | $strongarm->value = 1; |
| 93 | 93 | $export['content_profile_use_profile'] = $strongarm; |
| 94 | 94 | |
| 95 | 95 | $strongarm = new stdClass; |
| 96 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 96 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 97 | 97 | $strongarm->api_version = 1; |
| 98 | 98 | $strongarm->name = 'language_content_type_profile'; |
| 99 | 99 | $strongarm->value = '0'; |
| 100 | 100 | $export['language_content_type_profile'] = $strongarm; |
| 101 | 101 | |
| 102 | 102 | $strongarm = new stdClass; |
| 103 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 103 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 104 | 104 | $strongarm->api_version = 1; |
| 105 | 105 | $strongarm->name = 'node_options_profile'; |
| 106 | 106 | $strongarm->value = array( |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | $export['node_options_profile'] = $strongarm; |
| 111 | 111 | |
| 112 | 112 | $strongarm = new stdClass; |
| 113 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 113 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 114 | 114 | $strongarm->api_version = 1; |
| 115 | 115 | $strongarm->name = 'show_preview_changes_profile'; |
| 116 | 116 | $strongarm->value = 0; |
| 117 | 117 | $export['show_preview_changes_profile'] = $strongarm; |
| 118 | 118 | |
| 119 | 119 | $strongarm = new stdClass; |
| 120 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 120 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 121 | 121 | $strongarm->api_version = 1; |
| 122 | 122 | $strongarm->name = 'upload_profile'; |
| 123 | 123 | $strongarm->value = '0'; |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | * the admin interface. |
| 16 | 16 | */ |
| 17 | 17 | function boinctranslate_filter_settings_form($format = -1) { |
| 18 | - // Form |
|
| 19 | - $form = array(); |
|
| 20 | - $form['boinctranslate_filter'] = array( |
|
| 18 | + // Form |
|
| 19 | + $form = array(); |
|
| 20 | + $form['boinctranslate_filter'] = array( |
|
| 21 | 21 | '#type' => 'fieldset', |
| 22 | 22 | '#title' => bts('BOINC translate filter', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'), |
| 23 | 23 | '#collapsible' => TRUE, |
| 24 | 24 | '#collapsed' => FALSE, |
| 25 | - ); |
|
| 26 | - $form['boinctranslate_filter']['boinctranslate_filter_help'] = array( |
|
| 25 | + ); |
|
| 26 | + $form['boinctranslate_filter']['boinctranslate_filter_help'] = array( |
|
| 27 | 27 | '#type' => 'item', |
| 28 | 28 | '#title' => t('BOINC translate filter'), |
| 29 | 29 | '#value' => t('When a node is created or edited, the content is split into chunks |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | only one chunk changes, then only that one translation needs to be |
| 49 | 49 | updated.'), |
| 50 | 50 | ); |
| 51 | - $form['boinctranslate_filter']["boinctranslate_filter_debug_$format"] = array( |
|
| 51 | + $form['boinctranslate_filter']["boinctranslate_filter_debug_$format"] = array( |
|
| 52 | 52 | '#type' => 'select', |
| 53 | 53 | '#title' => bts('Print debugging info', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'), |
| 54 | 54 | '#default_value' => variable_get("boinctranslate_filter_debug_$format", 0), |
| 55 | 55 | '#options' => array(t('Disabled'), t('Enabled')), |
| 56 | 56 | '#description' => bts('Prints additional debugging information. This option should be disabled on production sites.', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'), |
| 57 | - ); |
|
| 58 | - return $form; |
|
| 57 | + ); |
|
| 58 | + return $form; |
|
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | $form = array(); |
| 20 | 20 | $form['boinctranslate_filter'] = array( |
| 21 | 21 | '#type' => 'fieldset', |
| 22 | - '#title' => bts('BOINC translate filter', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'), |
|
| 23 | - '#collapsible' => TRUE, |
|
| 24 | - '#collapsed' => FALSE, |
|
| 22 | + '#title' => bts('BOINC translate filter', array(), null, 'boinc:adminpage-boinctranslate-inputfilter'), |
|
| 23 | + '#collapsible' => true, |
|
| 24 | + '#collapsed' => false, |
|
| 25 | 25 | ); |
| 26 | 26 | $form['boinctranslate_filter']['boinctranslate_filter_help'] = array( |
| 27 | 27 | '#type' => 'item', |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | ); |
| 51 | 51 | $form['boinctranslate_filter']["boinctranslate_filter_debug_$format"] = array( |
| 52 | 52 | '#type' => 'select', |
| 53 | - '#title' => bts('Print debugging info', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'), |
|
| 53 | + '#title' => bts('Print debugging info', array(), null, 'boinc:adminpage-boinctranslate-inputfilter'), |
|
| 54 | 54 | '#default_value' => variable_get("boinctranslate_filter_debug_$format", 0), |
| 55 | 55 | '#options' => array(t('Disabled'), t('Enabled')), |
| 56 | - '#description' => bts('Prints additional debugging information. This option should be disabled on production sites.', array(), NULL, 'boinc:adminpage-boinctranslate-inputfilter'), |
|
| 56 | + '#description' => bts('Prints additional debugging information. This option should be disabled on production sites.', array(), null, 'boinc:adminpage-boinctranslate-inputfilter'), |
|
| 57 | 57 | ); |
| 58 | 58 | return $form; |
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |