<!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>[19217] trunk: Ressurect WP_Scripts::localize() and fix public function names, fixes #11520</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/19217">19217</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2011-11-08 18:05:59 +0000 (Tue, 08 Nov 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Ressurect WP_Scripts::localize() and fix public function names, fixes <a href="http://core.trac.wordpress.org/ticket/11520">#11520</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjswpfullscreendevjs">trunk/wp-admin/js/wp-fullscreen.dev.js</a></li>
<li><a href="#trunkwpincludesclasswpscriptsphp">trunk/wp-includes/class.wp-scripts.php</a></li>
<li><a href="#trunkwpincludesfunctionswpscriptsphp">trunk/wp-includes/functions.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="trunkwpadminjswpfullscreendevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/wp-fullscreen.dev.js (19216 => 19217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/wp-fullscreen.dev.js        2011-11-08 17:53:52 UTC (rev 19216)
+++ trunk/wp-admin/js/wp-fullscreen.dev.js        2011-11-08 18:05:59 UTC (rev 19217)
</span><span class="lines">@@ -138,8 +138,8 @@
</span><span class="cx">                         return;
</span><span class="cx"> 
</span><span class="cx">                 // Settings can be added or changed by defining &quot;wp_fullscreen_settings&quot; JS object.
</span><del>-                // This can be done by defining it as PHP array and passing it to JS with:
-                // add_script_data( 'wp-fullscreen', 'wp_fullscreen_settings', $settings_array )
</del><ins>+                // This can be done by defining it as PHP associative array, json encoding it and passing it to JS with:
+                // wp_add_script_before( 'wp-fullscreen', 'wp_fullscreen_settings = ' . $json_encoded_array . ';' );
</ins><span class="cx">                 if ( typeof(wp_fullscreen_settings) == 'object' )
</span><span class="cx">                         $.extend( s, wp_fullscreen_settings );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesclasswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-scripts.php (19216 => 19217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-scripts.php        2011-11-08 17:53:52 UTC (rev 19216)
+++ trunk/wp-includes/class.wp-scripts.php        2011-11-08 18:05:59 UTC (rev 19217)
</span><span class="lines">@@ -47,42 +47,22 @@
</span><span class="cx">                 return $this-&gt;do_items( $handles, $group );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // Deprecated since 3.3, see print_script_data()
</del><ins>+        // Deprecated since 3.3, see print_extra_script()
</ins><span class="cx">         function print_scripts_l10n( $handle, $echo = true ) {
</span><del>-                _deprecated_function( __FUNCTION__, '3.3', 'print_script_data()' );
-                return $this-&gt;print_script_data( $handle, $echo, true );
</del><ins>+                _deprecated_function( __FUNCTION__, '3.3', 'print_extra_script()' );
+                return $this-&gt;print_extra_script( $handle, $echo );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function print_script_data( $handle, $echo = true, $_l10n = false ) {
-                if ( $_l10n ) {
-                        list( $name, $data ) = $this-&gt;get_data( $handle, 'l10n' );
-                        $after = '';
</del><ins>+        function print_extra_script( $handle, $echo = true ) {
+                if ( !$output = $this-&gt;get_data( $handle, 'data' ) )
+                        return;
</ins><span class="cx"> 
</span><del>-                        if ( is_array($data) &amp;&amp; isset($data['l10n_print_after']) ) {
-                                $after = $data['l10n_print_after'];
-                                unset($data['l10n_print_after']);
-                        }
-
-                        $data = $this-&gt;decode_html_entities($data);
-                        $output = &quot;var $name = &quot; . json_encode( $data ) . &quot;; $after\n&quot;;
-                } else {
-                        $data = $this-&gt;get_data( $handle, 'data' );
-
-                        if ( empty( $data ) )
-                                return false;
-
-                        foreach ( (array) $data as $name =&gt; $value ) {
-                                $value = $this-&gt;decode_html_entities($value);
-                                $output = &quot;var $name = &quot; . json_encode( $value ) . &quot;;\n&quot;;
-                        }
-                }
-
</del><span class="cx">                 if ( !$echo )
</span><span class="cx">                         return $output;
</span><span class="cx"> 
</span><del>-                echo &quot;&lt;script type='text/javascript'&gt;\n&quot;;
-                echo &quot;/* &lt;![CDATA[ */\n&quot;; // CDATA is not needed for HTML 5
-                echo $output;
</del><ins>+                echo &quot;&lt;script type='text/javascript'&gt;\n&quot;; // CDATA and type='text/javascript' is not needed for HTML 5
+                echo &quot;/* &lt;![CDATA[ */\n&quot;;
+                echo &quot;$output\n&quot;;
</ins><span class="cx">                 echo &quot;/* ]]&gt; */\n&quot;;
</span><span class="cx">                 echo &quot;&lt;/script&gt;\n&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -114,7 +94,7 @@
</span><span class="cx">                 if ( $this-&gt;do_concat ) {
</span><span class="cx">                         $srce = apply_filters( 'script_loader_src', $src, $handle );
</span><span class="cx">                         if ( $this-&gt;in_default_dir($srce) ) {
</span><del>-                                $this-&gt;print_code .= $this-&gt;print_script_data( $handle, false );
</del><ins>+                                $this-&gt;print_code .= $this-&gt;print_extra_script( $handle, false );
</ins><span class="cx">                                 $this-&gt;concat .= &quot;$handle,&quot;;
</span><span class="cx">                                 $this-&gt;concat_version .= &quot;$handle$ver&quot;;
</span><span class="cx">                                 return true;
</span><span class="lines">@@ -124,15 +104,16 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $this-&gt;print_script_data( $handle );
</del><ins>+                $this-&gt;print_extra_script( $handle );
</ins><span class="cx">                 if ( !preg_match('|^https?://|', $src) &amp;&amp; ! ( $this-&gt;content_url &amp;&amp; 0 === strpos($src, $this-&gt;content_url) ) ) {
</span><span class="cx">                         $src = $this-&gt;base_url . $src;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( !empty($ver) )
</span><span class="cx">                         $src = add_query_arg('ver', $ver, $src);
</span><del>-                $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
</del><span class="cx"> 
</span><ins>+                $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
+
</ins><span class="cx">                 if ( $this-&gt;do_concat )
</span><span class="cx">                         $this-&gt;print_html .= &quot;&lt;script type='text/javascript' src='$src'&gt;&lt;/script&gt;\n&quot;;
</span><span class="cx">                 else
</span><span class="lines">@@ -142,15 +123,29 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Localizes a script (Deprecated)
</del><ins>+         * Localizes a script
</ins><span class="cx">          *
</span><del>-         * Localizes only if script has already been added
-         *
-         * @deprecated WP 3.3
</del><ins>+         * Localizes only if the script has already been added
</ins><span class="cx">          */
</span><span class="cx">         function localize( $handle, $object_name, $l10n ) {
</span><del>-                _deprecated_function( __FUNCTION__, '3.3', 'add_script_data()' );
-                return $this-&gt;add_script_data( $handle, $object_name, $l10n );
</del><ins>+                if ( is_array($l10n) &amp;&amp; isset($l10n['l10n_print_after']) ) { // back compat, preserve the code in 'l10n_print_after' if present
+                        $after = $l10n['l10n_print_after'];
+                        unset($l10n['l10n_print_after']);
+                }
+
+                foreach ( (array) $l10n as $key =&gt; $value ) {
+                        if ( !is_scalar($value) )
+                                continue;
+
+                        $l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8');
+                }
+
+                $script = &quot;var $object_name = &quot; . json_encode($l10n) . ';';
+
+                if ( !empty($after) )
+                        $script .= &quot;\n$after&quot;;
+
+                return $this-&gt;add_script_data( $handle, $script );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -159,20 +154,19 @@
</span><span class="cx">          * Only if script has already been added.
</span><span class="cx">          *
</span><span class="cx">          * @param string $handle Script name
</span><del>-         * @param string $name Name of JS object to hold the data
-         * @param array $args Associative array of JS object attributes
</del><ins>+         * @param string $script Extra JS to add before the script
</ins><span class="cx">          * @return bool Successful or not
</span><span class="cx">          */
</span><del>-        function add_script_data( $handle, $name, $args ) {
-                if ( !$name || !is_array( $args ) )
</del><ins>+        function add_script_data( $handle, $script ) {
+                if ( !is_string( $script ) )
</ins><span class="cx">                         return false;
</span><span class="cx"> 
</span><span class="cx">                 $data = $this-&gt;get_data( $handle, 'data' );
</span><span class="cx"> 
</span><del>-                if ( !empty( $data[$name] ) )
-                        $args = array_merge( $data[$name], $args );
</del><ins>+                if ( !empty( $data ) )
+                        $script = &quot;$data;\n$script&quot;;
</ins><span class="cx"> 
</span><del>-                return $this-&gt;add_data( $handle, 'data', array( $name =&gt; $args ) );
</del><ins>+                return $this-&gt;add_data( $handle, 'data', $script );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function set_group( $handle, $recursion, $group = false ) {
</span><span class="lines">@@ -219,16 +213,6 @@
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function decode_html_entities($data) {
-                foreach ( (array) $data as $key =&gt; $value ) {
-                        if ( is_array($value) )
-                                $data[$key] = $this-&gt;decode_html_entities($value);
-                        elseif ( is_string($value) )
-                                $data[$key] = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
-                }
-                return $data;
-        }
-
</del><span class="cx">         function reset() {
</span><span class="cx">                 $this-&gt;do_concat = false;
</span><span class="cx">                 $this-&gt;print_code = '';
</span></span></pre></div>
<a id="trunkwpincludesfunctionswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.wp-scripts.php (19216 => 19217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.wp-scripts.php        2011-11-08 17:53:52 UTC (rev 19216)
+++ trunk/wp-includes/functions.wp-scripts.php        2011-11-08 18:05:59 UTC (rev 19217)
</span><span class="lines">@@ -64,24 +64,48 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Adds extra Javascript data.
</del><ins>+ * Wrapper for $wp_scripts-&gt;localize().
</ins><span class="cx">  *
</span><ins>+ * Used to localizes a script.
</ins><span class="cx">  * Works only if the script has already been added.
</span><del>- * Accepts an associative array $data and creates JS object:
- * &quot;$name&quot; = {
</del><ins>+ * Accepts an associative array $l10n and creates JS object:
+ * &quot;$object_name&quot; = {
</ins><span class="cx">  *   key: value,
</span><span class="cx">  *   key: value,
</span><span class="cx">  *   ...
</span><span class="cx">  * }
</span><del>- * The $name is passed directly so it should be qualified JS variable /[a-zA-Z0-9_]+/
- * The $data array is JSON encoded. If called more than once for the same $handle with the same $name,
- * the object would contain all values. In that case if two or more keys are the same,
- * the last value overwrites the previous. The function is named &quot;localize_script&quot; because of historical reasons.
</del><ins>+ * See http://core.trac.wordpress.org/ticket/11520 for more information.
</ins><span class="cx">  *
</span><span class="cx">  * @since r16
</span><ins>+ *
+ * @param string $handle The script handle that was registered or used in script-loader
+ * @param string $object_name Name for the created JS object. This is passed directly so it should be qualified JS variable /[a-zA-Z0-9_]+/
+ * @param array $l10n Associative PHP array containing the translated strings. HTML entities will be converted and the array will be JSON encoded. 
+ * @return bool Whether the localization was added successfully.
+ */
+function wp_localize_script( $handle, $object_name, $l10n ) { 
+        global $wp_scripts;
+        if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+                if ( ! did_action( 'init' ) )
+                        _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+                                '&lt;code&gt;wp_enqueue_scripts&lt;/code&gt;', '&lt;code&gt;admin_enqueue_scripts&lt;/code&gt;', '&lt;code&gt;init&lt;/code&gt;' ), '3.3' );
+
+                return false;
+        }
+
+        return $wp_scripts-&gt;localize( $handle, $object_name, $l10n ); 
+} 
+
+/**
+ * Adds extra Javascript.
+ *
+ * Works only if the script referenced by $handle has already been added.
+ * Accepts string $extra that will be printed as script before the main script tag.
+ *
+ * @since 3.3
</ins><span class="cx">  * @see WP_Scripts::add_script_data()
</span><span class="cx">  */
</span><del>-function wp_localize_script( $handle, $name, $data ) {
</del><ins>+function wp_add_script_before( $handle, $script ) {
</ins><span class="cx">         global $wp_scripts;
</span><span class="cx">         if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
</span><span class="cx">                 if ( ! did_action( 'init' ) )
</span><span class="lines">@@ -90,7 +114,7 @@
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return $wp_scripts-&gt;add_script_data( $handle, $name, $data );
</del><ins>+        return $wp_scripts-&gt;add_script_data( $handle, $script );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (19216 => 19217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2011-11-08 17:53:52 UTC (rev 19216)
+++ trunk/wp-includes/script-loader.php        2011-11-08 18:05:59 UTC (rev 19217)
</span><span class="lines">@@ -62,14 +62,14 @@
</span><span class="cx">         $scripts-&gt;add( 'utils', &quot;/wp-admin/js/utils$suffix.js&quot;, false, '20101110' );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'common', &quot;/wp-admin/js/common$suffix.js&quot;, array('jquery', 'hoverIntent', 'utils'), '20111106a', 1 );
</span><del>-        $scripts-&gt;add_script_data( 'common', 'commonL10n', array(
</del><ins>+        $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;, false, '1.6.1', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'quicktags', &quot;/wp-includes/js/quicktags$suffix.js&quot;, false, '20111108', 1 );
</span><del>-        $scripts-&gt;add_script_data( 'quicktags', 'quicktagsL10n', array(
</del><ins>+        $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">@@ -91,13 +91,13 @@
</span><span class="cx">         $scripts-&gt;add( 'prototype', '/wp-includes/js/prototype.js', false, '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'), '20091119', 1 );
</span><del>-        $scripts-&gt;add_script_data( 'wp-ajax-response', 'wpAjax', array(
</del><ins>+        $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' ), '20111017', 1 );
</span><del>-        $scripts-&gt;add_script_data( 'wp-pointer', 'wpPointerL10n', array(
</del><ins>+        $scripts-&gt;localize( 'wp-pointer', 'wpPointerL10n', array(
</ins><span class="cx">                 'close' =&gt; __('Close'),
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx">         $scripts-&gt;add( 'jquery-table-hotkeys', &quot;/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js&quot;, array('jquery', 'jquery-hotkeys'), '20090102', 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-20110930', 1 );
</span><del>-        $scripts-&gt;add_script_data( 'thickbox', 'thickboxL10n', array(
</del><ins>+        $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">@@ -221,7 +221,7 @@
</span><span class="cx">         $scripts-&gt;add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1511');
</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'), '20111102');
</span><del>-        $scripts-&gt;add_script_data( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
</del><ins>+        $scripts-&gt;localize( 'plupload-handlers', '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', false, '2201-20110113');
</span><span class="lines">@@ -237,7 +237,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;add_script_data( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
</del><ins>+        $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;, false, '20090102');
</span><span class="cx"> 
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">         $scripts-&gt;add( 'imgareaselect', &quot;/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js&quot;, array('jquery'), '0.9.6-20110515', 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'), '20101027', 1 );
</span><del>-        $scripts-&gt;add_script_data( 'password-strength-meter', 'pwsL10n', array(
</del><ins>+        $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">@@ -261,7 +261,7 @@
</span><span class="cx">         $scripts-&gt;add( 'admin-bar', &quot;/wp-includes/js/admin-bar$suffix.js&quot;, false, '20111107', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wplink', &quot;/wp-includes/js/wplink$suffix.js&quot;, array( 'jquery', 'wpdialogs' ), '20110929', 1 );
</span><del>-        $scripts-&gt;add_script_data( 'wplink', 'wpLinkL10n', array(
</del><ins>+        $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">@@ -280,7 +280,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' ), '20090102' );
</span><span class="cx">                 $scripts-&gt;add_data( 'ajaxcat', 'group', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'ajaxcat', 'catL10n', array(
</del><ins>+                $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">@@ -288,7 +288,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'admin-categories', &quot;/wp-admin/js/categories$suffix.js&quot;, array('wp-lists'), '20091201', 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'), '20110429', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'admin-tags', 'tagsl10n', array(
</del><ins>+                $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">@@ -296,7 +296,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'admin-custom-fields', &quot;/wp-admin/js/custom-fields$suffix.js&quot;, array('wp-lists'), '20110429', 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'), '20111026', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'admin-comments', 'adminCommentsL10n', array(
</del><ins>+                $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">@@ -308,7 +308,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'postbox', &quot;/wp-admin/js/postbox$suffix.js&quot;, array('jquery-ui-sortable'), '20111009a', 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'), '20110524', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'post', 'postL10n', array(
</del><ins>+                $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">@@ -333,7 +333,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'comment', &quot;/wp-admin/js/comment$suffix.js&quot;, array('jquery'), '20110429' );
</span><span class="cx">                 $scripts-&gt;add_data( 'comment', 'group', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'comment', 'commentL10n', array(
</del><ins>+                $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">@@ -346,19 +346,19 @@
</span><span class="cx">                 $scripts-&gt;add( 'theme-preview', &quot;/wp-admin/js/theme-preview$suffix.js&quot;, array( 'thickbox', 'jquery' ), '20100407', 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' ), '20111107', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'inline-edit-post', 'inlineEditL10n', array(
</del><ins>+                $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="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' ), '20110609', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'inline-edit-tax', 'inlineEditL10n', array(
</del><ins>+                $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' ), '20110113', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'plugin-install', 'plugininstallL10n', array(
</del><ins>+                $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">@@ -374,12 +374,12 @@
</span><span class="cx">                 $scripts-&gt;add( 'media', &quot;/wp-admin/js/media$suffix.js&quot;, array( 'jquery-ui-draggable' ), '20101022', 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'), '20110927', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'image-edit', 'imageEditL10n', array(
</del><ins>+                $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' ), '20100518', 1 );
</span><del>-                $scripts-&gt;add_script_data( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
</del><ins>+                $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">@@ -388,7 +388,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'), '20110524' );
</span><del>-                $scripts-&gt;add_script_data( 'nav-menu', 'navMenuL10n', array(
</del><ins>+                $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>