<!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>[18464] trunk: Use json_encode() for adding script data (formerly l10n).</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/18464">18464</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2011-07-25 00:36:06 +0000 (Mon, 25 Jul 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use json_encode() for adding script data (formerly l10n). Add the same functionality to WP_Styles for adding inline css after a stylesheet has been outputted. See <a href="http://core.trac.wordpress.org/ticket/11520">#11520</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminloadstylesphp">trunk/wp-admin/load-styles.php</a></li>
<li><a href="#trunkwpincludesclasswpscriptsphp">trunk/wp-includes/class.wp-scripts.php</a></li>
<li><a href="#trunkwpincludesclasswpstylesphp">trunk/wp-includes/class.wp-styles.php</a></li>
<li><a href="#trunkwpincludesdeprecatedphp">trunk/wp-includes/deprecated.php</a></li>
<li><a href="#trunkwpincludesfunctionswpscriptsphp">trunk/wp-includes/functions.wp-scripts.php</a></li>
<li><a href="#trunkwpincludesfunctionswpstylesphp">trunk/wp-includes/functions.wp-styles.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpincludesjsl10ndevjs">trunk/wp-includes/js/l10n.dev.js</a></li>
<li><a href="#trunkwpincludesjsl10njs">trunk/wp-includes/js/l10n.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminloadstylesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/load-styles.php (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/load-styles.php        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-admin/load-styles.php        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -125,7 +125,10 @@
</span><span class="cx">                 $content .= get_file($rtl_path) . &quot;\n&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $out .= str_replace( '../images/', 'images/', $content );
</del><ins>+        if ( strpos( $style-&gt;src, '/wp-includes/css/' ) === 0 )
+                $out .= str_replace( '../images/', '../wp-includes/images/', $content );
+        else
+                $out .= str_replace( '../images/', 'images/', $content );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> header('Content-Type: text/css');
</span></span></pre></div>
<a id="trunkwpincludesclasswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-scripts.php (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-scripts.php        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/class.wp-scripts.php        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -47,35 +47,42 @@
</span><span class="cx">                 return $this-&gt;do_items( $handles, $group );
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        // Deprecated since 3.3, see print_script_data()
</ins><span class="cx">         function print_scripts_l10n( $handle, $echo = true ) {
</span><del>-                if ( empty($this-&gt;registered[$handle]-&gt;extra['l10n']) || empty($this-&gt;registered[$handle]-&gt;extra['l10n'][0]) || !is_array($this-&gt;registered[$handle]-&gt;extra['l10n'][1]) )
</del><ins>+                _deprecated_function( __FUNCTION__, '3.3', 'print_script_data()' );
+                return $this-&gt;print_script_data( $handle, $echo, true );
+        }
+
+        function print_script_data( $handle, $echo = true, $_l10n = false ) {
+                if ( empty($this-&gt;registered[$handle]-&gt;extra['data']) )
</ins><span class="cx">                         return false;
</span><span class="cx"> 
</span><del>-                $object_name = $this-&gt;registered[$handle]-&gt;extra['l10n'][0];
</del><ins>+                if ( $_l10n ) {
+                        $name = $this-&gt;registered[$handle]-&gt;extra['l10n'][0];
+                        $data = $this-&gt;registered[$handle]-&gt;extra['l10n'][1];
+                        $after = '';
</ins><span class="cx"> 
</span><del>-                $data = &quot;var $object_name = {\n&quot;;
-                $eol = '';
-                foreach ( $this-&gt;registered[$handle]-&gt;extra['l10n'][1] as $var =&gt; $val ) {
-                        if ( 'l10n_print_after' == $var ) {
-                                $after = $val;
-                                continue;
</del><ins>+                        if ( is_array($data) &amp;&amp; isset($data['l10n_print_after']) ) {
+                                $after = $data['l10n_print_after'];
+                                unset($data['l10n_print_after']);
</ins><span class="cx">                         }
</span><del>-                        $data .= &quot;$eol\t$var: \&quot;&quot; . esc_js( $val ) . '&quot;';
-                        $eol = &quot;,\n&quot;;
</del><ins>+                        $output = &quot;var $name = &quot; . json_encode($data) . &quot;; $after\n&quot;;
+                } else {
+                        foreach ( (array) $this-&gt;registered[$handle]-&gt;extra['data'] as $name =&gt; $data ) {
+                                $output = &quot;var $name = &quot; . json_encode($data) . &quot;;\n&quot;;
+                        }
</ins><span class="cx">                 }
</span><del>-                $data .= &quot;\n};\n&quot;;
-                $data .= isset($after) ? &quot;$after\n&quot; : '';
</del><span class="cx"> 
</span><del>-                if ( $echo ) {
-                        echo &quot;&lt;script type='text/javascript'&gt;\n&quot;;
-                        echo &quot;/* &lt;![CDATA[ */\n&quot;;
-                        echo $data;
-                        echo &quot;/* ]]&gt; */\n&quot;;
-                        echo &quot;&lt;/script&gt;\n&quot;;
-                        return true;
-                } else {
-                        return $data;
-                }
</del><ins>+                if ( !$echo )
+                        return $output;
+
+                echo &quot;&lt;script type='text/javascript'&gt;\n&quot;;
+                echo &quot;/* &lt;![CDATA[ */\n&quot;; // not needed in HTML 5
+                echo $output;
+                echo &quot;\n/* ]]&gt; */&quot;;
+                echo &quot;\n&lt;/script&gt;\n&quot;;
+
+                return true;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function do_item( $handle, $group = false ) {
</span><span class="lines">@@ -103,7 +110,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_scripts_l10n( $handle, false );
</del><ins>+                                $this-&gt;print_code .= $this-&gt;print_script_data( $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">@@ -113,7 +120,7 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $this-&gt;print_scripts_l10n( $handle );
</del><ins>+                $this-&gt;print_script_data( $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="lines">@@ -131,19 +138,36 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Localizes a script
</del><ins>+         * Localizes a script (Deprecated)
</ins><span class="cx">          *
</span><span class="cx">          * Localizes only if script has already been added
</span><span class="cx">          *
</span><ins>+         * @since 
+         * @deprecated WP 3.3
+         */
+        function localize( $handle, $object_name, $l10n ) {
+                _deprecated_function( __FUNCTION__, '3.3', 'add_script_data()' );
+                return $this-&gt;add_script_data( $handle, $object_name, $l10n );
+        }
+
+        /**
+         * Add extra Javascript
+         *
+         * Only if script has already been added.
+         *
</ins><span class="cx">          * @param string $handle Script name
</span><del>-         * @param string $object_name Name of JS object to hold l10n info
-         * @param array $l10n Array of JS var name =&gt; localized string
-         * @return bool Successful localization
</del><ins>+         * @param string $name Name of JS object to hold the data
+         * @param array $data Associative array of JS name =&gt; value
+         * @return bool Successful or not
</ins><span class="cx">          */
</span><del>-        function localize( $handle, $object_name, $l10n ) {
-                if ( !$object_name || !$l10n )
</del><ins>+        function add_script_data( $handle, $name, $data ) {
+                if ( !$name || !is_array($data) )
</ins><span class="cx">                         return false;
</span><del>-                return $this-&gt;add_data( $handle, 'l10n', array( $object_name, $l10n ) );
</del><ins>+
+                if ( !empty( $this-&gt;registered[$handle]-&gt;extra['data'][$name] ) )
+                        $data = array_merge( $data, (array) $this-&gt;registered[$handle]-&gt;extra['data'][$name] );
+
+                return $this-&gt;add_data( $handle, 'data', array( $name =&gt; $data ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function set_group( $handle, $recursion, $group = false ) {
</span></span></pre></div>
<a id="trunkwpincludesclasswpstylesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-styles.php (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-styles.php        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/class.wp-styles.php        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">         var $concat_version = '';
</span><span class="cx">         var $do_concat = false;
</span><span class="cx">         var $print_html = '';
</span><ins>+        var $print_code = '';
</ins><span class="cx">         var $default_dirs;
</span><span class="cx"> 
</span><span class="cx">         function __construct() {
</span><span class="lines">@@ -35,44 +36,49 @@
</span><span class="cx">                 if ( !parent::do_item($handle) )
</span><span class="cx">                         return false;
</span><span class="cx"> 
</span><del>-                if ( null === $this-&gt;registered[$handle]-&gt;ver )
</del><ins>+                $obj = $this-&gt;registered[$handle];
+                if ( null === $obj-&gt;ver )
</ins><span class="cx">                         $ver = '';
</span><span class="cx">                 else
</span><del>-                        $ver = $this-&gt;registered[$handle]-&gt;ver ? $this-&gt;registered[$handle]-&gt;ver : $this-&gt;default_version;
</del><ins>+                        $ver = $obj-&gt;ver ? $obj-&gt;ver : $this-&gt;default_version;
</ins><span class="cx"> 
</span><span class="cx">                 if ( isset($this-&gt;args[$handle]) )
</span><span class="cx">                         $ver = $ver ? $ver . '&amp;amp;' . $this-&gt;args[$handle] : $this-&gt;args[$handle];
</span><span class="cx"> 
</span><span class="cx">                 if ( $this-&gt;do_concat ) {
</span><del>-                        if ( $this-&gt;in_default_dir($this-&gt;registered[$handle]-&gt;src) &amp;&amp; !isset($this-&gt;registered[$handle]-&gt;extra['conditional']) &amp;&amp; !isset($this-&gt;registered[$handle]-&gt;extra['alt']) ) {
</del><ins>+                        if ( $this-&gt;in_default_dir($obj-&gt;src) &amp;&amp; !isset($obj-&gt;extra['conditional'])        &amp;&amp; !isset($obj-&gt;extra['alt']) ) {
</ins><span class="cx">                                 $this-&gt;concat .= &quot;$handle,&quot;;
</span><span class="cx">                                 $this-&gt;concat_version .= &quot;$handle$ver&quot;;
</span><ins>+
+                                if ( !empty($this-&gt;registered[$handle]-&gt;extra['data']) )
+                                        $this-&gt;print_code .= $this-&gt;registered[$handle]-&gt;extra['data'];
+
</ins><span class="cx">                                 return true;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( isset($this-&gt;registered[$handle]-&gt;args) )
-                        $media = esc_attr( $this-&gt;registered[$handle]-&gt;args );
</del><ins>+                if ( isset($obj-&gt;args) )
+                        $media = esc_attr( $obj-&gt;args );
</ins><span class="cx">                 else
</span><span class="cx">                         $media = 'all';
</span><span class="cx"> 
</span><del>-                $href = $this-&gt;_css_href( $this-&gt;registered[$handle]-&gt;src, $ver, $handle );
-                $rel = isset($this-&gt;registered[$handle]-&gt;extra['alt']) &amp;&amp; $this-&gt;registered[$handle]-&gt;extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
-                $title = isset($this-&gt;registered[$handle]-&gt;extra['title']) ? &quot;title='&quot; . esc_attr( $this-&gt;registered[$handle]-&gt;extra['title'] ) . &quot;'&quot; : '';
</del><ins>+                $href = $this-&gt;_css_href( $obj-&gt;src, $ver, $handle );
+                $rel = isset($obj-&gt;extra['alt']) &amp;&amp; $obj-&gt;extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
+                $title = isset($obj-&gt;extra['title']) ? &quot;title='&quot; . esc_attr( $obj-&gt;extra['title'] ) . &quot;'&quot; : '';
</ins><span class="cx"> 
</span><span class="cx">                 $end_cond = $tag = '';
</span><del>-                if ( isset($this-&gt;registered[$handle]-&gt;extra['conditional']) &amp;&amp; $this-&gt;registered[$handle]-&gt;extra['conditional'] ) {
-                        $tag .= &quot;&lt;!--[if {$this-&gt;registered[$handle]-&gt;extra['conditional']}]&gt;\n&quot;;
</del><ins>+                if ( isset($obj-&gt;extra['conditional']) &amp;&amp; $obj-&gt;extra['conditional'] ) {
+                        $tag .= &quot;&lt;!--[if {$obj-&gt;extra['conditional']}]&gt;\n&quot;;
</ins><span class="cx">                         $end_cond = &quot;&lt;![endif]--&gt;\n&quot;;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $tag .= apply_filters( 'style_loader_tag', &quot;&lt;link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' /&gt;\n&quot;, $handle );
</span><del>-                if ( 'rtl' === $this-&gt;text_direction &amp;&amp; isset($this-&gt;registered[$handle]-&gt;extra['rtl']) &amp;&amp; $this-&gt;registered[$handle]-&gt;extra['rtl'] ) {
-                        if ( is_bool( $this-&gt;registered[$handle]-&gt;extra['rtl'] ) ) {
-                                $suffix = isset( $this-&gt;registered[$handle]-&gt;extra['suffix'] ) ? $this-&gt;registered[$handle]-&gt;extra['suffix'] : '';
-                                $rtl_href = str_replace( &quot;{$suffix}.css&quot;, &quot;-rtl{$suffix}.css&quot;, $this-&gt;_css_href( $this-&gt;registered[$handle]-&gt;src , $ver, &quot;$handle-rtl&quot; ));
</del><ins>+                if ( 'rtl' === $this-&gt;text_direction &amp;&amp; isset($obj-&gt;extra['rtl']) &amp;&amp; $obj-&gt;extra['rtl'] ) {
+                        if ( is_bool( $obj-&gt;extra['rtl'] ) ) {
+                                $suffix = isset( $obj-&gt;extra['suffix'] ) ? $obj-&gt;extra['suffix'] : '';
+                                $rtl_href = str_replace( &quot;{$suffix}.css&quot;, &quot;-rtl{$suffix}.css&quot;, $this-&gt;_css_href( $obj-&gt;src , $ver, &quot;$handle-rtl&quot; ));
</ins><span class="cx">                         } else {
</span><del>-                                $rtl_href = $this-&gt;_css_href( $this-&gt;registered[$handle]-&gt;extra['rtl'], $ver, &quot;$handle-rtl&quot; );
</del><ins>+                                $rtl_href = $this-&gt;_css_href( $obj-&gt;extra['rtl'], $ver, &quot;$handle-rtl&quot; );
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         $tag .= apply_filters( 'style_loader_tag', &quot;&lt;link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' /&gt;\n&quot;, $handle );
</span><span class="lines">@@ -80,17 +86,40 @@
</span><span class="cx"> 
</span><span class="cx">                 $tag .= $end_cond;
</span><span class="cx"> 
</span><del>-                if ( $this-&gt;do_concat )
</del><ins>+                if ( $this-&gt;do_concat ) {
</ins><span class="cx">                         $this-&gt;print_html .= $tag;
</span><del>-                else
</del><ins>+                        $this-&gt;print_html .= $this-&gt;print_inline_style( $handle, false );
+                } else {
</ins><span class="cx">                         echo $tag;
</span><ins>+                        $this-&gt;print_inline_style( $handle );
+                }
</ins><span class="cx"> 
</span><del>-                // Could do something with $this-&gt;registered[$handle]-&gt;extra here to print out extra CSS rules
-//                echo &quot;&lt;style type='text/css'&gt;\n&quot;;
-//                echo &quot;/* &lt;![CDATA[ */\n&quot;;
-//                echo &quot;/* ]]&gt; */\n&quot;;
-//                echo &quot;&lt;/style&gt;\n&quot;;
</del><ins>+                return true;
+        }
</ins><span class="cx"> 
</span><ins>+        function add_inline_style( $handle, $data ) {
+                if ( !$data )
+                        return false;
+
+                if ( !empty( $this-&gt;registered[$handle]-&gt;extra['data'] ) )
+                        $data .= &quot;\n&quot; . $this-&gt;registered[$handle]-&gt;extra['data'];
+
+                return $this-&gt;add_data( $handle, 'data', $data );
+        }
+
+        function print_inline_style( $handle, $echo = true ) {
+                if ( empty($this-&gt;registered[$handle]-&gt;extra['data']) )
+                        return false;
+
+                $output = $this-&gt;registered[$handle]-&gt;extra['data'];
+
+                if ( !$echo )
+                        return $output;
+
+                echo &quot;&lt;style type='text/css'&gt;\n&quot;;
+                echo &quot;$output\n&quot;;
+                echo &quot;&lt;/style&gt;\n&quot;;
+
</ins><span class="cx">                 return true;
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/deprecated.php (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/deprecated.php        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/deprecated.php        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -2615,3 +2615,18 @@
</span><span class="cx"> 
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><ins>+
+/**
+ * Localizes a script.
+ *
+ * Localizes only if script has already been added.
+ *
+ * @since r16
+ * @deprecated WP 3.3 
+ * @see wp_add_script_data()
+ */
+function wp_localize_script( $handle, $object_name, $l10n ) {
+        _deprecated_function( __FUNCTION__, '3.3', 'wp_add_script_data()' );
+        return wp_add_script_data( $handle, $object_name, $l10n );
+}
+
</ins></span></pre></div>
<a id="trunkwpincludesfunctionswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.wp-scripts.php (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.wp-scripts.php        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/functions.wp-scripts.php        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx">         global $wp_scripts;
</span><span class="cx">         if ( !is_a($wp_scripts, 'WP_Scripts') ) {
</span><span class="cx">                 if ( !$handles )
</span><del>-                        return array(); // No need to instantiate if nothing's there.
</del><ins>+                        return array(); // No need to instantiate if nothing is there.
</ins><span class="cx">                 else
</span><span class="cx">                         $wp_scripts = new WP_Scripts();
</span><span class="cx">         }
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Register new JavaScript file.
</del><ins>+ * Register new Javascript file.
</ins><span class="cx">  *
</span><span class="cx">  * @since r16
</span><span class="cx">  * @param string $handle Script name
</span><span class="lines">@@ -56,19 +56,29 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Localizes a script.
</del><ins>+ * Adds extra Javascript.
</ins><span class="cx">  *
</span><del>- * Localizes only if script has already been added.
- *
- * @since r16
- * @see WP_Scripts::localize()
</del><ins>+ * Works only if the script has already been added.
+ * Accepts an associative array $data and creates JS object:
+ * &quot;$name&quot; = {
+ *   key: value,
+ *   key: value,
+ *   ...
+ * }
+ * 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 first value is kept and subsequent values are ignored.
+ * 
+ * @since 3.3
+ * @see WP_Scripts::add_script_data()
</ins><span class="cx">  */
</span><del>-function wp_localize_script( $handle, $object_name, $l10n ) {
</del><ins>+function wp_add_script_data( $handle, $name, $data ) {
</ins><span class="cx">         global $wp_scripts;
</span><span class="cx">         if ( !is_a($wp_scripts, 'WP_Scripts') )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        return $wp_scripts-&gt;localize( $handle, $object_name, $l10n );
</del><ins>+        return $wp_scripts-&gt;add_script_data( $handle, $name, $data );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludesfunctionswpstylesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.wp-styles.php (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.wp-styles.php        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/functions.wp-styles.php        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">         global $wp_styles;
</span><span class="cx">         if ( !is_a($wp_styles, 'WP_Styles') ) {
</span><span class="cx">                 if ( !$handles )
</span><del>-                        return array(); // No need to instantiate if nothing's there.
</del><ins>+                        return array(); // No need to instantiate if nothing is there.
</ins><span class="cx">                 else
</span><span class="cx">                         $wp_styles = new WP_Styles();
</span><span class="cx">         }
</span><span class="lines">@@ -34,6 +34,23 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Adds extra CSS.
+ *
+ * Works only if the stylesheet has already been added.
+ * Accepts a string $data containing the CSS.
+ * 
+ * @since 3.3
+ * @see WP_Scripts::add_inline_style()
+ */
+function wp_add_inline_style( $handle, $data ) {
+        global $wp_styles;
+        if ( !is_a($wp_styles, 'WP_Styles') )
+                return false;
+
+        return $wp_styles-&gt;add_inline_style( $handle, $data );
+}
+
+/**
</ins><span class="cx">  * Register CSS style file.
</span><span class="cx">  *
</span><span class="cx">  * @since r79
</span></span></pre></div>
<a id="trunkwpincludesjsl10ndevjs"></a>
<div class="delfile"><h4>Deleted: trunk/wp-includes/js/l10n.dev.js (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/l10n.dev.js        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/js/l10n.dev.js        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -1,23 +0,0 @@
</span><del>-//Used to ensure that Entities used in L10N strings are correct
-function convertEntities(o) {
-        var c, v;
-        c = function(s) {
-                if (/&amp;[^;]+;/.test(s)) {
-                        var e = document.createElement(&quot;div&quot;);
-                        e.innerHTML = s;
-                        return !e.firstChild ? s : e.firstChild.nodeValue;
-                }
-                return s;
-        }
-
-        if ( typeof o === 'string' ) {
-                return c(o);
-        } else if ( typeof o === 'object' ) {
-                for (v in o) {
-                        if ( typeof o[v] === 'string' ) {
-                                o[v] = c(o[v]);
-                        }
-                }
-        }
-        return o;
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsl10njs"></a>
<div class="delfile"><h4>Deleted: trunk/wp-includes/js/l10n.js (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/l10n.js        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/js/l10n.js        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-function convertEntities(b){var d,a;d=function(c){if(/&amp;[^;]+;/.test(c)){var f=document.createElement(&quot;div&quot;);f.innerHTML=c;return !f.firstChild?c:f.firstChild.nodeValue}return c};if(typeof b===&quot;string&quot;){return d(b)}else{if(typeof b===&quot;object&quot;){for(a in b){if(typeof b[a]===&quot;string&quot;){b[a]=d(b[a])}}}}return b};
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (18463 => 18464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2011-07-23 15:26:50 UTC (rev 18463)
+++ trunk/wp-includes/script-loader.php        2011-07-25 00:36:06 UTC (rev 18464)
</span><span class="lines">@@ -58,17 +58,12 @@
</span><span class="cx"> 
</span><span class="cx">         $suffix = defined('SCRIPT_DEBUG') &amp;&amp; SCRIPT_DEBUG ? '.dev' : '';
</span><span class="cx"> 
</span><del>-        // Always ensure that we have the convertEntities function
-        $scripts-&gt;add( 'l10n', &quot;/wp-includes/js/l10n$suffix.js&quot;, false, '20101110' );
-        $scripts-&gt;enqueue( 'l10n' );
-
</del><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'), '20110711' );
</span><span class="cx">         $scripts-&gt;add_data( 'common', 'group', 1 );
</span><del>-        $scripts-&gt;localize( 'common', 'commonL10n', array(
-                'warnDelete' =&gt; __(&quot;You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.&quot;),
-                'l10n_print_after' =&gt; 'try{convertEntities(commonL10n);}catch(e){};'
</del><ins>+        $scripts-&gt;add_script_data( 'common', 'commonL10n', array(
+                'warnDelete' =&gt; __(&quot;You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.&quot;)
</ins><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' );
</span><span class="lines">@@ -76,7 +71,7 @@
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'quicktags', &quot;/wp-includes/js/quicktags$suffix.js&quot;, false, '20110502' );
</span><span class="cx">         $scripts-&gt;add_data( 'quicktags', 'group', 1 );
</span><del>-        $scripts-&gt;localize( 'quicktags', 'quicktagsL10n', array(
</del><ins>+        $scripts-&gt;add_script_data( 'quicktags', 'quicktagsL10n', array(
</ins><span class="cx">                 'quickLinks' =&gt; __('(Quick Links)'),
</span><span class="cx">                 'wordLookup' =&gt; __('Enter a word to look up:'),
</span><span class="cx">                 'dictionaryLookup' =&gt; esc_attr(__('Dictionary lookup')),
</span><span class="lines">@@ -87,8 +82,7 @@
</span><span class="cx">                 'enterImageURL' =&gt; __('Enter the URL of the image'),
</span><span class="cx">                 'enterImageDescription' =&gt; __('Enter a description of the image'),
</span><span class="cx">                 'fullscreen' =&gt; __('fullscreen'),
</span><del>-                'toggleFullscreen' =&gt; esc_attr( __('Toggle fullscreen mode') ),
-                'l10n_print_after' =&gt; 'try{convertEntities(quicktagsL10n);}catch(e){};'
</del><ins>+                'toggleFullscreen' =&gt; esc_attr( __('Toggle fullscreen mode') )
</ins><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'colorpicker', &quot;/wp-includes/js/colorpicker$suffix.js&quot;, array('prototype'), '3517m' );
</span><span class="lines">@@ -103,10 +97,9 @@
</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' );
</span><span class="cx">         $scripts-&gt;add_data( 'wp-ajax-response', 'group', 1 );
</span><del>-        $scripts-&gt;localize( 'wp-ajax-response', 'wpAjax', array(
</del><ins>+        $scripts-&gt;add_script_data( 'wp-ajax-response', 'wpAjax', array(
</ins><span class="cx">                 'noPerm' =&gt; __('You do not have permission to do that.'),
</span><del>-                'broken' =&gt; __('An unidentified error has occurred.'),
-                'l10n_print_after' =&gt; 'try{convertEntities(wpAjax);}catch(e){};'
</del><ins>+                'broken' =&gt; __('An unidentified error has occurred.')
</ins><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'autosave', &quot;/wp-includes/js/autosave$suffix.js&quot;, array('schedule', 'wp-ajax-response'), '20110524' );
</span><span class="lines">@@ -192,7 +185,7 @@
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'thickbox', &quot;/wp-includes/js/thickbox/thickbox.js&quot;, array('jquery'), '3.1-20110528');
</span><span class="cx">         $scripts-&gt;add_data( 'thickbox', 'group', 1 );
</span><del>-        $scripts-&gt;localize( 'thickbox', 'thickboxL10n', array(
</del><ins>+        $scripts-&gt;add_script_data( '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">@@ -200,8 +193,7 @@
</span><span class="cx">                         'close' =&gt; __('Close'),
</span><span class="cx">                         'noiframes' =&gt; __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
</span><span class="cx">                         'loadingAnimation' =&gt; includes_url('js/thickbox/loadingAnimation.gif'),
</span><del>-                        'closeImage' =&gt; includes_url('js/thickbox/tb-close.png'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(thickboxL10n);}catch(e){};'
</del><ins>+                        'closeImage' =&gt; includes_url('js/thickbox/tb-close.png')
</ins><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'jcrop', &quot;/wp-includes/js/jcrop/jquery.Jcrop$suffix.js&quot;, array('jquery'), '0.9.8-20110113');
</span><span class="lines">@@ -225,7 +217,7 @@
</span><span class="cx">         if ( empty($max_upload_size) )
</span><span class="cx">                 $max_upload_size = __('not configured');
</span><span class="cx">         // these error messages came from the sample swfupload js, they might need changing.
</span><del>-        $scripts-&gt;localize( 'swfupload-handlers', 'swfuploadL10n', array(
</del><ins>+        $scripts-&gt;add_script_data( 'swfupload-handlers', 'swfuploadL10n', array(
</ins><span class="cx">                         'queue_limit_exceeded' =&gt; __('You have attempted to queue too many files.'),
</span><span class="cx">                         'file_exceeds_size_limit' =&gt; __('This file exceeds the maximum upload size for this site.'),
</span><span class="cx">                         'zero_byte_file' =&gt; __('This file is empty. Please try another.'),
</span><span class="lines">@@ -242,8 +234,7 @@
</span><span class="cx">                         'dismiss' =&gt; __('Dismiss'),
</span><span class="cx">                         'crunching' =&gt; __('Crunching&amp;hellip;'),
</span><span class="cx">                         'deleted' =&gt; __('moved to the trash.'),
</span><del>-                        'error_uploading' =&gt; __('&amp;#8220;%s&amp;#8221; has failed to upload due to an error'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(swfuploadL10n);}catch(e){};',
</del><ins>+                        'error_uploading' =&gt; __('&amp;#8220;%s&amp;#8221; has failed to upload due to an error')
</ins><span class="cx">         ) );
</span><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="lines">@@ -255,15 +246,14 @@
</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' );
</span><span class="cx">         $scripts-&gt;add_data( 'password-strength-meter', 'group', 1 );
</span><del>-        $scripts-&gt;localize( 'password-strength-meter', 'pwsL10n', array(
</del><ins>+        $scripts-&gt;add_script_data( '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="cx">                 /* translators: password strength */
</span><span class="cx">                 'good' =&gt; _x('Medium', 'password strength'),
</span><span class="cx">                 'strong' =&gt; __('Strong'),
</span><del>-                'mismatch' =&gt; __('Mismatch'),
-                'l10n_print_after' =&gt; 'try{convertEntities(pwsL10n);}catch(e){};'
</del><ins>+                'mismatch' =&gt; __('Mismatch')
</ins><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'user-profile', &quot;/wp-admin/js/user-profile$suffix.js&quot;, array( 'jquery', 'password-strength-meter' ), '20110628' );
</span><span class="lines">@@ -274,13 +264,12 @@
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wplink', &quot;/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js&quot;, array( 'jquery', 'wpdialogs' ), '20110528' );
</span><span class="cx">         $scripts-&gt;add_data( 'wplink', 'group', 1 );
</span><del>-        $scripts-&gt;localize( 'wplink', 'wpLinkL10n', array(
</del><ins>+        $scripts-&gt;add_script_data( '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="cx">                 'noTitle' =&gt; __('(no title)'),
</span><del>-                'noMatchesFound' =&gt; __('No matches found.'),
-                'l10n_print_after' =&gt; 'try{convertEntities(wpLinkL10n);}catch(e){};',
</del><ins>+                'noMatchesFound' =&gt; __('No matches found.')
</ins><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wpdialogs', &quot;/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog$suffix.js&quot;, array( 'jquery-ui-dialog' ), '20110528' );
</span><span class="lines">@@ -292,10 +281,9 @@
</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;localize( 'ajaxcat', 'catL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( 'ajaxcat', 'catL10n', array(
</ins><span class="cx">                         'add' =&gt; esc_attr(__('Add')),
</span><del>-                        'how' =&gt; __('Separate multiple categories with commas.'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(catL10n);}catch(e){};'
</del><ins>+                        'how' =&gt; __('Separate multiple categories with commas.')
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'admin-categories', &quot;/wp-admin/js/categories$suffix.js&quot;, array('wp-lists'), '20091201' );
</span><span class="lines">@@ -303,10 +291,9 @@
</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' );
</span><span class="cx">                 $scripts-&gt;add_data( 'admin-tags', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'admin-tags', 'tagsl10n', array(
</del><ins>+                $scripts-&gt;add_script_data( 'admin-tags', 'tagsl10n', array(
</ins><span class="cx">                         'noPerm' =&gt; __('You do not have permission to do that.'),
</span><del>-                        'broken' =&gt; __('An unidentified error has occurred.'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(tagsl10n);}catch(e){};'
</del><ins>+                        'broken' =&gt; __('An unidentified error has occurred.')
</ins><span class="cx">                 ));
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'admin-custom-fields', &quot;/wp-admin/js/custom-fields$suffix.js&quot;, array('wp-lists'), '20110429' );
</span><span class="lines">@@ -314,7 +301,7 @@
</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', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110602' );
</span><span class="cx">                 $scripts-&gt;add_data( 'admin-comments', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'admin-comments', 'adminCommentsL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( '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">@@ -329,7 +316,7 @@
</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' );
</span><span class="cx">                 $scripts-&gt;add_data( 'post', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'post', 'postL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( 'post', 'postL10n', array(
</ins><span class="cx">                         'tagsUsed' =&gt;  __('Tags used on this post:'),
</span><span class="cx">                         'add' =&gt; esc_attr(__('Add')),
</span><span class="cx">                         'addTag' =&gt; esc_attr(__('Add new Tag')),
</span><span class="lines">@@ -352,8 +339,7 @@
</span><span class="cx">                         'publicSticky' =&gt; __('Public, Sticky'),
</span><span class="cx">                         'password' =&gt; __('Password Protected'),
</span><span class="cx">                         'privatelyPublished' =&gt; __('Privately Published'),
</span><del>-                        'published' =&gt; __('Published'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(postL10n);}catch(e){};'
</del><ins>+                        'published' =&gt; __('Published')
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'link', &quot;/wp-admin/js/link$suffix.js&quot;, array('wp-lists', 'postbox'), '20110524' );
</span><span class="lines">@@ -361,11 +347,10 @@
</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;localize( 'comment', 'commentL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( 'comment', 'commentL10n', array(
</ins><span class="cx">                         'cancel' =&gt; __('Cancel'),
</span><span class="cx">                         'edit' =&gt; __('Edit'),
</span><del>-                        'submittedOn' =&gt; __('Submitted on:'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(commentL10n);}catch(e){};'
</del><ins>+                        'submittedOn' =&gt; __('Submitted on:')
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'admin-gallery', &quot;/wp-admin/js/gallery$suffix.js&quot;, array( 'jquery-ui-sortable' ), '20110414' );
</span><span class="lines">@@ -387,26 +372,23 @@
</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' ), '20110609' );
</span><span class="cx">                 $scripts-&gt;add_data( 'inline-edit-post', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'inline-edit-post', 'inlineEditL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( '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><del>-                        'notitle' =&gt; __('(no title)'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(inlineEditL10n);}catch(e){};'
</del><ins>+                        'notitle' =&gt; __('(no title)')
</ins><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' );
</span><span class="cx">                 $scripts-&gt;add_data( 'inline-edit-tax', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'inline-edit-tax', 'inlineEditL10n', array(
-                        'error' =&gt; __('Error while saving the changes.'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(inlineEditL10n);}catch(e){};'
</del><ins>+                $scripts-&gt;add_script_data( 'inline-edit-tax', 'inlineEditL10n', array(
+                        'error' =&gt; __('Error while saving the changes.')
</ins><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' );
</span><span class="cx">                 $scripts-&gt;add_data( 'plugin-install', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'plugin-install', 'plugininstallL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( 'plugin-install', 'plugininstallL10n', array(
</ins><span class="cx">                         'plugin_information' =&gt; __('Plugin Information:'),
</span><del>-                        'ays' =&gt; __('Are you sure you want to install this plugin?'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(plugininstallL10n);}catch(e){};'
</del><ins>+                        'ays' =&gt; __('Are you sure you want to install this plugin?')
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
</span><span class="lines">@@ -427,21 +409,19 @@
</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' );
</span><span class="cx">                 $scripts-&gt;add_data( 'set-post-thumbnail', 'group', 1 );
</span><del>-                $scripts-&gt;localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( '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><del>-                        'done' =&gt; __( 'Done' ),
-                        'l10n_print_after' =&gt; 'try{convertEntities(setPostThumbnailL10n);}catch(e){};'
</del><ins>+                        'done' =&gt; __( 'Done' )
</ins><span class="cx">                 ) );
</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;localize( 'nav-menu', 'navMenuL10n', array(
</del><ins>+                $scripts-&gt;add_script_data( '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><del>-                        'saveAlert' =&gt; __('The changes you made will be lost if you navigate away from this page.'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(navMenuL10n);}catch(e){};'
</del><ins>+                        'saveAlert' =&gt; __('The changes you made will be lost if you navigate away from this page.')
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'custom-background', &quot;/wp-admin/js/custom-background$suffix.js&quot;, array('farbtastic'), '20110511' );
</span><span class="lines">@@ -474,7 +454,7 @@
</span><span class="cx">         $styles-&gt;content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
</span><span class="cx">         $styles-&gt;default_version = get_bloginfo( 'version' );
</span><span class="cx">         $styles-&gt;text_direction = function_exists( 'is_rtl' ) &amp;&amp; is_rtl() ? 'rtl' : 'ltr';
</span><del>-        $styles-&gt;default_dirs = array('/wp-admin/', '/wp-includes/');
</del><ins>+        $styles-&gt;default_dirs = array('/wp-admin/', '/wp-includes/css/');
</ins><span class="cx"> 
</span><span class="cx">         $suffix = defined('SCRIPT_DEBUG') &amp;&amp; SCRIPT_DEBUG ? '.dev' : '';
</span><span class="cx"> 
</span><span class="lines">@@ -558,11 +538,10 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_just_in_time_script_localization() {
</span><span class="cx"> 
</span><del>-        wp_localize_script( 'autosave', 'autosaveL10n', array(
</del><ins>+        wp_add_script_data( 'autosave', 'autosaveL10n', array(
</ins><span class="cx">                 'autosaveInterval' =&gt; AUTOSAVE_INTERVAL,
</span><span class="cx">                 'savingText' =&gt; __('Saving Draft&amp;#8230;'),
</span><del>-                'saveAlert' =&gt; __('The changes you made will be lost if you navigate away from this page.'),
-                'l10n_print_after' =&gt; 'try{convertEntities(autosaveL10n);}catch(e){};'
</del><ins>+                'saveAlert' =&gt; __('The changes you made will be lost if you navigate away from this page.')
</ins><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="lines">@@ -635,7 +614,6 @@
</span><span class="cx">                 $wp_scripts = new WP_Scripts();
</span><span class="cx"> 
</span><span class="cx">         script_concat_settings();
</span><del>-        $wp_scripts-&gt;do_items( 'l10n' );
</del><span class="cx">         $wp_scripts-&gt;do_concat = $concatenate_scripts;
</span><span class="cx">         $wp_scripts-&gt;do_head_items();
</span><span class="cx"> 
</span><span class="lines">@@ -647,16 +625,13 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Prints the scripts that were queued for the footer on admin pages.
</del><ins>+ * Prints the scripts that were queued for the footer or too late for the HTML head.
</ins><span class="cx">  *
</span><span class="cx">  * @since 2.8
</span><span class="cx">  */
</span><span class="cx"> function print_footer_scripts() {
</span><span class="cx">         global $wp_scripts, $concatenate_scripts;
</span><span class="cx"> 
</span><del>-        if ( ! did_action('wp_print_footer_scripts') )
-                do_action('wp_print_footer_scripts');
-
</del><span class="cx">         if ( !is_a($wp_scripts, 'WP_Scripts') )
</span><span class="cx">                 return array(); // No need to run if not instantiated.
</span><span class="cx"> 
</span><span class="lines">@@ -671,6 +646,9 @@
</span><span class="cx">         return $wp_scripts-&gt;done;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * @internal use
+ */
</ins><span class="cx"> function _print_scripts() {
</span><span class="cx">         global $wp_scripts, $compress_scripts;
</span><span class="cx"> 
</span><span class="lines">@@ -681,8 +659,8 @@
</span><span class="cx">         if ( !empty($wp_scripts-&gt;concat) ) {
</span><span class="cx"> 
</span><span class="cx">                 if ( !empty($wp_scripts-&gt;print_code) ) {
</span><del>-                        echo &quot;&lt;script type='text/javascript'&gt;\n&quot;;
-                        echo &quot;/* &lt;![CDATA[ */\n&quot;;
</del><ins>+                        echo &quot;\n&lt;script type='text/javascript'&gt;\n&quot;;
+                        echo &quot;/* &lt;![CDATA[ */\n&quot;; // not needed in HTML 5
</ins><span class="cx">                         echo $wp_scripts-&gt;print_code;
</span><span class="cx">                         echo &quot;/* ]]&gt; */\n&quot;;
</span><span class="cx">                         echo &quot;&lt;/script&gt;\n&quot;;
</span><span class="lines">@@ -718,13 +696,17 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Prints the scripts that were queued for the footer on the front end.
</del><ins>+ * Hooks to print the scripts and styles in the footer.
</ins><span class="cx">  *
</span><span class="cx">  * @since 2.8
</span><span class="cx">  */
</span><span class="cx"> function wp_print_footer_scripts() {
</span><span class="cx">         print_late_styles();
</span><span class="cx">         print_footer_scripts();
</span><ins>+
+        if ( !is_admin() )
+                do_action('wp_print_footer_scripts');
+
</ins><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -740,6 +722,11 @@
</span><span class="cx">         do_action('wp_enqueue_scripts');
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Prints the styles queue in the HTML head on admin pages.
+ * 
+ * @since 2.8
+ */
</ins><span class="cx"> function print_admin_styles() {
</span><span class="cx">         global $wp_styles, $concatenate_scripts, $compress_css;
</span><span class="cx"> 
</span><span class="lines">@@ -761,6 +748,11 @@
</span><span class="cx">         return $wp_styles-&gt;done;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Prints the styles that were queued too late for the HTML head.
+ *
+ * @since 3.3
+ */
</ins><span class="cx"> function print_late_styles() {
</span><span class="cx">         global $wp_styles, $concatenate_scripts;
</span><span class="cx"> 
</span><span class="lines">@@ -777,6 +769,9 @@
</span><span class="cx">         return $wp_styles-&gt;done;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * @internal use
+ */
</ins><span class="cx"> function _print_styles() {
</span><span class="cx">         global $wp_styles, $compress_css;
</span><span class="cx"> 
</span><span class="lines">@@ -789,12 +784,23 @@
</span><span class="cx">                 $ver = md5(&quot;$wp_styles-&gt;concat_version{$dir}&quot;);
</span><span class="cx">                 $href = $wp_styles-&gt;base_url . &quot;/wp-admin/load-styles.php?c={$zip}&amp;dir={$dir}&amp;load=&quot; . trim($wp_styles-&gt;concat, ', ') . &quot;&amp;ver=$ver&quot;;
</span><span class="cx">                 echo &quot;&lt;link rel='stylesheet' href='&quot; . esc_attr($href) . &quot;' type='text/css' media='all' /&gt;\n&quot;;
</span><ins>+
+                if ( !empty($wp_styles-&gt;print_code) ) {
+                        echo &quot;&lt;style type='text/css'&gt;\n&quot;;
+                        echo $wp_styles-&gt;print_code;
+                        echo &quot;\n&lt;/style&gt;\n&quot;;
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( !empty($wp_styles-&gt;print_html) )
</span><span class="cx">                 echo $wp_styles-&gt;print_html;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Determine the concatenation and compression settings for scripts and styles.
+ * 
+ * @since 2.8
+ */
</ins><span class="cx"> function script_concat_settings() {
</span><span class="cx">         global $concatenate_scripts, $compress_scripts, $compress_css;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>