Changeset 634729
- Timestamp:
- 12/06/2012 07:15:55 AM (13 years ago)
- Location:
- codestyling-localization/trunk
- Files:
-
- 2 edited
-
codestyling-localization.php (modified) (10 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
codestyling-localization/trunk/codestyling-localization.php
r631111 r634729 4 4 Plugin URI: http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en 5 5 Description: You can manage and edit all gettext translation files (*.po/*.mo) directly out of your WordPress Admin Center without any need of an external editor. It automatically detects the gettext ready components like <b>WordPress</b> itself or any <b>Plugin</b> / <b>Theme</b> supporting gettext, is able to scan the related source files and can assists you using <b>Google Translate API</b> or <b>Microsoft Translator API</b> during translation.This plugin supports <b>WordPress MU</b> and allows explicit <b>WPMU Plugin</b> translation too. It newly introduces ignore-case and regular expression search during translation. <b>BuddyPress</b> and <b>bbPress</b> as part of BuddyPress can be translated too. Produces transalation files are 100% compatible to <b>PoEdit</b>. 6 Version: 1.99.2 76 Version: 1.99.28 7 7 Author: Heiko Rabe 8 8 Author URI: http://www.code-styling.de/english/ … … 66 66 } 67 67 if (!function_exists('plugins_url')) { 68 function plugins_url($plugin) { return WP_PLUGIN_URL . '/' . plugin_basename($plugin); } 68 function plugins_url($plugin) { 69 return WP_PLUGIN_URL . $plugin; 70 } 69 71 } 70 72 … … 92 94 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. 93 95 94 define("CSP_PO_PLUGINPATH", "/" . plugin_basename( dirname(__FILE__)));96 define("CSP_PO_PLUGINPATH", "/" . dirname(plugin_basename( __FILE__ ))); 95 97 96 98 define('CSP_PO_TEXTDOMAIN', 'codestyling-localization'); … … 2318 2320 } 2319 2321 2320 function csp_try_jquery_document_ready_hardening($script) { 2321 $pattern = 'jQuery(document).ready('; 2322 if ($pos = stripos($script,$pattern) !== false) { 2323 $counter = 0; 2324 $startofready = -1; 2325 $endofready = -1; 2326 for($i=$pos+strlen($pattern); $i < strlen($script); $i++) { 2327 switch(substr($script, $i, 1)) { 2328 case '{': 2329 $counter++; 2330 if ($counter == 1) { 2331 $startofready = $i; 2332 } 2333 break; 2334 case '}'; 2335 $counter--; 2336 if ($counter == 0) { 2337 $endofready = $i; 2338 $i = strlen($script); 2339 } 2340 break; 2341 default: 2342 break; 2343 } 2344 } 2345 if ($startofready != -1 && $endofready != -1) { 2346 $sub = substr($script, $startofready+1, $endofready-$startofready-2); 2347 $script = str_replace($sub, "try{".$sub."}catch(e){csp_self_protection.runtime.push(e.message);}" , $script); 2348 } 2349 } 2350 return $script; 2322 function csp_try_jquery_document_ready_hardening_pattern($content, $pattern) { 2323 $pieces = explode($pattern, $content); 2324 if (count($pieces) > 1) { 2325 for ($loop=1; $loop<count($pieces); $loop++) { 2326 $counter = 0; 2327 $startofready = -1; 2328 $endofready = -1; 2329 $script = $pieces[$loop]; 2330 for($i=0; $i < strlen($script); $i++) { 2331 switch(substr($script, $i, 1)) { 2332 case '{': 2333 $counter++; 2334 if ($counter == 1) { 2335 $startofready = $i; 2336 } 2337 break; 2338 case '}'; 2339 $counter--; 2340 if ($counter == 0) { 2341 $endofready = $i; 2342 $i = strlen($script); 2343 } 2344 break; 2345 default: 2346 break; 2347 } 2348 } 2349 if ($startofready != -1 && $endofready != -1) { 2350 if ($script[$endofready+1] == ')') $endofready++; 2351 $sub = substr($script, $startofready+1, $endofready-$startofready-2); 2352 $pieces[$loop] = str_replace($sub, "\ntry{\n".$sub."\n}catch(e){csp_self_protection.runtime.push(e.message);}" , $script); 2353 } 2354 } 2355 } 2356 return implode($pattern, $pieces); 2357 } 2358 2359 function csp_try_jquery_document_ready_hardening($content) { 2360 $script = csp_try_jquery_document_ready_hardening_pattern($content, 'jQuery(document).ready('); 2361 return csp_try_jquery_document_ready_hardening_pattern($script, 'jQuery(function()'); 2351 2362 } 2352 2363 … … 2355 2366 'old_handler' => null, 2356 2367 'messages' => array() 2357 2358 2368 ); 2359 2369 … … 2475 2485 $csp_traced_php_errors['messages'][] = "$errname <strong>Error: [$errno] </strong> $errstr <strong>$errfile</strong> on line <strong>$errline</strong>"; 2476 2486 if ($csp_traced_php_errors['old_handler'] != null && !$csp_traced_php_errors['suppress_errors']) { 2477 call_user_func($csp_traced_php_errors['old_handler'], $errno, $errstr, $errfile, $errline);2487 return call_user_func($csp_traced_php_errors['old_handler'], $errno, $errstr, $errfile, $errline); 2478 2488 } 2479 2489 return $csp_traced_php_errors['suppress_errors']; … … 2482 2492 function csp_trace_php_errors() { 2483 2493 global $csp_traced_php_errors; 2484 $csp_traced_php_errors['suppress_errors'] = (is_admin() && isset($_REQUEST['page']) && $_REQUEST['page'] == 'codestyling-localization/codestyling-localization.php'); 2494 2495 $csp_traced_php_errors['suppress_errors'] = (is_admin() && isset($_REQUEST['page']) && ($_REQUEST['page'] == 'codestyling-localization/codestyling-localization.php')); 2485 2496 if(defined('DOING_AJAX') && DOING_AJAX && isset($_POST['action'])) { 2486 2497 $actions = array( … … 2505 2516 'csp_self_protection_result' 2506 2517 ); 2507 if (in_array($_POST['action'], $actions)) $csp_traced_php_errors['suppress_errors'] = true; 2508 } 2518 if (in_array($_POST['action'], $actions)) 2519 $csp_traced_php_errors['suppress_errors'] = true; 2520 } 2521 2509 2522 if (function_exists('set_error_handler')) 2510 2523 $csp_traced_php_errors['old_handler'] = set_error_handler("csp_php_error_handler", E_ALL); … … 2831 2844 } 2832 2845 function csp_redirect_prototype_js($src, $handle) { 2833 $handles = array( 2834 'prototype' => 'prototype', 2835 'scriptaculous-root' => 'scriptaculous', 2836 'scriptaculous-effects' => 'effects' 2837 ); 2838 //load own older versions of the scripts that are working! 2839 if (isset($handles[$handle])) { 2840 return CSP_PO_BASE_URL.'/js/'.$handles[$handle].'.js'; 2846 global $wp_version; 2847 if (version_compare($wp_version, '3.5-alpha', '>=')) { 2848 $handles = array( 2849 'prototype' => 'prototype', 2850 'scriptaculous-root' => 'wp-scriptaculous', 2851 'scriptaculous-effects' => 'effects' 2852 ); 2853 //load own older versions of the scripts that are working! 2854 if (isset($handles[$handle])) { 2855 return CSP_PO_BASE_URL.'/js/'.$handles[$handle].'.js'; 2856 } 2841 2857 } 2842 2858 return $src; … … 2845 2861 function csp_load_po_edit_admin_page(){ 2846 2862 2847 add_filter('print_scripts_array', 'csp_filter_print_scripts_array' );2863 add_filter('print_scripts_array', 'csp_filter_print_scripts_array', 0); 2848 2864 add_action('admin_enqueue_scripts', 'csp_start_protection', 0); 2849 2865 add_action('in_admin_footer', 'csp_start_protection', 0); 2850 2866 add_action('admin_head', 'csp_self_script_protection_head', 9999); 2851 2867 add_action('admin_print_footer_scripts', 'csp_self_script_protection_footer', 9999); 2852 add_filter('script_loader_src', 'csp_redirect_prototype_js', 10, 2);2868 add_filter('script_loader_src', 'csp_redirect_prototype_js', 10, 9999); 2853 2869 2854 2870 wp_enqueue_script( 'thickbox' ); -
codestyling-localization/trunk/readme.txt
r631115 r634729 3 3 Tags: gettext, language, translation, poedit, localization, plugin, wpmu, buddypress, bbpress, themes, translator, l10n, i18n, google-translate, microsoft-translate, compatibility, mo, po, po-mo, polyglot 4 4 Requires at least: 2.5 5 Tested up to: 3.5-RC 16 Stable tag: 1.99.2 75 Tested up to: 3.5-RC2 6 Stable tag: 1.99.28 7 7 8 8 You can manage and edit all gettext translation files (*.po/*.mo) directly out of WordPress Admin Center without any need of an external editor. … … 82 82 == Changelog == 83 83 84 = Version 1.99.28 = 85 * Bugfix: function missing in very old WordPress versions covered 86 * Bugfix: Scripting Guard now detects broken ready handler of injected javascripts 87 * Bugfix: redirection of prototype/scriptaculous done only, if WP version >= 3.5-alpha 88 84 89 = Version 1.99.27 = 85 90 * Bugfix: WordPress version 3.5 starts removing prototype.js and scriptaculous but falls back to google CDN include which brokes JSON requests
Note: See TracChangeset
for help on using the changeset viewer.