@@ -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 |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | 1271379760 => 'moderator', |
| 20 | 20 | 933038561 => 'verified contributor', |
| 21 | 21 | ); |
| 22 | - $input_format->cache = FALSE; |
|
| 22 | + $input_format->cache = false; |
|
| 23 | 23 | $input_format->settings = array( |
| 24 | 24 | // Settings for: boinctranslate module |
| 25 | 25 | 'boinctranslate' => array( |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | // Settings for: htmlpurifier module |
| 119 | 119 | 'htmlpurifier' => array( |
| 120 | 120 | 'htmlpurifier_clear_cac' => array( |
| 121 | - '#description' => NULL, |
|
| 121 | + '#description' => null, |
|
| 122 | 122 | '#value' => 'Clear cache (Warning: Can result in performance degradation)', |
| 123 | 123 | ), |
| 124 | 124 | // Display help text |
| 125 | 125 | 'htmlpurifier_help' => 1, |
| 126 | 126 | 'htmlpurifier_config' => array( |
| 127 | - '#description' => NULL, |
|
| 127 | + '#description' => null, |
|
| 128 | 128 | '#value' => array( |
| 129 | 129 | 'Attr.EnableID' => '0', |
| 130 | 130 | 'AutoFormat.AutoParagraph' => '1', |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $input_format->roles = array( |
| 178 | 178 | 3519698132 => 'administrator', |
| 179 | 179 | ); |
| 180 | - $input_format->cache = FALSE; |
|
| 180 | + $input_format->cache = false; |
|
| 181 | 181 | $input_format->settings = array( |
| 182 | 182 | ); |
| 183 | 183 | $input_format->filters = array( |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $input_format->api_version = 1; |
| 198 | 198 | $input_format->name = 'PHP code'; |
| 199 | 199 | $input_format->roles = array(); |
| 200 | - $input_format->cache = FALSE; |
|
| 200 | + $input_format->cache = false; |
|
| 201 | 201 | $input_format->settings = array( |
| 202 | 202 | ); |
| 203 | 203 | $input_format->filters = array( |
@@ -4,12 +4,12 @@ discard block |
||
| 4 | 4 | * Implementation of hook_input_formats(). |
| 5 | 5 | */ |
| 6 | 6 | function boinc_standard_input_formats() { |
| 7 | - $input_formats = array(); |
|
| 7 | + $input_formats = array(); |
|
| 8 | 8 | |
| 9 | - $input_format = new stdClass; |
|
| 10 | - $input_format->api_version = 1; |
|
| 11 | - $input_format->name = 'Rich text'; |
|
| 12 | - $input_format->roles = array( |
|
| 9 | + $input_format = new stdClass; |
|
| 10 | + $input_format->api_version = 1; |
|
| 11 | + $input_format->name = 'Rich text'; |
|
| 12 | + $input_format->roles = array( |
|
| 13 | 13 | 1 => 'anonymous user', |
| 14 | 14 | 2 => 'authenticated user', |
| 15 | 15 | 3519698132 => 'administrator', |
@@ -18,48 +18,48 @@ discard block |
||
| 18 | 18 | 268174006 => 'forum control (system use only)', |
| 19 | 19 | 1271379760 => 'moderator', |
| 20 | 20 | 933038561 => 'verified contributor', |
| 21 | - ); |
|
| 22 | - $input_format->cache = FALSE; |
|
| 23 | - $input_format->settings = array( |
|
| 21 | + ); |
|
| 22 | + $input_format->cache = FALSE; |
|
| 23 | + $input_format->settings = array( |
|
| 24 | 24 | // Settings for: boinctranslate module |
| 25 | 25 | 'boinctranslate' => array( |
| 26 | - // Print debugging info |
|
| 27 | - 'boinctranslate_filter_debug' => '0', |
|
| 26 | + // Print debugging info |
|
| 27 | + 'boinctranslate_filter_debug' => '0', |
|
| 28 | 28 | ), |
| 29 | 29 | // Settings for: pathologic module |
| 30 | 30 | 'pathologic' => array( |
| 31 | - // Also considered local |
|
| 32 | - 'filter_pathologic_local_paths' => '/ |
|
| 31 | + // Also considered local |
|
| 32 | + 'filter_pathologic_local_paths' => '/ |
|
| 33 | 33 | ', |
| 34 | - // Output full absolute URLs |
|
| 35 | - 'filter_pathologic_absolute' => 1, |
|
| 34 | + // Output full absolute URLs |
|
| 35 | + 'filter_pathologic_absolute' => 1, |
|
| 36 | 36 | ), |
| 37 | 37 | // Settings for: bbcode module |
| 38 | 38 | 'bbcode' => array( |
| 39 | - // Convert addresses to links |
|
| 40 | - 'bbcode_make_links' => '1', |
|
| 41 | - // Spam link deterrent |
|
| 42 | - 'bbcode_filter_nofollow' => '0', |
|
| 43 | - // Email address encoding |
|
| 44 | - 'bbcode_encode_mailto' => '0', |
|
| 45 | - // Email address rewrite |
|
| 46 | - 'bbcode_rewrite_email' => '1', |
|
| 47 | - // Smart paragraph and line breaks |
|
| 48 | - 'bbcode_paragraph_breaks' => '2', |
|
| 49 | - // Print debugging info |
|
| 50 | - 'bbcode_debug' => '0', |
|
| 39 | + // Convert addresses to links |
|
| 40 | + 'bbcode_make_links' => '1', |
|
| 41 | + // Spam link deterrent |
|
| 42 | + 'bbcode_filter_nofollow' => '0', |
|
| 43 | + // Email address encoding |
|
| 44 | + 'bbcode_encode_mailto' => '0', |
|
| 45 | + // Email address rewrite |
|
| 46 | + 'bbcode_rewrite_email' => '1', |
|
| 47 | + // Smart paragraph and line breaks |
|
| 48 | + 'bbcode_paragraph_breaks' => '2', |
|
| 49 | + // Print debugging info |
|
| 50 | + 'bbcode_debug' => '0', |
|
| 51 | 51 | ), |
| 52 | 52 | // Settings for: htmlpurifier module |
| 53 | 53 | 'htmlpurifier' => array( |
| 54 | - 'htmlpurifier_clear_cac' => array( |
|
| 55 | - '#description' => NULL, |
|
| 56 | - '#value' => 'Clear cache (Warning: Can result in performance degradation)', |
|
| 54 | + 'htmlpurifier_clear_cac' => array( |
|
| 55 | + '#description' => NULL, |
|
| 56 | + '#value' => 'Clear cache (Warning: Can result in performance degradation)', |
|
| 57 | 57 | ), |
| 58 | - // Display help text |
|
| 59 | - 'htmlpurifier_help' => 1, |
|
| 60 | - 'htmlpurifier_config' => array( |
|
| 61 | - '#description' => NULL, |
|
| 62 | - '#value' => array( |
|
| 58 | + // Display help text |
|
| 59 | + 'htmlpurifier_help' => 1, |
|
| 60 | + 'htmlpurifier_config' => array( |
|
| 61 | + '#description' => NULL, |
|
| 62 | + '#value' => array( |
|
| 63 | 63 | 'Attr.EnableID' => '0', |
| 64 | 64 | 'AutoFormat.AutoParagraph' => '1', |
| 65 | 65 | 'AutoFormat.Linkify' => '1', |
@@ -72,145 +72,145 @@ discard block |
||
| 72 | 72 | 'URI.DisableExternalResources' => '0', |
| 73 | 73 | 'URI.DisableResources' => '0', |
| 74 | 74 | 'Null_URI.Munge' => '1', |
| 75 | - ), |
|
| 75 | + ), |
|
| 76 | 76 | ), |
| 77 | 77 | ), |
| 78 | 78 | // Settings for: tableofcontents module |
| 79 | 79 | 'tableofcontents' => array( |
| 80 | - // Hide the table of contents tags |
|
| 81 | - 'tableofcontents_hide_table' => 0, |
|
| 82 | - // Whether an automatic table of content should be added |
|
| 83 | - 'tableofcontents_automatic' => '0', |
|
| 84 | - // Number of headers before an automatic table of content is added |
|
| 85 | - 'tableofcontents_min_limit' => '5', |
|
| 86 | - // Remove Table of Contents tags from teasers |
|
| 87 | - 'tableofcontents_remove_teaser' => 1, |
|
| 88 | - // Allow users to override the settings within the table of contents tag itself |
|
| 89 | - 'tableofcontents_allow_override' => 1, |
|
| 90 | - // Ensure title is safe (i.e. use check_plain() to avoid XSS attacks.) |
|
| 91 | - 'tableofcontents_safe_title' => 1, |
|
| 92 | - // Table of Contents Title |
|
| 93 | - 'tableofcontents_title' => 'Table of Contents', |
|
| 94 | - // Minimum heading level |
|
| 95 | - 'tableofcontents_minlevel' => '2', |
|
| 96 | - // Maximum heading level |
|
| 97 | - 'tableofcontents_maxlevel' => '3', |
|
| 98 | - // Include link to hide/show table of contents |
|
| 99 | - 'tableofcontents_hide_show' => 1, |
|
| 100 | - // Start with the table of content collapsed |
|
| 101 | - 'tableofcontents_collapsed' => 0, |
|
| 102 | - // Select what is stripped from the header titles |
|
| 103 | - 'tableofcontents_id_stripping' => array( |
|
| 104 | - 'digits' => 0, |
|
| 105 | - 'dashes' => 0, |
|
| 106 | - 'periods' => 0, |
|
| 107 | - 'underscores' => 0, |
|
| 108 | - 'colons' => 0, |
|
| 80 | + // Hide the table of contents tags |
|
| 81 | + 'tableofcontents_hide_table' => 0, |
|
| 82 | + // Whether an automatic table of content should be added |
|
| 83 | + 'tableofcontents_automatic' => '0', |
|
| 84 | + // Number of headers before an automatic table of content is added |
|
| 85 | + 'tableofcontents_min_limit' => '5', |
|
| 86 | + // Remove Table of Contents tags from teasers |
|
| 87 | + 'tableofcontents_remove_teaser' => 1, |
|
| 88 | + // Allow users to override the settings within the table of contents tag itself |
|
| 89 | + 'tableofcontents_allow_override' => 1, |
|
| 90 | + // Ensure title is safe (i.e. use check_plain() to avoid XSS attacks.) |
|
| 91 | + 'tableofcontents_safe_title' => 1, |
|
| 92 | + // Table of Contents Title |
|
| 93 | + 'tableofcontents_title' => 'Table of Contents', |
|
| 94 | + // Minimum heading level |
|
| 95 | + 'tableofcontents_minlevel' => '2', |
|
| 96 | + // Maximum heading level |
|
| 97 | + 'tableofcontents_maxlevel' => '3', |
|
| 98 | + // Include link to hide/show table of contents |
|
| 99 | + 'tableofcontents_hide_show' => 1, |
|
| 100 | + // Start with the table of content collapsed |
|
| 101 | + 'tableofcontents_collapsed' => 0, |
|
| 102 | + // Select what is stripped from the header titles |
|
| 103 | + 'tableofcontents_id_stripping' => array( |
|
| 104 | + 'digits' => 0, |
|
| 105 | + 'dashes' => 0, |
|
| 106 | + 'periods' => 0, |
|
| 107 | + 'underscores' => 0, |
|
| 108 | + 'colons' => 0, |
|
| 109 | 109 | ), |
| 110 | - // Identifier introducer |
|
| 111 | - 'tableofcontents_identifier_introducer' => 'header', |
|
| 112 | - // Identifier and number separator |
|
| 113 | - 'tableofcontents_id_separator' => '-', |
|
| 114 | - // How to generate missing header identifiers |
|
| 115 | - 'tableofcontents_id_generator' => 'title', |
|
| 116 | - // List of tags allowed in table headers |
|
| 117 | - 'tableofcontents_allowed_tags' => '<em> <i> <strong> <b> <u> <del> <ins> <sub> <sup> <cite> <strike> <s> <tt> <span> <font> <abbr> <acronym> <dfn> <q> <bdo> <big> <small>', |
|
| 118 | - // Show attachments in the table of contents |
|
| 119 | - 'tableofcontents_attachments' => 0, |
|
| 120 | - // Add the comments to the table of contents |
|
| 121 | - 'tableofcontents_comments' => 0, |
|
| 122 | - // Select header level at which comments start |
|
| 123 | - 'tableofcontents_comments_level' => '3', |
|
| 124 | - // Back to top label |
|
| 125 | - 'tableofcontents_back_to_top' => '', |
|
| 126 | - // Back to top location |
|
| 127 | - 'tableofcontents_back_to_top_location' => 'bottom', |
|
| 128 | - // Minimum level where Back to Top appears |
|
| 129 | - 'tableofcontents_back_to_top_minlevel' => '2', |
|
| 130 | - // Maximum level where Back to Top appears |
|
| 131 | - 'tableofcontents_back_to_top_maxlevel' => '4', |
|
| 132 | - // Back to top anchor |
|
| 133 | - 'tableofcontents_back_to_top_anchor' => 'toc', |
|
| 134 | - // Scroll back to the table of contents |
|
| 135 | - 'tableofcontents_scroll_back_to_top' => 0, |
|
| 136 | - // Numbering method |
|
| 137 | - 'tableofcontents_numbering' => '0', |
|
| 138 | - // Add the number to the headers |
|
| 139 | - 'tableofcontents_number_headers' => 0, |
|
| 140 | - // Numbering mode |
|
| 141 | - 'tableofcontents_number_mode' => '0', |
|
| 142 | - // Numbering prefix |
|
| 143 | - 'tableofcontents_number_start_letter' => '', |
|
| 144 | - // Numbering separator |
|
| 145 | - 'tableofcontents_number_separator' => '.', |
|
| 146 | - // Numbering suffix |
|
| 147 | - 'tableofcontents_number_end_letter' => '.', |
|
| 110 | + // Identifier introducer |
|
| 111 | + 'tableofcontents_identifier_introducer' => 'header', |
|
| 112 | + // Identifier and number separator |
|
| 113 | + 'tableofcontents_id_separator' => '-', |
|
| 114 | + // How to generate missing header identifiers |
|
| 115 | + 'tableofcontents_id_generator' => 'title', |
|
| 116 | + // List of tags allowed in table headers |
|
| 117 | + 'tableofcontents_allowed_tags' => '<em> <i> <strong> <b> <u> <del> <ins> <sub> <sup> <cite> <strike> <s> <tt> <span> <font> <abbr> <acronym> <dfn> <q> <bdo> <big> <small>', |
|
| 118 | + // Show attachments in the table of contents |
|
| 119 | + 'tableofcontents_attachments' => 0, |
|
| 120 | + // Add the comments to the table of contents |
|
| 121 | + 'tableofcontents_comments' => 0, |
|
| 122 | + // Select header level at which comments start |
|
| 123 | + 'tableofcontents_comments_level' => '3', |
|
| 124 | + // Back to top label |
|
| 125 | + 'tableofcontents_back_to_top' => '', |
|
| 126 | + // Back to top location |
|
| 127 | + 'tableofcontents_back_to_top_location' => 'bottom', |
|
| 128 | + // Minimum level where Back to Top appears |
|
| 129 | + 'tableofcontents_back_to_top_minlevel' => '2', |
|
| 130 | + // Maximum level where Back to Top appears |
|
| 131 | + 'tableofcontents_back_to_top_maxlevel' => '4', |
|
| 132 | + // Back to top anchor |
|
| 133 | + 'tableofcontents_back_to_top_anchor' => 'toc', |
|
| 134 | + // Scroll back to the table of contents |
|
| 135 | + 'tableofcontents_scroll_back_to_top' => 0, |
|
| 136 | + // Numbering method |
|
| 137 | + 'tableofcontents_numbering' => '0', |
|
| 138 | + // Add the number to the headers |
|
| 139 | + 'tableofcontents_number_headers' => 0, |
|
| 140 | + // Numbering mode |
|
| 141 | + 'tableofcontents_number_mode' => '0', |
|
| 142 | + // Numbering prefix |
|
| 143 | + 'tableofcontents_number_start_letter' => '', |
|
| 144 | + // Numbering separator |
|
| 145 | + 'tableofcontents_number_separator' => '.', |
|
| 146 | + // Numbering suffix |
|
| 147 | + 'tableofcontents_number_end_letter' => '.', |
|
| 148 | 148 | ), |
| 149 | - ); |
|
| 150 | - $input_format->filters = array( |
|
| 149 | + ); |
|
| 150 | + $input_format->filters = array( |
|
| 151 | 151 | 'boinctranslate' => array( |
| 152 | - // Delta => Weight for: BOINC translation filter to help split content into chunks for translations. |
|
| 153 | - '0' => '-10', |
|
| 152 | + // Delta => Weight for: BOINC translation filter to help split content into chunks for translations. |
|
| 153 | + '0' => '-10', |
|
| 154 | 154 | ), |
| 155 | 155 | 'pathologic' => array( |
| 156 | - // Delta => Weight for: Pathologic |
|
| 157 | - '0' => '-9', |
|
| 156 | + // Delta => Weight for: Pathologic |
|
| 157 | + '0' => '-9', |
|
| 158 | 158 | ), |
| 159 | 159 | 'bbcode' => array( |
| 160 | - // Delta => Weight for: BBCode |
|
| 161 | - '0' => '-8', |
|
| 160 | + // Delta => Weight for: BBCode |
|
| 161 | + '0' => '-8', |
|
| 162 | 162 | ), |
| 163 | 163 | 'htmlpurifier' => array( |
| 164 | - // Delta => Weight for: HTML Purifier |
|
| 165 | - '0' => '-7', |
|
| 164 | + // Delta => Weight for: HTML Purifier |
|
| 165 | + '0' => '-7', |
|
| 166 | 166 | ), |
| 167 | 167 | 'tableofcontents' => array( |
| 168 | - // Delta => Weight for: Table of contents |
|
| 169 | - '0' => '-6', |
|
| 168 | + // Delta => Weight for: Table of contents |
|
| 169 | + '0' => '-6', |
|
| 170 | 170 | ), |
| 171 | 171 | 'image_caption_filter' => array( |
| 172 | - // Delta => Weight for: Image caption filter |
|
| 173 | - '0' => '-5', |
|
| 172 | + // Delta => Weight for: Image caption filter |
|
| 173 | + '0' => '-5', |
|
| 174 | 174 | ), |
| 175 | - ); |
|
| 176 | - $input_format->machine = 'rich_text'; |
|
| 177 | - $input_formats['rich_text'] = $input_format; |
|
| 175 | + ); |
|
| 176 | + $input_format->machine = 'rich_text'; |
|
| 177 | + $input_formats['rich_text'] = $input_format; |
|
| 178 | 178 | |
| 179 | - $input_format = new stdClass; |
|
| 180 | - $input_format->api_version = 1; |
|
| 181 | - $input_format->name = 'Plain text'; |
|
| 182 | - $input_format->roles = array( |
|
| 179 | + $input_format = new stdClass; |
|
| 180 | + $input_format->api_version = 1; |
|
| 181 | + $input_format->name = 'Plain text'; |
|
| 182 | + $input_format->roles = array( |
|
| 183 | 183 | 3519698132 => 'administrator', |
| 184 | - ); |
|
| 185 | - $input_format->cache = FALSE; |
|
| 186 | - $input_format->settings = array( |
|
| 187 | - ); |
|
| 188 | - $input_format->filters = array( |
|
| 184 | + ); |
|
| 185 | + $input_format->cache = FALSE; |
|
| 186 | + $input_format->settings = array( |
|
| 187 | + ); |
|
| 188 | + $input_format->filters = array( |
|
| 189 | 189 | 'boinctranslate' => array( |
| 190 | - '0' => '10', |
|
| 190 | + '0' => '10', |
|
| 191 | 191 | ), |
| 192 | 192 | 'filter' => array( |
| 193 | - '0' => '10', |
|
| 193 | + '0' => '10', |
|
| 194 | 194 | ), |
| 195 | - ); |
|
| 196 | - $input_format->machine = 'plain_text'; |
|
| 197 | - $input_formats['plain_text'] = $input_format; |
|
| 195 | + ); |
|
| 196 | + $input_format->machine = 'plain_text'; |
|
| 197 | + $input_formats['plain_text'] = $input_format; |
|
| 198 | 198 | |
| 199 | - $input_format = new stdClass; |
|
| 200 | - $input_format->api_version = 1; |
|
| 201 | - $input_format->name = 'PHP code'; |
|
| 202 | - $input_format->roles = array(); |
|
| 203 | - $input_format->cache = FALSE; |
|
| 204 | - $input_format->settings = array( |
|
| 205 | - ); |
|
| 206 | - $input_format->filters = array( |
|
| 199 | + $input_format = new stdClass; |
|
| 200 | + $input_format->api_version = 1; |
|
| 201 | + $input_format->name = 'PHP code'; |
|
| 202 | + $input_format->roles = array(); |
|
| 203 | + $input_format->cache = FALSE; |
|
| 204 | + $input_format->settings = array( |
|
| 205 | + ); |
|
| 206 | + $input_format->filters = array( |
|
| 207 | 207 | 'php' => array( |
| 208 | - '0' => '0', |
|
| 208 | + '0' => '0', |
|
| 209 | 209 | ), |
| 210 | - ); |
|
| 211 | - $input_format->machine = 'php_code'; |
|
| 212 | - $input_formats['php_code'] = $input_format; |
|
| 210 | + ); |
|
| 211 | + $input_format->machine = 'php_code'; |
|
| 212 | + $input_formats['php_code'] = $input_format; |
|
| 213 | 213 | |
| 214 | - return $input_formats; |
|
| 214 | + return $input_formats; |
|
| 215 | 215 | |
| 216 | 216 | } |
@@ -4,57 +4,57 @@ |
||
| 4 | 4 | * Implementation of hook_fieldgroup_default_groups(). |
| 5 | 5 | */ |
| 6 | 6 | function boinc_standard_fieldgroup_default_groups() { |
| 7 | - $groups = array(); |
|
| 7 | + $groups = array(); |
|
| 8 | 8 | |
| 9 | - // Exported group: group_boinctranslate_opts |
|
| 10 | - $groups['page-group_boinctranslate_opts'] = array( |
|
| 9 | + // Exported group: group_boinctranslate_opts |
|
| 10 | + $groups['page-group_boinctranslate_opts'] = array( |
|
| 11 | 11 | 'group_type' => 'standard', |
| 12 | 12 | 'type_name' => 'page', |
| 13 | 13 | 'group_name' => 'group_boinctranslate_opts', |
| 14 | 14 | 'label' => 'boinctranslate node options', |
| 15 | 15 | 'settings' => array( |
| 16 | - 'form' => array( |
|
| 16 | + 'form' => array( |
|
| 17 | 17 | 'style' => 'fieldset_collapsed', |
| 18 | 18 | 'description' => '', |
| 19 | - ), |
|
| 20 | - 'display' => array( |
|
| 19 | + ), |
|
| 20 | + 'display' => array( |
|
| 21 | 21 | 'description' => '', |
| 22 | 22 | 'teaser' => array( |
| 23 | - 'format' => 'fieldset', |
|
| 24 | - 'exclude' => 0, |
|
| 23 | + 'format' => 'fieldset', |
|
| 24 | + 'exclude' => 0, |
|
| 25 | 25 | ), |
| 26 | 26 | 'full' => array( |
| 27 | - 'format' => 'fieldset', |
|
| 28 | - 'exclude' => 0, |
|
| 27 | + 'format' => 'fieldset', |
|
| 28 | + 'exclude' => 0, |
|
| 29 | 29 | ), |
| 30 | 30 | '4' => array( |
| 31 | - 'format' => 'fieldset', |
|
| 32 | - 'exclude' => 0, |
|
| 31 | + 'format' => 'fieldset', |
|
| 32 | + 'exclude' => 0, |
|
| 33 | 33 | ), |
| 34 | 34 | '2' => array( |
| 35 | - 'format' => 'fieldset', |
|
| 36 | - 'exclude' => 0, |
|
| 35 | + 'format' => 'fieldset', |
|
| 36 | + 'exclude' => 0, |
|
| 37 | 37 | ), |
| 38 | 38 | '3' => array( |
| 39 | - 'format' => 'fieldset', |
|
| 40 | - 'exclude' => 0, |
|
| 39 | + 'format' => 'fieldset', |
|
| 40 | + 'exclude' => 0, |
|
| 41 | 41 | ), |
| 42 | 42 | 'token' => array( |
| 43 | - 'format' => 'fieldset', |
|
| 44 | - 'exclude' => 0, |
|
| 43 | + 'format' => 'fieldset', |
|
| 44 | + 'exclude' => 0, |
|
| 45 | 45 | ), |
| 46 | 46 | 'label' => 'above', |
| 47 | - ), |
|
| 47 | + ), |
|
| 48 | 48 | ), |
| 49 | 49 | 'weight' => '104', |
| 50 | 50 | 'fields' => array( |
| 51 | - '0' => 'field_boinctranslate_transifex', |
|
| 51 | + '0' => 'field_boinctranslate_transifex', |
|
| 52 | 52 | ), |
| 53 | - ); |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - // Translatables |
|
| 56 | - // Included for use with string extractors like potx. |
|
| 57 | - t('boinctranslate node options'); |
|
| 55 | + // Translatables |
|
| 56 | + // Included for use with string extractors like potx. |
|
| 57 | + t('boinctranslate node options'); |
|
| 58 | 58 | |
| 59 | - return $groups; |
|
| 59 | + return $groups; |
|
| 60 | 60 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | // (so that bad guys can't tell if they have an unreplicated job) |
| 66 | 66 | |
| 67 | 67 | $config = get_config(); |
| 68 | - if ($app->target_nresults>0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) { |
|
| 68 | + if ($app->target_nresults > 0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) { |
|
| 69 | 69 | row2(tra("Tasks in progress"), tra("suppressed pending completion")); |
| 70 | 70 | end_table(); |
| 71 | 71 | } else { |
@@ -4,42 +4,42 @@ discard block |
||
| 4 | 4 | * Implementation of hook_content_default_fields(). |
| 5 | 5 | */ |
| 6 | 6 | function boinc_standard_content_default_fields() { |
| 7 | - $fields = array(); |
|
| 7 | + $fields = array(); |
|
| 8 | 8 | |
| 9 | - // Exported field: field_boinctranslate_transifex |
|
| 10 | - $fields['page-field_boinctranslate_transifex'] = array( |
|
| 9 | + // Exported field: field_boinctranslate_transifex |
|
| 10 | + $fields['page-field_boinctranslate_transifex'] = array( |
|
| 11 | 11 | 'field_name' => 'field_boinctranslate_transifex', |
| 12 | 12 | 'type_name' => 'page', |
| 13 | 13 | 'display_settings' => array( |
| 14 | - 'weight' => '101', |
|
| 15 | - 'parent' => '', |
|
| 16 | - 'label' => array( |
|
| 14 | + 'weight' => '101', |
|
| 15 | + 'parent' => '', |
|
| 16 | + 'label' => array( |
|
| 17 | 17 | 'format' => 'hidden', |
| 18 | - ), |
|
| 19 | - 'teaser' => array( |
|
| 18 | + ), |
|
| 19 | + 'teaser' => array( |
|
| 20 | 20 | 'format' => 'default', |
| 21 | 21 | 'exclude' => 0, |
| 22 | - ), |
|
| 23 | - 'full' => array( |
|
| 22 | + ), |
|
| 23 | + 'full' => array( |
|
| 24 | 24 | 'format' => 'hidden', |
| 25 | 25 | 'exclude' => 0, |
| 26 | - ), |
|
| 27 | - 'token' => array( |
|
| 26 | + ), |
|
| 27 | + 'token' => array( |
|
| 28 | 28 | 'format' => 'hidden', |
| 29 | 29 | 'exclude' => 0, |
| 30 | - ), |
|
| 31 | - '2' => array( |
|
| 30 | + ), |
|
| 31 | + '2' => array( |
|
| 32 | 32 | 'format' => 'hidden', |
| 33 | 33 | 'exclude' => 0, |
| 34 | - ), |
|
| 35 | - '3' => array( |
|
| 34 | + ), |
|
| 35 | + '3' => array( |
|
| 36 | 36 | 'format' => 'hidden', |
| 37 | 37 | 'exclude' => 0, |
| 38 | - ), |
|
| 39 | - '4' => array( |
|
| 38 | + ), |
|
| 39 | + '4' => array( |
|
| 40 | 40 | 'format' => 'hidden', |
| 41 | 41 | 'exclude' => 0, |
| 42 | - ), |
|
| 42 | + ), |
|
| 43 | 43 | ), |
| 44 | 44 | 'widget_active' => '1', |
| 45 | 45 | 'type' => 'text', |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | 1|Export for translation', |
| 54 | 54 | 'allowed_values_php' => '', |
| 55 | 55 | 'widget' => array( |
| 56 | - 'default_value' => array( |
|
| 56 | + 'default_value' => array( |
|
| 57 | 57 | '0' => array( |
| 58 | - 'value' => 1, |
|
| 58 | + 'value' => 1, |
|
| 59 | + ), |
|
| 59 | 60 | ), |
| 60 | - ), |
|
| 61 | - 'default_value_php' => NULL, |
|
| 62 | - 'label' => 'Export to Transifex', |
|
| 63 | - 'weight' => '101', |
|
| 64 | - 'description' => 'If selected, this node will be exported to Transifex for translation. Otherwise the node will only be available in the default language.', |
|
| 65 | - 'type' => 'optionwidgets_onoff', |
|
| 66 | - 'module' => 'optionwidgets', |
|
| 61 | + 'default_value_php' => NULL, |
|
| 62 | + 'label' => 'Export to Transifex', |
|
| 63 | + 'weight' => '101', |
|
| 64 | + 'description' => 'If selected, this node will be exported to Transifex for translation. Otherwise the node will only be available in the default language.', |
|
| 65 | + 'type' => 'optionwidgets_onoff', |
|
| 66 | + 'module' => 'optionwidgets', |
|
| 67 | 67 | ), |
| 68 | - ); |
|
| 68 | + ); |
|
| 69 | 69 | |
| 70 | - // Translatables |
|
| 71 | - // Included for use with string extractors like potx. |
|
| 72 | - t('boinctranslate export to transifex'); |
|
| 70 | + // Translatables |
|
| 71 | + // Included for use with string extractors like potx. |
|
| 72 | + t('boinctranslate export to transifex'); |
|
| 73 | 73 | |
| 74 | - return $fields; |
|
| 74 | + return $fields; |
|
| 75 | 75 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | 'value' => 1, |
| 59 | 59 | ), |
| 60 | 60 | ), |
| 61 | - 'default_value_php' => NULL, |
|
| 61 | + 'default_value_php' => null, |
|
| 62 | 62 | 'label' => 'Export to Transifex', |
| 63 | 63 | 'weight' => '101', |
| 64 | 64 | 'description' => 'If selected, this node will be exported to Transifex for translation. Otherwise the node will only be available in the default language.', |