Fix external dependencies in class.wp-scripts.php, fixes #8505

git-svn-id: http://svn.automattic.com/wordpress/trunk@10135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2008-12-09 02:50:28 +00:00
parent 0aa6a6039c
commit 11ba27a054
3 changed files with 57 additions and 36 deletions

View File

@@ -44,33 +44,18 @@ class WP_Scripts extends WP_Dependencies {
echo "<script type='text/javascript'>\n";
echo "/* <![CDATA[ */\n";
echo "function convertEntities(o) {\n";
echo " var c = function(s) {\n";
echo " if (/&[^;]+;/.test(s)) {\n";
echo " var e = document.createElement('div');\n";
echo " e.innerHTML = s;\n";
echo " return !e.firstChild ? s : e.firstChild.nodeValue;\n";
echo " }\n";
echo " return s;\n";
echo " }\n";
echo " if ( typeof o === 'string' ) {\n";
echo " return c(o);\n";
echo " } else if ( typeof o === 'object' ) {\n";
echo " for (var v in o) {\n";
echo " if ( typeof o[v] === 'string' )\n";
echo " o[v] = c(o[v]);\n";
echo " }\n";
echo " }\n";
echo " return o;\n";
echo "};\n";
echo "\t$object_name = {\n";
$eol = '';
foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) {
if ( 'l10n_print_after' == $var ) {
$after = $val;
continue;
}
echo "$eol\t\t$var: \"" . js_escape( $val ) . '"';
$eol = ",\n";
}
echo "\n\t}\n";
echo "try{convertEntities($object_name);}catch(e){};\n";
echo isset($after) ? "\t$after\n" : '';
echo "/* ]]> */\n";
echo "</script>\n";