function csstidy::_unicode in Advanced CSS/JS Aggregation 6
Parse unicode notations and find a replacement character
@access private
@version 1.2
Parameters
string $string:
integer $i:
Return value
string
1 call to csstidy::_unicode()
- csstidy::parse in advagg_css_compress/
csstidy/ class.csstidy.inc - Parses CSS in $string. The code is saved as array in $this->css
File
- advagg_css_compress/
csstidy/ class.csstidy.inc, line 409
Class
- csstidy
- CSS Parser class
Code
function _unicode(&$string, &$i) {
++$i;
$add = '';
$replaced = false;
while ($i < strlen($string) && (ctype_xdigit($string[$i]) || ctype_space($string[$i])) && strlen($add) < 6) {
$add .= $string[$i];
if (ctype_space($string[$i])) {
break;
}
$i++;
}
if (hexdec($add) > 47 && hexdec($add) < 58 || hexdec($add) > 64 && hexdec($add) < 91 || hexdec($add) > 96 && hexdec($add) < 123) {
$this
->log('Replaced unicode notation: Changed \\' . $add . ' to ' . chr(hexdec($add)), 'Information');
$add = chr(hexdec($add));
$replaced = true;
}
else {
$add = trim('\\' . $add);
}
if (@ctype_xdigit($string[$i + 1]) && ctype_space($string[$i]) && !$replaced || !ctype_space($string[$i])) {
$i--;
}
if ($add !== '\\' || !$this
->get_cfg('remove_bslash') || strpos($this->tokens_list, $string[$i + 1]) !== false) {
return $add;
}
if ($add === '\\') {
$this
->log('Removed unnecessary backslash', 'Information');
}
return '';
}