<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[16282] trunk:
  Move the l10n helper function into a seperate js file so we can always output it first
 .</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16282">16282</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2010-11-10 21:53:30 +0000 (Wed, 10 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move the l10n helper function into a seperate js file so we can always output it first.
Fixes <a href="http://trac.wordpress.org/ticket/15124">#15124</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjsutilsdevjs">trunk/wp-admin/js/utils.dev.js</a></li>
<li><a href="#trunkwpadminjsutilsjs">trunk/wp-admin/js/utils.js</a></li>
<li><a href="#trunkwpincludesclasswpscriptsphp">trunk/wp-includes/class.wp-scripts.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

<h3>Added 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="trunkwpadminjsutilsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/utils.dev.js (16281 => 16282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/utils.dev.js        2010-11-10 20:54:56 UTC (rev 16281)
+++ trunk/wp-admin/js/utils.dev.js        2010-11-10 21:53:30 UTC (rev 16282)
</span><span class="lines">@@ -1,27 +1,5 @@
</span><span class="cx"> // utility functions
</span><del>-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;
-        }
</del><span class="cx"> 
</span><del>-        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"> var wpCookies = {
</span><span class="cx"> // The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminjsutilsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/utils.js (16281 => 16282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/utils.js        2010-11-10 20:54:56 UTC (rev 16281)
+++ trunk/wp-admin/js/utils.js        2010-11-10 21:53:30 UTC (rev 16282)
</span><span class="lines">@@ -1 +1 @@
</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}var wpCookies={each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!=&quot;undefined&quot;){for(e=0,b=d.length;e&lt;b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},getHash:function(c){var a=this.get(c),b;if(a){this.each(a.split(&quot;&amp;&quot;),function(d){d=d.split(&quot;=&quot;);b=b||{};b[d[0]]=d[1]})}return b},setHash:function(i,a,f,c,h,b){var g=&quot;&quot;;this.each(a,function(e,d){g+=(!g?&quot;&quot;:&quot;&amp;&quot;)+d+&quot;=&quot;+e});this.set(i,g,f,c,h,b)},get:function(h){var g=document.cookie,f,d=h+&quot;=&quot;,a;if(!g){return}a=g.indexOf(&quot;; &quot;+d);if(a==-1){a=g.indexOf(d);if(a!=0){return null}}else{a+=2}f=g.indexOf(&quot;;&quot;,a);if(f==-1){f=g.length}return decodeURIComponent(g.substring(a+d.length,f))},set:function(h,a,f,c,g,b){document.cookie=h+&quot;=&quot;+encodeURIComponent(a)+((f)?&quot;; expires=&quot;+f.toGMTString():&quot;&quot;)+((c)?&quot;; path=&quot;+c:&quot;&quot;)+((g)?&quot;; domain=&quot;+g:&quot;&quot;)+((b)?&quot;; secure&quot;:&quot;&quot;)},remove:function(c,a){var b=new Date();b.setTime(b.getTime()-1000);this.set(c,&quot;&quot;,b,a,b)}};function getUserSetting(a,b){var c=getAllUserSettings();if(c.hasOwnProperty(a)){return c[a]}if(typeof b!=&quot;undefined&quot;){return b}return&quot;&quot;}function setUserSetting(a,i,k){if(&quot;object&quot;!==typeof userSettings){return false}var h=&quot;wp-settings-&quot;+userSettings.uid,e=wpCookies.getHash(h)||{},g=new Date(),b,f=a.toString().replace(/[^A-Za-z0-9_]/,&quot;&quot;),j=i.toString().replace(/[^A-Za-z0-9_]/,&quot;&quot;);if(k){delete e[f]}else{e[f]=j}g.setTime(g.getTime()+31536000000);b=userSettings.url;wpCookies.setHash(h,e,g,b);wpCookies.set(&quot;wp-settings-time-&quot;+userSettings.uid,userSettings.time,g,b);return a}function deleteUserSetting(a){return setUserSetting(a,&quot;&quot;,1)}function getAllUserSettings(){if(&quot;object&quot;!==typeof userSettings){return{}}return wpCookies.getHash(&quot;wp-settings-&quot;+userSettings.uid)||{}};
</del><span class="cx">\ No newline at end of file
</span><ins>+var wpCookies={each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!=&quot;undefined&quot;){for(e=0,b=d.length;e&lt;b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},getHash:function(c){var a=this.get(c),b;if(a){this.each(a.split(&quot;&amp;&quot;),function(d){d=d.split(&quot;=&quot;);b=b||{};b[d[0]]=d[1]})}return b},setHash:function(i,a,f,c,h,b){var g=&quot;&quot;;this.each(a,function(e,d){g+=(!g?&quot;&quot;:&quot;&amp;&quot;)+d+&quot;=&quot;+e});this.set(i,g,f,c,h,b)},get:function(h){var g=document.cookie,f,d=h+&quot;=&quot;,a;if(!g){return}a=g.indexOf(&quot;; &quot;+d);if(a==-1){a=g.indexOf(d);if(a!=0){return null}}else{a+=2}f=g.indexOf(&quot;;&quot;,a);if(f==-1){f=g.length}return decodeURIComponent(g.substring(a+d.length,f))},set:function(h,a,f,c,g,b){document.cookie=h+&quot;=&quot;+encodeURIComponent(a)+((f)?&quot;; expires=&quot;+f.toGMTString():&quot;&quot;)+((c)?&quot;; path=&quot;+c:&quot;&quot;)+((g)?&quot;; domain=&quot;+g:&quot;&quot;)+((b)?&quot;; secure&quot;:&quot;&quot;)},remove:function(c,a){var b=new Date();b.setTime(b.getTime()-1000);this.set(c,&quot;&quot;,b,a,b)}};function getUserSetting(a,b){var c=getAllUserSettings();if(c.hasOwnProperty(a)){return c[a]}if(typeof b!=&quot;undefined&quot;){return b}return&quot;&quot;}function setUserSetting(a,i,k){if(&quot;object&quot;!==typeof userSettings){return false}var h=&quot;wp-settings-&quot;+userSettings.uid,e=wpCookies.getHash(h)||{},g=new Date(),b,f=a.toString().replace(/[^A-Za-z0-9_]/,&quot;&quot;),j=i.toString().replace(/[^A-Za-z0-9_]/,&quot;&quot;);if(k){delete e[f]}else{e[f]=j}g.setTime(g.getTime()+31536000000);b=userSettings.url;wpCookies.setHash(h,e,g,b);wpCookies.set(&quot;wp-settings-time-&quot;+userSettings.uid,userSettings.time,g,b);return a}function deleteUserSetting(a){return setUserSetting(a,&quot;&quot;,1)}function getAllUserSettings(){if(&quot;object&quot;!==typeof userSettings){return{}}return wpCookies.getHash(&quot;wp-settings-&quot;+userSettings.uid)||{}};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesclasswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-scripts.php (16281 => 16282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-scripts.php        2010-11-10 20:54:56 UTC (rev 16281)
+++ trunk/wp-includes/class.wp-scripts.php        2010-11-10 21:53:30 UTC (rev 16282)
</span><span class="lines">@@ -183,6 +183,9 @@
</span><span class="cx">                 if ( ! $this-&gt;default_dirs )
</span><span class="cx">                         return true;
</span><span class="cx"> 
</span><ins>+                if ( 0 === strpos( $src, '/wp-includes/js/l10n' ) )
+                        return false;
+                        
</ins><span class="cx">                 foreach ( (array) $this-&gt;default_dirs as $test ) {
</span><span class="cx">                         if ( 0 === strpos($src, $test) )
</span><span class="cx">                                 return true;
</span></span></pre></div>
<a id="trunkwpincludesjsl10ndevjs"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/js/l10n.dev.js (0 => 16282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/l10n.dev.js                                (rev 0)
+++ trunk/wp-includes/js/l10n.dev.js        2010-11-10 21:53:30 UTC (rev 16282)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+//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;
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsl10njs"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/js/l10n.js (0 => 16282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/l10n.js                                (rev 0)
+++ trunk/wp-includes/js/l10n.js        2010-11-10 21:53:30 UTC (rev 16282)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+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};
</ins><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 (16281 => 16282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-11-10 20:54:56 UTC (rev 16281)
+++ trunk/wp-includes/script-loader.php        2010-11-10 21:53:30 UTC (rev 16282)
</span><span class="lines">@@ -58,7 +58,11 @@
</span><span class="cx"> 
</span><span class="cx">         $suffix = defined('SCRIPT_DEBUG') &amp;&amp; SCRIPT_DEBUG ? '.dev' : '';
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'utils', &quot;/wp-admin/js/utils$suffix.js&quot;, false, '20090102' );
</del><ins>+        // 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' );
+        
+        $scripts-&gt;add( 'utils', &quot;/wp-admin/js/utils$suffix.js&quot;, false, '20101110' );
</ins><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'common', &quot;/wp-admin/js/common$suffix.js&quot;, array('jquery', 'hoverIntent', 'utils'), '20101007' );
</span><span class="cx">         $scripts-&gt;add_data( 'common', 'group', 1 );
</span><span class="lines">@@ -622,6 +626,7 @@
</span><span class="cx">                 $wp_scripts = new WP_Scripts();
</span><span class="cx"> 
</span><span class="cx">         script_concat_settings();
</span><ins>+        $wp_scripts-&gt;do_item( 'l10n' );
</ins><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></pre>
</div>
</div>

</body>
</html>