A WordPress-centric search engine for devs and theme authors



funky_javascript_fix ›

Since1.5.0
Deprecated3.0.0
funky_javascript_fix ( $text )
Parameters:
  • (string) $text Text to be made safe.
    Required: Yes
Returns:
  • (string) Fixed text.
Defined at:
Codex:

Fixes JavaScript bugs in browsers.

Converts unicode characters to HTML numbered entities.



Source

function funky_javascript_fix($text) {
	_deprecated_function( __FUNCTION__, '3.0.0' );
	// Fixes for browsers' JavaScript bugs.
	global $is_macIE, $is_winIE;

	if ( $is_winIE || $is_macIE )
		$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
					"funky_javascript_callback",
					$text);

	return $text;
}