WordPress.org

Make WordPress Core

Ticket #16227: convertEntities-Firebug-Fix.diff

File convertEntities-Firebug-Fix.diff, 9.8 KB (added by mikeschinkel, 7 years ago)

Changes call to convertEntities() so Firebug doesn't always break on those calls

  • wp-includes/script-loader.php

     
    6868        $scripts->add_data( 'common', 'group', 1 );
    6969        $scripts->localize( 'common', 'commonL10n', array(
    7070                'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
    71                 'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
     71                'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(commonL10n);}'
    7272        ) );
    7373
    7474        $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' );
     
    8686                'enterURL' => __('Enter the URL'),
    8787                'enterImageURL' => __('Enter the URL of the image'),
    8888                'enterImageDescription' => __('Enter a description of the image'),
    89                 'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};'
     89                'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(quicktagsL10n);}'
    9090        ) );
    9191
    9292        $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
     
    100100        $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
    101101                'noPerm' => __('You do not have permission to do that.'),
    102102                'broken' => __('An unidentified error has occurred.'),
    103                 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
     103                'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(wpAjax);}'
    104104        ) );
    105105
    106106        $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20101004' );
     
    193193                        'of' => __('of'),
    194194                        'close' => __('Close'),
    195195                        'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
    196                         'l10n_print_after' => 'try{convertEntities(thickboxL10n);}catch(e){};'
     196                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(thickboxL10n);}'
    197197        ) );
    198198
    199199
     
    236236                        'crunching' => __('Crunching…'),
    237237                        'deleted' => __('moved to the trash.'),
    238238                        'error_uploading' => __('“%s” has failed to upload due to an error'),
    239                         'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};',
     239                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(swfuploadL10n);}',
    240240        ) );
    241241
    242242        $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
     
    256256                'good' => _x('Medium', 'password strength'),
    257257                'strong' => __('Strong'),
    258258                'mismatch' => __('Mismatch'),
    259                 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
     259                'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(pwsL10n);}'
    260260        ) );
    261261
    262262        $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20110113' );
     
    265265        $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110112a' );
    266266        $scripts->add_data( 'admin-bar', 'group', 1 );
    267267        $scripts->localize( 'admin-bar', 'adminBarL10n', array(
    268                 'l10n_print_after' => 'try{convertEntities(adminBarL10n);}catch(e){};',
     268                'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(adminBarL10n);}',
    269269        ) );
    270270
    271271        $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20110111' );
     
    274274                'save' => __('Add Link'),
    275275                'noTitle' => __('(no title)'),
    276276                'noMatchesFound' => __('No matches found.'),
    277                 'l10n_print_after' => 'try{convertEntities(wpLinkL10n);}catch(e){};',
     277                'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(wpLinkL10n);}',
    278278        ) );
    279279
    280280        $scripts->add( 'wpdialogs-popup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", array( 'jquery-ui-dialog' ), '20101119' );
     
    285285                $scripts->localize( 'ajaxcat', 'catL10n', array(
    286286                        'add' => esc_attr(__('Add')),
    287287                        'how' => __('Separate multiple categories with commas.'),
    288                         'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
     288                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(catL10n);}'
    289289                ) );
    290290
    291291                $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20091201' );
     
    296296                $scripts->localize( 'admin-tags', 'tagsl10n', array(
    297297                        'noPerm' => __('You do not have permission to do that.'),
    298298                        'broken' => __('An unidentified error has occurred.'),
    299                         'l10n_print_after' => 'try{convertEntities(tagsl10n);}catch(e){};'
     299                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(tagsl10n);}'
    300300                ));
    301301
    302302                $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
     
    307307                $scripts->localize( 'list-table', 'listTableL10n', array(
    308308                        'error' => __('An error has occurred while loading the items.'),
    309309                        'search' => __('Search results for “%s”'),
    310                         'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};'
     310                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(listTableL10n);}'
    311311                ) );
    312312
    313313                $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20101223' );
     
    349349                        'password' => __('Password Protected'),
    350350                        'privatelyPublished' => __('Privately Published'),
    351351                        'published' => __('Published'),
    352                         'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
     352                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(postL10n);}'
    353353                ) );
    354354
    355355                $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20090526' );
     
    361361                        'cancel' => __('Cancel'),
    362362                        'edit' => __('Edit'),
    363363                        'submittedOn' => __('Submitted on:'),
    364                         'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};'
     364                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(commentL10n);}'
    365365                ) );
    366366
    367367                $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090516' );
     
    376376                $scripts->add_data( 'word-count', 'group', 1 );
    377377                $scripts->localize( 'word-count', 'wordCountL10n', array(
    378378                        'count' => __('Word count: %d'),
    379                         'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
     379                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(wordCountL10n);}'
    380380                ));
    381381
    382382                $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox', 'list-table' ), '20101123' );
     
    391391                        'error' => __('Error while saving the changes.'),
    392392                        'ntdeltitle' => __('Remove From Bulk Edit'),
    393393                        'notitle' => __('(no title)'),
    394                         'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
     394                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(inlineEditL10n);}'
    395395                ) );
    396396
    397397                $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), '20100615' );
    398398                $scripts->add_data( 'inline-edit-tax', 'group', 1 );
    399399                $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
    400400                        'error' => __('Error while saving the changes.'),
    401                         'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
     401                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(inlineEditL10n);}'
    402402                ) );
    403403
    404404                $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), '20110113' );
     
    406406                $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
    407407                        'plugin_information' => __('Plugin Information:'),
    408408                        'ays' => __('Are you sure you want to install this plugin?'),
    409                         'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};'
     409                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(plugininstallL10n);}'
    410410                ) );
    411411
    412412                $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
     
    432432                        'saving' => __( 'Saving...' ),
    433433                        'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
    434434                        'done' => __( 'Done' ),
    435                         'l10n_print_after' => 'try{convertEntities(setPostThumbnailL10n);}catch(e){};'
     435                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(setPostThumbnailL10n);}'
    436436                ) );
    437437
    438438                // Navigation Menus
     
    441441                        'noResultsFound' => _x('No results found.', 'search results'),
    442442                        'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
    443443                        'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
    444                         'l10n_print_after' => 'try{convertEntities(navMenuL10n);}catch(e){};'
     444                        'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(navMenuL10n);}'
    445445                ) );
    446446
    447447                $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array('farbtastic'), '20101025' );
     
    565565                'requestFile' => admin_url('admin-ajax.php'),
    566566                'savingText' => __('Saving Draft…'),
    567567                'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
    568                 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};'
     568                'l10n_print_after' => 'if (typeof convertEntities=="function"){convertEntities(autosaveL10n);}'
    569569        ) );
    570570
    571571}
  • wp-admin/install.php

     
    257257 strong: "<?php echo esc_js( __( 'Strong' ) ); ?>",
    258258 mismatch: "<?php echo esc_js( __( 'Mismatch' ) ); ?>"
    259259};
    260 try{convertEntities(pwsL10n);}catch(e){};
     260if (typeof convertEntities=="function"){convertEntities(pwsL10n);}
    261261/* ]]> */
    262262</script>
    263263</body>