🇷🇺 Русским гражданам
В Украине сейчас идет война. Силами РФ наносятся удары по гражданской инфраструктуре в [Харькове][1], [Киеве][2], [Чернигове][3], [Сумах][4], [Ирпене][5] и десятках других городов. Гибнут люди - и гражданское население, и военные, в том числе российские призывники, которых бросили воевать. Чтобы лишить собственный народ доступа к информации, правительство РФ запретило называть войну войной, закрыло независимые СМИ и принимает сейчас ряд диктаторских законов. Эти законы призваны заткнуть рот всем, кто против войны. За обычный призыв к миру сейчас можно получить несколько лет тюрьмы.
Не молчите! Молчание - знак вашего согласия с политикой российского правительства. Вы можете сделать выбор НЕ МОЛЧАТЬ.
🇺🇸 To people of Russia
There is a war in Ukraine right now. The forces of the Russian Federation are attacking civilian infrastructure in [Kharkiv][1], [Kyiv][2], [Chernihiv][3], [Sumy][4], [Irpin][5] and dozens of other cities. People are dying – both civilians and military servicemen, including Russian conscripts who were thrown into the fighting. In order to deprive its own people of access to information, the government of the Russian Federation has forbidden calling a war a war, shut down independent media and is passing a number of dictatorial laws. These laws are meant to silence all those who are against war. You can be jailed for multiple years for simply calling for peace. Do not be silent! Silence is a sign that you accept the Russian government's policy. You can choose NOT TO BE SILENT.
- [1] https://cloudfront-us-east-2.images.arcpublishing.com/reuters/P7K2MSZDGFMIJPDD7CI2GIROJI.jpg "Kharkiv under attack"
- [2] https://gdb.voanews.com/01bd0000-0aff-0242-fad0-08d9fc92c5b3_cx0_cy5_cw0_w1023_r1_s.jpg "Kyiv under attack"
- [3] https://ichef.bbci.co.uk/news/976/cpsprodpb/163DD/production/_123510119_hi074310744.jpg "Chernihiv under attack"
- [4] https://www.youtube.com/watch?v=8K-bkqKKf2A "Sumy under attack"
- [5] https://cloudfront-us-east-2.images.arcpublishing.com/reuters/K4MTMLEHTRKGFK3GSKAT4GR3NE.jpg "Irpin under attack"
- psalm-immutable
Constants |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
public voku |
Methods |
public static charsArray(bool $replace_extra_symbols = false) : array Returns an replacement array for ASCII methods. EXAMPLE: $array = ASCII::charsArray(); var_dump($array['ru']['б']); // 'b'
|
public static charsArrayWithMultiLanguageValues(bool $replace_extra_symbols = false) : array Returns an replacement array for ASCII methods with a mix of multiple languages. EXAMPLE: $array = ASCII::charsArrayWithMultiLanguageValues(); var_dump($array['b']); // ['β', 'б', 'ဗ', 'ბ', 'ب']
|
public static charsArrayWithOneLanguage(string $language = 'en'self::ENGLISH_LANGUAGE_CODE, bool $replace_extra_symbols = false, bool $asOrigReplaceArray = true) : array Returns an replacement array for ASCII methods with one language. For example, German will map 'ä' to 'ae', while other languages will simply return e.g. 'a'. EXAMPLE: $array = ASCII::charsArrayWithOneLanguage('ru'); $tmpKey = \array_search('yo', $array['replace']); echo $array['orig'][$tmpKey]; // 'ё'
|
public static charsArrayWithSingleLanguageValues(bool $replace_extra_symbols = false, bool $asOrigReplaceArray = true) : array Returns an replacement array for ASCII methods with multiple languages. EXAMPLE: $array = ASCII::charsArrayWithSingleLanguageValues(); $tmpKey = \array_search('hnaik', $array['replace']); echo $array['orig'][$tmpKey]; // '၌'
|
public static clean(string $str, bool $normalize_whitespace = true, bool $keep_non_breaking_space = false, bool $normalize_msword = true, bool $remove_invisible_characters = true) : string Accepts a string and removes all non-UTF-8 characters from it + extras if needed.
|
public static getAllLanguages() : array Get all languages from the constants "ASCII::.*LANGUAGE_CODE".
|
public static is_ascii(string $str) : bool Checks if a string is 7 bit ASCII. EXAMPLE: ASCII::is_ascii('白'); // false
|
public static normalize_msword(string $str) : string Returns a string with smart quotes, ellipsis characters, and dashes from Windows-1252 (commonly used in Word documents) replaced by their ASCII equivalents. EXAMPLE: ASCII::normalize_msword('„Abcdef…”'); // '"Abcdef..."'
|
public static normalize_whitespace(string $str, bool $keepNonBreakingSpace = false, bool $keepBidiUnicodeControls = false, bool $normalize_control_characters = false) : string Normalize the whitespace. EXAMPLE: ASCII::normalize_whitespace("abc-\xc2\xa0-öäü-\xe2\x80\xaf-\xE2\x80\xAC", true); // "abc-\xc2\xa0-öäü- -"
|
public static remove_invisible_characters(string $str, bool $url_encoded = false, string $replacement = '', bool $keep_basic_control_characters = true) : string Remove invisible characters from a string. This prevents malicious code injection through null bytes or other control characters. copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php
|
public static to_ascii(string $str, string $language = 'en'self::ENGLISH_LANGUAGE_CODE, bool $remove_unsupported_chars = true, bool $replace_extra_symbols = false, bool $use_transliterate = false, bool $replace_single_chars_only = false) : string Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed by default. The language or locale of the source string can be supplied for language-specific transliteration in any of the following formats: en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping to "aeoeue" rather than "aou" as in other languages. EXAMPLE: ASCII::to_ascii('�Düsseldorf�', 'en'); // Dusseldorf
|
public static to_ascii_remap(string $str1, string $str2) : array WARNING: This method will return broken characters and is only for special cases. Convert two UTF-8 encoded strings to a single-byte strings suitable for functions that need the same string length after the conversion. The function simply uses (and updates) a tailored dynamic encoding (in/out map parameter) where non-ascii characters are remapped to the range [128-255] in order of appearance.
|
public static to_filename(string $str, bool $use_transliterate = true, string $fallback_char = '-') : string Convert given string to safe filename (and keep string case). EXAMPLE: ASCII::to_filename('שדגשדג.png', true)); // 'shdgshdg.png'
|
public static to_slugify(string $str, string $separator = '-', string $language = 'en'self::ENGLISH_LANGUAGE_CODE, array $replacements = [], bool $replace_extra_symbols = false, bool $use_str_to_lower = true, bool $use_transliterate = false) : string Converts a string into a URL-friendly slug.
|
public static to_transliterate(string $str, $unknown = '?', bool $strict = false) : string Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed unless instructed otherwise. EXAMPLE: ASCII::to_transliterate('déjà σσς iıii'); // 'deja sss iiii'
|
Properties |
private static $ASCII_EXTRAS = NULL
|
private static $ASCII_MAPS = NULL
|
private static $ASCII_MAPS_AND_EXTRAS = NULL
|
private static $BIDI_UNI_CODE_CONTROLS_TABLE = [8234 => '', 8235 => '', 8236 => '', 8237 => '', 8238 => '', 8294 => '', 8295 => '', 8296 => '', 8297 => ''] bidirectional text chars
|
private static $LANGUAGE_MAX_KEY = NULL
|
private static $ORD = NULL
|
private static $REGEX_ASCII = '[^ -~]' |
Methods |
private static get_language(string $language) Get the language from a string. e.g.: de_at -> de_at de_DE -> de DE_DE -> de de-de -> de
|
private static getData(string $file) Get data from "/data/*.php".
|
private static getDataIfExists(string $file) : array Get data from "/data/*.php".
|
private static prepareAsciiAndExtrasMaps()
|
private static prepareAsciiExtras()
|
private static prepareAsciiMaps()
|
private static to_ascii_remap_intern(string $str, array $map) : string WARNING: This method will return broken characters and is only for special cases. Convert a UTF-8 encoded string to a single-byte string suitable for functions that need the same string length after the conversion. The function simply uses (and updates) a tailored dynamic encoding (in/out map parameter) where non-ascii characters are remapped to the range [128-255] in order of appearance. Thus, it supports up to 128 different multibyte code points max over the whole set of strings sharing this encoding.
|
Properties |
private static $ASCII_EXTRAS = NULL
|
private static $ASCII_MAPS = NULL
|
private static $ASCII_MAPS_AND_EXTRAS = NULL
|
private static $BIDI_UNI_CODE_CONTROLS_TABLE = [8234 => '', 8235 => '', 8236 => '', 8237 => '', 8238 => '', 8294 => '', 8295 => '', 8296 => '', 8297 => ''] bidirectional text chars
|
private static $LANGUAGE_MAX_KEY = NULL
|
private static $ORD = NULL
|
private static $REGEX_ASCII = '[^ -~]' |
Methods |
public static charsArray(bool $replace_extra_symbols = false) : array Returns an replacement array for ASCII methods. EXAMPLE: $array = ASCII::charsArray(); var_dump($array['ru']['б']); // 'b'
|
public static charsArrayWithMultiLanguageValues(bool $replace_extra_symbols = false) : array Returns an replacement array for ASCII methods with a mix of multiple languages. EXAMPLE: $array = ASCII::charsArrayWithMultiLanguageValues(); var_dump($array['b']); // ['β', 'б', 'ဗ', 'ბ', 'ب']
|
public static charsArrayWithOneLanguage(string $language = 'en'self::ENGLISH_LANGUAGE_CODE, bool $replace_extra_symbols = false, bool $asOrigReplaceArray = true) : array Returns an replacement array for ASCII methods with one language. For example, German will map 'ä' to 'ae', while other languages will simply return e.g. 'a'. EXAMPLE: $array = ASCII::charsArrayWithOneLanguage('ru'); $tmpKey = \array_search('yo', $array['replace']); echo $array['orig'][$tmpKey]; // 'ё'
|
public static charsArrayWithSingleLanguageValues(bool $replace_extra_symbols = false, bool $asOrigReplaceArray = true) : array Returns an replacement array for ASCII methods with multiple languages. EXAMPLE: $array = ASCII::charsArrayWithSingleLanguageValues(); $tmpKey = \array_search('hnaik', $array['replace']); echo $array['orig'][$tmpKey]; // '၌'
|
public static clean(string $str, bool $normalize_whitespace = true, bool $keep_non_breaking_space = false, bool $normalize_msword = true, bool $remove_invisible_characters = true) : string Accepts a string and removes all non-UTF-8 characters from it + extras if needed.
|
private static get_language(string $language) Get the language from a string. e.g.: de_at -> de_at de_DE -> de DE_DE -> de de-de -> de
|
public static getAllLanguages() : array Get all languages from the constants "ASCII::.*LANGUAGE_CODE".
|
private static getData(string $file) Get data from "/data/*.php".
|
private static getDataIfExists(string $file) : array Get data from "/data/*.php".
|
public static is_ascii(string $str) : bool Checks if a string is 7 bit ASCII. EXAMPLE: ASCII::is_ascii('白'); // false
|
public static normalize_msword(string $str) : string Returns a string with smart quotes, ellipsis characters, and dashes from Windows-1252 (commonly used in Word documents) replaced by their ASCII equivalents. EXAMPLE: ASCII::normalize_msword('„Abcdef…”'); // '"Abcdef..."'
|
public static normalize_whitespace(string $str, bool $keepNonBreakingSpace = false, bool $keepBidiUnicodeControls = false, bool $normalize_control_characters = false) : string Normalize the whitespace. EXAMPLE: ASCII::normalize_whitespace("abc-\xc2\xa0-öäü-\xe2\x80\xaf-\xE2\x80\xAC", true); // "abc-\xc2\xa0-öäü- -"
|
private static prepareAsciiAndExtrasMaps()
|
private static prepareAsciiExtras()
|
private static prepareAsciiMaps()
|
public static remove_invisible_characters(string $str, bool $url_encoded = false, string $replacement = '', bool $keep_basic_control_characters = true) : string Remove invisible characters from a string. This prevents malicious code injection through null bytes or other control characters. copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php
|
public static to_ascii(string $str, string $language = 'en'self::ENGLISH_LANGUAGE_CODE, bool $remove_unsupported_chars = true, bool $replace_extra_symbols = false, bool $use_transliterate = false, bool $replace_single_chars_only = false) : string Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed by default. The language or locale of the source string can be supplied for language-specific transliteration in any of the following formats: en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping to "aeoeue" rather than "aou" as in other languages. EXAMPLE: ASCII::to_ascii('�Düsseldorf�', 'en'); // Dusseldorf
|
public static to_ascii_remap(string $str1, string $str2) : array WARNING: This method will return broken characters and is only for special cases. Convert two UTF-8 encoded strings to a single-byte strings suitable for functions that need the same string length after the conversion. The function simply uses (and updates) a tailored dynamic encoding (in/out map parameter) where non-ascii characters are remapped to the range [128-255] in order of appearance.
|
private static to_ascii_remap_intern(string $str, array $map) : string WARNING: This method will return broken characters and is only for special cases. Convert a UTF-8 encoded string to a single-byte string suitable for functions that need the same string length after the conversion. The function simply uses (and updates) a tailored dynamic encoding (in/out map parameter) where non-ascii characters are remapped to the range [128-255] in order of appearance. Thus, it supports up to 128 different multibyte code points max over the whole set of strings sharing this encoding.
|
public static to_filename(string $str, bool $use_transliterate = true, string $fallback_char = '-') : string Convert given string to safe filename (and keep string case). EXAMPLE: ASCII::to_filename('שדגשדג.png', true)); // 'shdgshdg.png'
|
public static to_slugify(string $str, string $separator = '-', string $language = 'en'self::ENGLISH_LANGUAGE_CODE, array $replacements = [], bool $replace_extra_symbols = false, bool $use_str_to_lower = true, bool $use_transliterate = false) : string Converts a string into a URL-friendly slug.
|
public static to_transliterate(string $str, $unknown = '?', bool $strict = false) : string Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed unless instructed otherwise. EXAMPLE: ASCII::to_transliterate('déjà σσς iıii'); // 'deja sss iiii'
|