Plugin Directory

Changeset 634729


Ignore:
Timestamp:
12/06/2012 07:15:55 AM (13 years ago)
Author:
codestyling
Message:

release 1.99.28

Location:
codestyling-localization/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • codestyling-localization/trunk/codestyling-localization.php

    r631111 r634729  
    44Plugin URI: http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en
    55Description: 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.27
     6Version: 1.99.28
    77Author: Heiko Rabe
    88Author URI: http://www.code-styling.de/english/
     
    6666}
    6767if (!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    }
    6971}
    7072
     
    9294        define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.
    9395
    94     define("CSP_PO_PLUGINPATH", "/" . plugin_basename( dirname(__FILE__) ));
     96    define("CSP_PO_PLUGINPATH", "/" . dirname(plugin_basename( __FILE__ )));
    9597
    9698    define('CSP_PO_TEXTDOMAIN', 'codestyling-localization');
     
    23182320}
    23192321
    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;
     2322function 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
     2359function 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()');   
    23512362}
    23522363
     
    23552366    'old_handler' => null,
    23562367    'messages' => array()
    2357    
    23582368);
    23592369
     
    24752485    $csp_traced_php_errors['messages'][] = "$errname <strong>Error: [$errno] </strong> $errstr <strong>$errfile</strong> on line <strong>$errline</strong>";
    24762486    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);
    24782488    }
    24792489    return $csp_traced_php_errors['suppress_errors'];
     
    24822492function csp_trace_php_errors() {
    24832493    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'));
    24852496    if(defined('DOING_AJAX') && DOING_AJAX && isset($_POST['action'])) {
    24862497        $actions = array(
     
    25052516            'csp_self_protection_result'
    25062517        );
    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   
    25092522    if (function_exists('set_error_handler'))
    25102523        $csp_traced_php_errors['old_handler'] = set_error_handler("csp_php_error_handler", E_ALL);
     
    28312844}
    28322845function 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        }
    28412857    }
    28422858    return $src;
     
    28452861function csp_load_po_edit_admin_page(){
    28462862
    2847     add_filter('print_scripts_array', 'csp_filter_print_scripts_array');
     2863    add_filter('print_scripts_array', 'csp_filter_print_scripts_array', 0);
    28482864    add_action('admin_enqueue_scripts', 'csp_start_protection', 0);
    28492865    add_action('in_admin_footer', 'csp_start_protection', 0);
    28502866    add_action('admin_head', 'csp_self_script_protection_head', 9999);
    28512867    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);
    28532869
    28542870    wp_enqueue_script( 'thickbox' );
  • codestyling-localization/trunk/readme.txt

    r631115 r634729  
    33Tags: gettext, language, translation, poedit, localization, plugin, wpmu, buddypress, bbpress, themes, translator, l10n, i18n, google-translate, microsoft-translate, compatibility, mo, po, po-mo, polyglot
    44Requires at least: 2.5
    5 Tested up to: 3.5-RC1
    6 Stable tag: 1.99.27
     5Tested up to: 3.5-RC2
     6Stable tag: 1.99.28
    77
    88You can manage and edit all gettext translation files (*.po/*.mo) directly out of WordPress Admin Center without any need of an external editor.
     
    8282== Changelog ==
    8383
     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
    8489= Version 1.99.27 =
    8590* 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.