wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
valid_unicode › WordPress Function
Od2.7.0
Przestarzałyn/a
› valid_unicode ( $i )
| Parametry: |
|
| Linki: | |
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: |
Determines whether a code point is allowed by the XML Char production.
Despite its name, this helper does not report whether a code point is valid Unicode. It follows the XML Char production: C0 controls other than HT/LF/CR are rejected even though they are valid Unicode (for example U+0008 BACKSPACE), as are surrogates and U+FFFE/U+FFFF. Prefer the newer Unicode/UTF-8 helpers (for example wp_is_valid_utf8) rather than extending call sites here. > Characters > > … > Legal characters are tab, carriage return, line feed, and the legal characters of > Unicode and ISO/IEC 10646. > … > Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]Powiązane Funkcje: wp_is_valid_icon_name, wp_validate_auth_cookie, add_shortcode, validate_username, validate_user_form
Źródło
function valid_unicode( $i ) {
$i = (int) $i;
return (
0x9 === $i || // U+0009 HORIZONTAL TABULATION (HT)
0xA === $i || // U+000A LINE FEED (LF)
0xD === $i || // U+000D CARRIAGE RETURN (CR)
/*
* The valid Unicode characters according to the XML specification:
*
* > any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
*/
( 0x20 <= $i && $i <= 0xD7FF ) ||
( 0xE000 <= $i && $i <= 0xFFFD ) ||
( 0x10000 <= $i && $i <= 0x10FFFF )
);
}