<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[21132] trunk: If a plugin triggers the WP_Scripts constructor prior to init, fire wp_default_scripts()</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21132">21132</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-06-26 05:33:19 +0000 (Tue, 26 Jun 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>If a plugin triggers the WP_Scripts constructor prior to init, fire wp_default_scripts()
then and again on init.

Only add our localized strings once we've fired init, in case we do have the situation
where we fire wp_default_scripts() twice.

Fixes issues where plugins or themes try to enqueue a default script handle prior to
init. Does not allow <a href="http://core.trac.wordpress.org/ticket/19959">#19959</a> to regress.

see <a href="http://core.trac.wordpress.org/ticket/20971">#20971</a> for trunk.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminloadscriptsphp">trunk/wp-admin/load-scripts.php</a></li>
<li><a href="#trunkwpincludesclasswpscriptsphp">trunk/wp-includes/class.wp-scripts.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminloadscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/load-scripts.php (21131 => 21132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/load-scripts.php        2012-06-26 05:21:04 UTC (rev 21131)
+++ trunk/wp-admin/load-scripts.php        2012-06-26 05:33:19 UTC (rev 21132)
</span><span class="lines">@@ -54,6 +54,11 @@
</span><span class="cx"> /**
</span><span class="cx">  * @ignore
</span><span class="cx">  */
</span><ins>+function did_action() {}
+
+/**
+ * @ignore
+ */
</ins><span class="cx"> function do_action_ref_array() {}
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludesclasswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-scripts.php (21131 => 21132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-scripts.php        2012-06-26 05:21:04 UTC (rev 21131)
+++ trunk/wp-includes/class.wp-scripts.php        2012-06-26 05:33:19 UTC (rev 21132)
</span><span class="lines">@@ -31,10 +31,8 @@
</span><span class="cx">         var $default_dirs;
</span><span class="cx"> 
</span><span class="cx">         function __construct() {
</span><del>-                if ( ! function_exists( 'did_action' ) || did_action( 'init' ) )
-                        $this-&gt;init();
-                else
-                        add_action( 'init', array( $this, 'init' ), 0 );
</del><ins>+                $this-&gt;init();
+                add_action( 'init', array( $this, 'init' ), 0 );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function init() {
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (21131 => 21132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2012-06-26 05:21:04 UTC (rev 21131)
+++ trunk/wp-includes/script-loader.php        2012-06-26 05:33:19 UTC (rev 21132)
</span><span class="lines">@@ -62,14 +62,14 @@
</span><span class="cx">         $scripts-&gt;add( 'utils', &quot;/wp-admin/js/utils$suffix.js&quot; );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'common', &quot;/wp-admin/js/common$suffix.js&quot;, array('jquery', 'hoverIntent', 'utils'), false, 1 );
</span><del>-        $scripts-&gt;localize( 'common', 'commonL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'common', 'commonL10n', array(
</ins><span class="cx">                 'warnDelete' =&gt; __(&quot;You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.&quot;)
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'sack', &quot;/wp-includes/js/tw-sack$suffix.js&quot;, array(), '1.6.1', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'quicktags', &quot;/wp-includes/js/quicktags$suffix.js&quot;, array(), false, 1 );
</span><del>-        $scripts-&gt;localize( 'quicktags', 'quicktagsL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'quicktags', 'quicktagsL10n', array(
</ins><span class="cx">                 'wordLookup' =&gt; __('Enter a word to look up:'),
</span><span class="cx">                 'dictionaryLookup' =&gt; esc_attr(__('Dictionary lookup')),
</span><span class="cx">                 'lookup' =&gt; esc_attr(__('lookup')),
</span><span class="lines">@@ -93,13 +93,13 @@
</span><span class="cx">         $scripts-&gt;add( 'prototype', '/wp-includes/js/prototype.js', array(), '1.6.1');
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wp-ajax-response', &quot;/wp-includes/js/wp-ajax-response$suffix.js&quot;, array('jquery'), false, 1 );
</span><del>-        $scripts-&gt;localize( 'wp-ajax-response', 'wpAjax', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'wp-ajax-response', 'wpAjax', array(
</ins><span class="cx">                 'noPerm' =&gt; __('You do not have permission to do that.'),
</span><span class="cx">                 'broken' =&gt; __('An unidentified error has occurred.')
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wp-pointer', &quot;/wp-includes/js/wp-pointer$suffix.js&quot;, array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
</span><del>-        $scripts-&gt;localize( 'wp-pointer', 'wpPointerL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'wp-pointer', 'wpPointerL10n', array(
</ins><span class="cx">                 'dismiss' =&gt; __('Dismiss'),
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx">         $scripts-&gt;add( 'jquery-touch-punch', &quot;/wp-includes/js/jquery/jquery.ui.touch-punch.js&quot;, array('jquery-ui-widget', 'jquery-ui-mouse'), '0.2.2', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'thickbox', &quot;/wp-includes/js/thickbox/thickbox.js&quot;, array('jquery'), '3.1-20111117', 1 );
</span><del>-        $scripts-&gt;localize( 'thickbox', 'thickboxL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'thickbox', 'thickboxL10n', array(
</ins><span class="cx">                         'next' =&gt; __('Next &amp;gt;'),
</span><span class="cx">                         'prev' =&gt; __('&amp;lt; Prev'),
</span><span class="cx">                         'image' =&gt; __('Image'),
</span><span class="lines">@@ -227,10 +227,10 @@
</span><span class="cx">         $scripts-&gt;add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1.5.4' );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'plupload-handlers', &quot;/wp-includes/js/plupload/handlers$suffix.js&quot;, array('plupload-all', 'jquery') );
</span><del>-        $scripts-&gt;localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
</ins><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wp-plupload', &quot;/wp-includes/js/plupload/wp-plupload$suffix.js&quot;, array('plupload-all', 'jquery', 'json2') );
</span><del>-        $scripts-&gt;localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
</ins><span class="cx"> 
</span><span class="cx">         // keep 'swfupload' for back-compat.
</span><span class="cx">         $scripts-&gt;add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113');
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'swfupload-handlers', &quot;/wp-includes/js/swfupload/handlers$suffix.js&quot;, array('swfupload-all', 'jquery'), '2201-20110524');
</span><del>-        $scripts-&gt;localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
</ins><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'comment-reply', &quot;/wp-includes/js/comment-reply$suffix.js&quot; );
</span><span class="cx"> 
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx">         $scripts-&gt;add( 'imgareaselect', &quot;/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js&quot;, array('jquery'), '0.9.8', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'password-strength-meter', &quot;/wp-admin/js/password-strength-meter$suffix.js&quot;, array('jquery'), false, 1 );
</span><del>-        $scripts-&gt;localize( 'password-strength-meter', 'pwsL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'password-strength-meter', 'pwsL10n', array(
</ins><span class="cx">                 'empty' =&gt; __('Strength indicator'),
</span><span class="cx">                 'short' =&gt; __('Very weak'),
</span><span class="cx">                 'bad' =&gt; __('Weak'),
</span><span class="lines">@@ -272,7 +272,7 @@
</span><span class="cx">         $scripts-&gt;add( 'admin-bar', &quot;/wp-includes/js/admin-bar$suffix.js&quot;, array(), false, 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wplink', &quot;/wp-includes/js/wplink$suffix.js&quot;, array( 'jquery', 'wpdialogs' ), false, 1 );
</span><del>-        $scripts-&gt;localize( 'wplink', 'wpLinkL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'wplink', 'wpLinkL10n', array(
</ins><span class="cx">                 'title' =&gt; __('Insert/edit link'),
</span><span class="cx">                 'update' =&gt; __('Update'),
</span><span class="cx">                 'save' =&gt; __('Add Link'),
</span><span class="lines">@@ -285,7 +285,7 @@
</span><span class="cx">         $scripts-&gt;add( 'wpdialogs-popup', &quot;/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js&quot;, array( 'wpdialogs' ), false, 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'word-count', &quot;/wp-admin/js/word-count$suffix.js&quot;, array( 'jquery' ), false, 1 );
</span><del>-        $scripts-&gt;localize( 'word-count', 'wordCountL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'word-count', 'wordCountL10n', array(
</ins><span class="cx">                 /* translators: If your word count is based on single characters (East Asian characters),
</span><span class="cx">                    enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
</span><span class="cx">                 'type' =&gt; 'characters' == _x( 'words', 'word count: words or characters?' ) ? 'c' : 'w',
</span><span class="lines">@@ -299,7 +299,7 @@
</span><span class="cx">         $scripts-&gt;add( 'customize-loader',   &quot;/wp-includes/js/customize-loader$suffix.js&quot;,   array( 'customize-base' ), false, 1 );
</span><span class="cx">         $scripts-&gt;add( 'customize-preview',  &quot;/wp-includes/js/customize-preview$suffix.js&quot;,  array( 'customize-base' ), false, 1 );
</span><span class="cx">         $scripts-&gt;add( 'customize-controls', &quot;/wp-admin/js/customize-controls$suffix.js&quot;, array( 'customize-base' ), false, 1 );
</span><del>-        $scripts-&gt;localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
</del><ins>+        did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
</ins><span class="cx">                 'activate'  =&gt; __( 'Save &amp;amp; Activate' ),
</span><span class="cx">                 'save'      =&gt; __( 'Save &amp;amp; Publish' ),
</span><span class="cx">                 'saved'     =&gt; __( 'Saved' ),
</span><span class="lines">@@ -311,7 +311,7 @@
</span><span class="cx">         if ( is_admin() ) {
</span><span class="cx">                 $scripts-&gt;add( 'ajaxcat', &quot;/wp-admin/js/cat$suffix.js&quot;, array( 'wp-lists' ) );
</span><span class="cx">                 $scripts-&gt;add_data( 'ajaxcat', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'ajaxcat', 'catL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'ajaxcat', 'catL10n', array(
</ins><span class="cx">                         'add' =&gt; esc_attr(__('Add')),
</span><span class="cx">                         'how' =&gt; __('Separate multiple categories with commas.')
</span><span class="cx">                 ) );
</span><span class="lines">@@ -319,7 +319,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'admin-categories', &quot;/wp-admin/js/categories$suffix.js&quot;, array('wp-lists'), false, 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'admin-tags', &quot;/wp-admin/js/tags$suffix.js&quot;, array('jquery', 'wp-ajax-response'), false, 1 );
</span><del>-                $scripts-&gt;localize( 'admin-tags', 'tagsl10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'admin-tags', 'tagsl10n', array(
</ins><span class="cx">                         'noPerm' =&gt; __('You do not have permission to do that.'),
</span><span class="cx">                         'broken' =&gt; __('An unidentified error has occurred.')
</span><span class="cx">                 ));
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'admin-custom-fields', &quot;/wp-admin/js/custom-fields$suffix.js&quot;, array('wp-lists'), false, 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'admin-comments', &quot;/wp-admin/js/edit-comments$suffix.js&quot;, array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
</span><del>-                $scripts-&gt;localize( 'admin-comments', 'adminCommentsL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'admin-comments', 'adminCommentsL10n', array(
</ins><span class="cx">                         'hotkeys_highlight_first' =&gt; isset($_GET['hotkeys_highlight_first']),
</span><span class="cx">                         'hotkeys_highlight_last' =&gt; isset($_GET['hotkeys_highlight_last']),
</span><span class="cx">                         'replyApprove' =&gt; __( 'Approve and Reply' ),
</span><span class="lines">@@ -339,7 +339,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'postbox', &quot;/wp-admin/js/postbox$suffix.js&quot;, array('jquery-ui-sortable'), false, 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'post', &quot;/wp-admin/js/post$suffix.js&quot;, array('suggest', 'wp-lists', 'postbox'), false, 1 );
</span><del>-                $scripts-&gt;localize( 'post', 'postL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'post', 'postL10n', array(
</ins><span class="cx">                         'ok' =&gt; __('OK'),
</span><span class="cx">                         'cancel' =&gt; __('Cancel'),
</span><span class="cx">                         'publishOn' =&gt; __('Publish on:'),
</span><span class="lines">@@ -365,7 +365,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'comment', &quot;/wp-admin/js/comment$suffix.js&quot;, array('jquery') );
</span><span class="cx">                 $scripts-&gt;add_data( 'comment', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'comment', 'commentL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'comment', 'commentL10n', array(
</ins><span class="cx">                         'submittedOn' =&gt; __('Submitted on:')
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="lines">@@ -379,7 +379,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'theme-preview', &quot;/wp-admin/js/theme-preview$suffix.js&quot;, array( 'thickbox', 'jquery' ), false, 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'inline-edit-post', &quot;/wp-admin/js/inline-edit-post$suffix.js&quot;, array( 'jquery', 'suggest' ), false, 1 );
</span><del>-                $scripts-&gt;localize( 'inline-edit-post', 'inlineEditL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'inline-edit-post', 'inlineEditL10n', array(
</ins><span class="cx">                         'error' =&gt; __('Error while saving the changes.'),
</span><span class="cx">                         'ntdeltitle' =&gt; __('Remove From Bulk Edit'),
</span><span class="cx">                         'notitle' =&gt; __('(no title)'),
</span><span class="lines">@@ -387,12 +387,12 @@
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'inline-edit-tax', &quot;/wp-admin/js/inline-edit-tax$suffix.js&quot;, array( 'jquery' ), false, 1 );
</span><del>-                $scripts-&gt;localize( 'inline-edit-tax', 'inlineEditL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'inline-edit-tax', 'inlineEditL10n', array(
</ins><span class="cx">                         'error' =&gt; __('Error while saving the changes.')
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'plugin-install', &quot;/wp-admin/js/plugin-install$suffix.js&quot;, array( 'jquery', 'thickbox' ), false, 1 );
</span><del>-                $scripts-&gt;localize( 'plugin-install', 'plugininstallL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'plugin-install', 'plugininstallL10n', array(
</ins><span class="cx">                         'plugin_information' =&gt; __('Plugin Information:'),
</span><span class="cx">                         'ays' =&gt; __('Are you sure you want to install this plugin?')
</span><span class="cx">                 ) );
</span><span class="lines">@@ -406,12 +406,12 @@
</span><span class="cx">                 $scripts-&gt;add( 'media', &quot;/wp-admin/js/media$suffix.js&quot;, array( 'jquery-ui-draggable' ), false, 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'image-edit', &quot;/wp-admin/js/image-edit$suffix.js&quot;, array('jquery', 'json2', 'imgareaselect'), false, 1 );
</span><del>-                $scripts-&gt;localize( 'image-edit', 'imageEditL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'image-edit', 'imageEditL10n', array(
</ins><span class="cx">                         'error' =&gt; __( 'Could not load the preview image. Please reload the page and try again.' )
</span><span class="cx">                 ));
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'set-post-thumbnail', &quot;/wp-admin/js/set-post-thumbnail$suffix.js&quot;, array( 'jquery' ), false, 1 );
</span><del>-                $scripts-&gt;localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
</ins><span class="cx">                         'setThumbnail' =&gt; __( 'Use as featured image' ),
</span><span class="cx">                         'saving' =&gt; __( 'Saving...' ),
</span><span class="cx">                         'error' =&gt; __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
</span><span class="lines">@@ -420,7 +420,7 @@
</span><span class="cx"> 
</span><span class="cx">                 // Navigation Menus
</span><span class="cx">                 $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, array('jquery-ui-sortable') );
</span><del>-                $scripts-&gt;localize( 'nav-menu', 'navMenuL10n', array(
</del><ins>+                did_action( 'init' ) &amp;&amp; $scripts-&gt;localize( 'nav-menu', 'navMenuL10n', array(
</ins><span class="cx">                         'noResultsFound' =&gt; _x('No results found.', 'search results'),
</span><span class="cx">                         'warnDeleteMenu' =&gt; __( &quot;You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete.&quot; ),
</span><span class="cx">                         'saveAlert' =&gt; __('The changes you made will be lost if you navigate away from this page.')
</span></span></pre>
</div>
</div>

</body>
</html>