Make WordPress Core


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.