Guest User

Untitled

a guest
May 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. $smcFunc += array(
  2. 'entity_fix' => create_function('$string', '
  3. $num = substr($string, 0, 1) === 'x' ? hexdec(substr($string, 1)) : (int) $string;
  4. return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202E ? '' : '&#' . $num . ';';'),
  5.  
  6. 'htmlspecialchars' => create_function('$string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1'', '
  7. global $smcFunc;
  8. return ' . strtr($ent_check[0], array('&' => '&')) . 'htmlspecialchars($string, $quote_style, ' . ($utf8 ? ''UTF-8'' : '$charset') . ')' . $ent_check[1] . ';'),
  9.  
  10. 'htmltrim' => create_function('$string', '
  11. global $smcFunc;
  12. return preg_replace('~^(?:[ tnrx0Bx00' . $space_chars . ']|&nbsp;)+|(?:[ tnrx0Bx00' . $space_chars . ']|&nbsp;)+$~' . ($utf8 ? 'u' : '') . '', '', ' . implode('$string', $ent_check) . ');'),
  13.  
  14. 'strlen' => create_function('$string', '
  15. global $smcFunc;
  16. return strlen(preg_replace('~' . $ent_list . ($utf8 ? '|.~u' : '~') . '', '_', ' . implode('$string', $ent_check) . '));'),
  17.  
  18. // ...
  19. );
  20.  
  21. 'entity_fix' => function($string) use ($num) {
  22. $num = 0 === strpos($string, 'x') ? hexdec(substr($string, 1)) : (int) $string;
  23. return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202E
  24. ? ''
  25. : '&#' . $num . ';';
  26. },
Add Comment
Please, Sign In to add comment