Make WordPress Core

Changeset 10086


Ignore:
Timestamp:
12/06/2008 09:54:24 AM (17 years ago)
Author:
westi
Message:

Move convertEntities js function into the BackPress scriptloader. Fixes #8505 props sambauers.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r10081 r10086  
    3030//<![CDATA[
    3131addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
    32 
    33 function convertEntities(o) {
    34     var c = function(s) {
    35         if (/&[^;]+;/.test(s)) {
    36             var e = document.createElement("div");
    37             e.innerHTML = s;
    38             return !e.firstChild ? s : e.firstChild.nodeValue;
    39         }
    40         return s;
    41     }
    42 
    43     if ( typeof o === 'string' )
    44         return c(o);
    45     else if ( typeof o === 'object' )
    46         for (var v in o) {
    47             if ( typeof o[v] === 'string' )
    48                 o[v] = c(o[v]);
    49         }
    50     return o;
    51 };
    5232//]]>
    5333</script>
  • trunk/wp-includes/class.wp-scripts.php

    r9809 r10086  
    4545        echo "<script type='text/javascript'>\n";
    4646        echo "/* <![CDATA[ */\n";
     47        echo "function convertEntities(o) {\n";
     48        echo "  var c = function(s) {\n";
     49        echo "      if (/&[^;]+;/.test(s)) {\n";
     50        echo "          var e = document.createElement('div');\n";
     51        echo "          e.innerHTML = s;\n";
     52        echo "          return !e.firstChild ? s : e.firstChild.nodeValue;\n";
     53        echo "      }\n";
     54        echo "      return s;\n";
     55        echo "  }\n";
     56        echo "  if ( typeof o === 'string' ) {\n";
     57        echo "      return c(o);\n";
     58        echo "  } else if ( typeof o === 'object' ) {\n";
     59        echo "      for (var v in o) {\n";
     60        echo "          if ( typeof o[v] === 'string' )\n";
     61        echo "              o[v] = c(o[v]);\n";
     62        echo "      }\n";
     63        echo "  }\n";
     64        echo "  return o;\n";
     65        echo "};\n";
    4766        echo "\t$object_name = {\n";
    4867        $eol = '';
Note: See TracChangeset for help on using the changeset viewer.