src/MvcCore/Ext/Views/Helpers/WriteByJsHelper.php
public function WriteByJs ($string) {
		$resultStringArr = [];
		for ($i = 0, $l = strlen($string); $i < $l; $i++) {
			$char = mb_substr($string, $i, 1, 'UTF-8');
			if (mb_check_encoding($char, 'UTF-8')) {
				$ret = mb_convert_encoding($char, 'UTF-32BE', 'UTF-8');
				$resultStringArr[] = hexdec(bin2hex($ret));
			}
		}
		$utf8Indexes = implode(',', $resultStringArr);
		$utf8Indexes = trim($utf8Indexes, ',');
		while (substr($utf8Indexes, strlen($utf8Indexes) - 2, 2) == ',0') {
			$utf8Indexes = substr($utf8Indexes, 0, strlen($utf8Indexes) - 2);
		}
		return '<script>document.write(String.fromCharCode(' . $utf8Indexes . '));</script>';
	}
public function WriteByJs ($string) {
		$resultStringArr = [];
		for ($i = 0, $l = strlen($string); $i < $l; $i++) {
			$char = mb_substr($string, $i, 1, 'UTF-8');
			if (mb_check_encoding($char, 'UTF-8')) {
				$ret = mb_convert_encoding($char, 'UTF-32BE', 'UTF-8');
				$resultStringArr[] = hexdec(bin2hex($ret));
			}
		}
		$utf8Indexes = implode(',', $resultStringArr);
		$utf8Indexes = trim($utf8Indexes, ',');
		while (substr($utf8Indexes, strlen($utf8Indexes) - 2, 2) == ',0') {
			$utf8Indexes = substr($utf8Indexes, 0, strlen($utf8Indexes) - 2);
		}
		return '<script>document.write(String.fromCharCode(' . $utf8Indexes . '));</script>';
	}
public function WriteByJs ( $ string ) { $ resultStringArr = [ ] ; for ( $ i = 0 , $ l = strlen ( $ string ) ; $ i < $ l ; $ i ++ ) { $ char = mb_substr ( $ string , $ i , 1 , 'UTF-8' ) ; if ( mb_check_encoding ( $ char , 'UTF-8' ) ) { $ ret = mb_convert_encoding ( $ char , 'UTF-32BE' , 'UTF-8' ) ; $ resultStringArr [ ] = hexdec ( bin2hex ( $ ret ) ) ; } } $ utf8Indexes = implode ( ',' , $ resultStringArr ) ; $ utf8Indexes = trim ( $ utf8Indexes , ',' ) ; while ( substr ( $ utf8Indexes , strlen ( $ utf8Indexes ) - 2 , 2 ) == ',0' ) { $ utf8Indexes = substr ( $ utf8Indexes , 0 , strlen ( $ utf8Indexes ) - 2 ) ; } return '<script>document.write(String.fromCharCode(' . $ utf8Indexes . '));</script>' ; }
Any plaint text or any html content.
@param string $string
@return string
Any plaint text or any html content .