Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe ASCII

Fonctions membres publiques statiques

static static getAllLanguages ()
 
static charsArray (bool $replace_extra_symbols=false)
 
static clean (string $str, bool $normalize_whitespace=true, bool $keep_non_breaking_space=false, bool $normalize_msword=true, bool $remove_invisible_characters=true)
 
static is_ascii (string $str)
 
static remove_invisible_characters (string $str, bool $url_encoded=false, string $replacement='', bool $keep_basic_control_characters=true)
 
static to_filename (string $str, bool $use_transliterate=true, string $fallback_char='-')
 
static to_slugify (string $str, string $separator='-', string $language=self::ENGLISH_LANGUAGE_CODE, array $replacements=[], bool $replace_extra_symbols=false, bool $use_str_to_lower=true, bool $use_transliterate=false)
 

Champs de données

const UZBEK_LANGUAGE_CODE = 'uz'
 
const TURKMEN_LANGUAGE_CODE = 'tk'
 
const THAI_LANGUAGE_CODE = 'th'
 
const PASHTO_LANGUAGE_CODE = 'ps'
 
const ORIYA_LANGUAGE_CODE = 'or'
 
const MONGOLIAN_LANGUAGE_CODE = 'mn'
 
const KOREAN_LANGUAGE_CODE = 'ko'
 
const KIRGHIZ_LANGUAGE_CODE = 'ky'
 
const ARMENIAN_LANGUAGE_CODE = 'hy'
 
const BENGALI_LANGUAGE_CODE = 'bn'
 
const BELARUSIAN_LANGUAGE_CODE = 'be'
 
const AMHARIC_LANGUAGE_CODE = 'am'
 
const JAPANESE_LANGUAGE_CODE = 'ja'
 
const CHINESE_LANGUAGE_CODE = 'zh'
 
const DUTCH_LANGUAGE_CODE = 'nl'
 
const ITALIAN_LANGUAGE_CODE = 'it'
 
const MACEDONIAN_LANGUAGE_CODE = 'mk'
 
const PORTUGUESE_LANGUAGE_CODE = 'pt'
 
const GREEKLISH_LANGUAGE_CODE = 'el__greeklish'
 
const GREEK_LANGUAGE_CODE = 'el'
 
const HINDI_LANGUAGE_CODE = 'hi'
 
const SWEDISH_LANGUAGE_CODE = 'sv'
 
const TURKISH_LANGUAGE_CODE = 'tr'
 
const BULGARIAN_LANGUAGE_CODE = 'bg'
 
const HUNGARIAN_LANGUAGE_CODE = 'hu'
 
const MYANMAR_LANGUAGE_CODE = 'my'
 
const CROATIAN_LANGUAGE_CODE = 'hr'
 
const FINNISH_LANGUAGE_CODE = 'fi'
 
const GEORGIAN_LANGUAGE_CODE = 'ka'
 
const RUSSIAN_LANGUAGE_CODE = 'ru'
 
const RUSSIAN_PASSPORT_2013_LANGUAGE_CODE = 'ru__passport_2013'
 
const RUSSIAN_GOST_2000_B_LANGUAGE_CODE = 'ru__gost_2000_b'
 
const UKRAINIAN_LANGUAGE_CODE = 'uk'
 
const KAZAKH_LANGUAGE_CODE = 'kk'
 
const CZECH_LANGUAGE_CODE = 'cs'
 
const DANISH_LANGUAGE_CODE = 'da'
 
const POLISH_LANGUAGE_CODE = 'pl'
 
const ROMANIAN_LANGUAGE_CODE = 'ro'
 
const ESPERANTO_LANGUAGE_CODE = 'eo'
 
const ESTONIAN_LANGUAGE_CODE = 'et'
 
const LATVIAN_LANGUAGE_CODE = 'lv'
 
const LITHUANIAN_LANGUAGE_CODE = 'lt'
 
const NORWEGIAN_LANGUAGE_CODE = 'no'
 
const VIETNAMESE_LANGUAGE_CODE = 'vi'
 
const ARABIC_LANGUAGE_CODE = 'ar'
 
const PERSIAN_LANGUAGE_CODE = 'fa'
 
const SERBIAN_LANGUAGE_CODE = 'sr'
 
const SERBIAN_CYRILLIC_LANGUAGE_CODE = 'sr__cyr'
 
const SERBIAN_LATIN_LANGUAGE_CODE = 'sr__lat'
 
const AZERBAIJANI_LANGUAGE_CODE = 'az'
 
const SLOVAK_LANGUAGE_CODE = 'sk'
 
const FRENCH_LANGUAGE_CODE = 'fr'
 
const FRENCH_AUSTRIAN_LANGUAGE_CODE = 'fr_at'
 
const FRENCH_SWITZERLAND_LANGUAGE_CODE = 'fr_ch'
 
const GERMAN_LANGUAGE_CODE = 'de'
 
const GERMAN_AUSTRIAN_LANGUAGE_CODE = 'de_at'
 
const GERMAN_SWITZERLAND_LANGUAGE_CODE = 'de_ch'
 
const ENGLISH_LANGUAGE_CODE = 'en'
 
const EXTRA_LATIN_CHARS_LANGUAGE_CODE = 'latin'
 
const EXTRA_WHITESPACE_CHARS_LANGUAGE_CODE = ' '
 
const EXTRA_MSWORD_CHARS_LANGUAGE_CODE = 'msword'
 

Fonctions membres privées statiques

static get_language (string $language)
 
static getData (string $file)
 
static getDataIfExists (string $file)
 
static prepareAsciiAndExtrasMaps ()
 
static prepareAsciiMaps ()
 
static prepareAsciiExtras ()
 

Attributs privés statiques

static $ASCII_MAPS
 
static $ASCII_MAPS_AND_EXTRAS
 
static $ASCII_EXTRAS
 
static $ORD
 
static $LANGUAGE_MAX_KEY
 
static $REGEX_ASCII = "[^\x09\x10\x13\x0A\x0D\x20-\x7E]"
 
static $BIDI_UNI_CODE_CONTROLS_TABLE
 

Description détaillée

-immutable

Documentation des fonctions membres

◆ charsArray()

static charsArray ( bool  $replace_extra_symbols = false)
static

Returns an replacement array for ASCII methods.

EXAMPLE: $array = ASCII::charsArray(); var_dump($array['ru']['б']); // 'b'

-suppress InvalidNullableReturnType - we use the prepare* methods here, so we don't get NULL here

Paramètres
bool$replace_extra_symbols[optional]

Add some more replacements e.g. "£" with " pound ".

-pure

Renvoie
array

-return array<string, array<string , string>>

◆ clean()

static clean ( string  $str,
bool  $normalize_whitespace = true,
bool  $keep_non_breaking_space = false,
bool  $normalize_msword = true,
bool  $remove_invisible_characters = true 
)
static

Accepts a string and removes all non-UTF-8 characters from it + extras if needed.

Paramètres
string$str

The string to be sanitized.

Paramètres
bool$normalize_whitespace[optional]

Set to true, if you need to normalize the whitespace.

Paramètres
bool$normalize_msword[optional]

Set to true, if you need to normalize MS Word chars e.g.: "…" => "..."

Paramètres
bool$keep_non_breaking_space[optional]

Set to true, to keep non-breaking-spaces, in combination with $normalize_whitespace

Paramètres
bool$remove_invisible_characters[optional]

Set to false, if you not want to remove invisible characters e.g.: "\0"

-pure

Renvoie
string

A clean UTF-8 string.

◆ get_language()

static get_language ( string  $language)
staticprivate

Get the language from a string.

e.g.: de_at -> de_at de_DE -> de DE_DE -> de de-de -> de

ReturnTypeCanBeDeclaredInspection

Paramètres
string$language-pure
Renvoie
string

Références $language.

◆ getAllLanguages()

static static getAllLanguages ( )
static

Get all languages from the constants "ASCII::.*LANGUAGE_CODE".

Renvoie
string[]

-return array<string, string>

Références $lang.

◆ getData()

static getData ( string  $file)
staticprivate

Get data from "/data/*.php".

ReturnTypeCanBeDeclaredInspection

Paramètres
string$file-pure
Renvoie
array<mixed>

PhpIncludeInspection

UsingInclusionReturnValueInspection
-suppress UnresolvableInclude

Références __DIR__.

◆ getDataIfExists()

static getDataIfExists ( string  $file)
staticprivate

Get data from "/data/*.php".

Paramètres
string$file-pure
Renvoie
array<mixed>

-suppress ImpureFunctionCall


PhpIncludeInspection

UsingInclusionReturnValueInspection
-suppress UnresolvableInclude

Références __DIR__.

◆ is_ascii()

static is_ascii ( string  $str)
static

Checks if a string is 7 bit ASCII.

EXAMPLE: ASCII::is_ascii('白'); // false

Paramètres
string$str

The string to check.

-pure

Renvoie
bool

true if it is ASCII
false otherwise

◆ prepareAsciiAndExtrasMaps()

static prepareAsciiAndExtrasMaps ( )
staticprivate

-pure

Renvoie
void

-suppress PossiblyNullArgument - we use the prepare* methods here, so we don't get NULL here

Références null.

◆ prepareAsciiExtras()

static prepareAsciiExtras ( )
staticprivate

-pure

Renvoie
void

Références null.

◆ prepareAsciiMaps()

static prepareAsciiMaps ( )
staticprivate

-pure

Renvoie
void

Références null.

◆ remove_invisible_characters()

static remove_invisible_characters ( string  $str,
bool  $url_encoded = false,
string  $replacement = '',
bool  $keep_basic_control_characters = true 
)
static

Remove invisible characters from a string.

e.g.: This prevents sandwiching null characters between ascii characters, like Java\0script.

copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php

Paramètres
string$str
bool$url_encoded
string$replacement
bool$keep_basic_control_characters-pure
Renvoie
string

Références $count.

◆ to_filename()

static to_filename ( string  $str,
bool  $use_transliterate = true,
string  $fallback_char = '-' 
)
static

Convert given string to safe filename (and keep string case).

EXAMPLE: ASCII::to_filename('שדגשדג.png', true)); // 'shdgshdg.png'

Paramètres
string$str
bool$use_transliterate

ASCII::to_transliterate() is used by default - unsafe characters are simply replaced with hyphen otherwise.

Paramètres
string$fallback_char-pure
Renvoie
string

A string that contains only safe characters for a filename.

◆ to_slugify()

static to_slugify ( string  $str,
string  $separator = '-',
string  $language = self::ENGLISH_LANGUAGE_CODE,
array  $replacements = [],
bool  $replace_extra_symbols = false,
bool  $use_str_to_lower = true,
bool  $use_transliterate = false 
)
static

Converts the string into an URL slug. This includes replacing non-ASCII characters with their closest ASCII equivalents, removing remaining non-ASCII and non-alphanumeric characters, and replacing whitespace with $separator. The separator defaults to a single dash, and the string is also converted to lowercase. The language of the source string can also be supplied for language-specific transliteration.

Paramètres
string$str
string$separator[optional]

The string used to replace whitespace.

Paramètres
string$language[optional]

Language of the source string. (default is 'en') | ASCII::*_LANGUAGE_CODE

Paramètres
array<string,string>$replacements [optional]

A map of replaceable strings.

Paramètres
bool$replace_extra_symbols[optional]

Add some more replacements e.g. "£" with " pound ".

Paramètres
bool$use_str_to_lower[optional]

Use "string to lower" for the input.

Paramètres
bool$use_transliterate[optional]

Use ASCII::to_transliterate() for unknown chars.

-pure

Renvoie
string

A string that has been converted to an URL slug.

Références $language, et $separator.

Documentation des champs

◆ $ASCII_EXTRAS

$ASCII_EXTRAS
staticprivate

◆ $ASCII_MAPS

$ASCII_MAPS
staticprivate

◆ $ASCII_MAPS_AND_EXTRAS

$ASCII_MAPS_AND_EXTRAS
staticprivate

◆ $BIDI_UNI_CODE_CONTROLS_TABLE

$BIDI_UNI_CODE_CONTROLS_TABLE
staticprivate
Valeur initiale :
= [
8234 => "\xE2\x80\xAA"

◆ $LANGUAGE_MAX_KEY

$LANGUAGE_MAX_KEY
staticprivate

◆ $ORD

$ORD
staticprivate

◆ $REGEX_ASCII

$REGEX_ASCII = "[^\x09\x10\x13\x0A\x0D\x20-\x7E]"
staticprivate

◆ AMHARIC_LANGUAGE_CODE

const AMHARIC_LANGUAGE_CODE = 'am'

◆ ARABIC_LANGUAGE_CODE

const ARABIC_LANGUAGE_CODE = 'ar'

◆ ARMENIAN_LANGUAGE_CODE

const ARMENIAN_LANGUAGE_CODE = 'hy'

◆ AZERBAIJANI_LANGUAGE_CODE

const AZERBAIJANI_LANGUAGE_CODE = 'az'

◆ BELARUSIAN_LANGUAGE_CODE

const BELARUSIAN_LANGUAGE_CODE = 'be'

◆ BENGALI_LANGUAGE_CODE

const BENGALI_LANGUAGE_CODE = 'bn'

◆ BULGARIAN_LANGUAGE_CODE

const BULGARIAN_LANGUAGE_CODE = 'bg'

◆ CHINESE_LANGUAGE_CODE

const CHINESE_LANGUAGE_CODE = 'zh'

◆ CROATIAN_LANGUAGE_CODE

const CROATIAN_LANGUAGE_CODE = 'hr'

◆ CZECH_LANGUAGE_CODE

const CZECH_LANGUAGE_CODE = 'cs'

◆ DANISH_LANGUAGE_CODE

const DANISH_LANGUAGE_CODE = 'da'

◆ DUTCH_LANGUAGE_CODE

const DUTCH_LANGUAGE_CODE = 'nl'

◆ ENGLISH_LANGUAGE_CODE

const ENGLISH_LANGUAGE_CODE = 'en'

◆ ESPERANTO_LANGUAGE_CODE

const ESPERANTO_LANGUAGE_CODE = 'eo'

◆ ESTONIAN_LANGUAGE_CODE

const ESTONIAN_LANGUAGE_CODE = 'et'

◆ EXTRA_LATIN_CHARS_LANGUAGE_CODE

const EXTRA_LATIN_CHARS_LANGUAGE_CODE = 'latin'

◆ EXTRA_MSWORD_CHARS_LANGUAGE_CODE

const EXTRA_MSWORD_CHARS_LANGUAGE_CODE = 'msword'

◆ EXTRA_WHITESPACE_CHARS_LANGUAGE_CODE

const EXTRA_WHITESPACE_CHARS_LANGUAGE_CODE = ' '

◆ FINNISH_LANGUAGE_CODE

const FINNISH_LANGUAGE_CODE = 'fi'

◆ FRENCH_AUSTRIAN_LANGUAGE_CODE

const FRENCH_AUSTRIAN_LANGUAGE_CODE = 'fr_at'

◆ FRENCH_LANGUAGE_CODE

const FRENCH_LANGUAGE_CODE = 'fr'

◆ FRENCH_SWITZERLAND_LANGUAGE_CODE

const FRENCH_SWITZERLAND_LANGUAGE_CODE = 'fr_ch'

◆ GEORGIAN_LANGUAGE_CODE

const GEORGIAN_LANGUAGE_CODE = 'ka'

◆ GERMAN_AUSTRIAN_LANGUAGE_CODE

const GERMAN_AUSTRIAN_LANGUAGE_CODE = 'de_at'

◆ GERMAN_LANGUAGE_CODE

const GERMAN_LANGUAGE_CODE = 'de'

◆ GERMAN_SWITZERLAND_LANGUAGE_CODE

const GERMAN_SWITZERLAND_LANGUAGE_CODE = 'de_ch'

◆ GREEK_LANGUAGE_CODE

const GREEK_LANGUAGE_CODE = 'el'

◆ GREEKLISH_LANGUAGE_CODE

const GREEKLISH_LANGUAGE_CODE = 'el__greeklish'

◆ HINDI_LANGUAGE_CODE

const HINDI_LANGUAGE_CODE = 'hi'

◆ HUNGARIAN_LANGUAGE_CODE

const HUNGARIAN_LANGUAGE_CODE = 'hu'

◆ ITALIAN_LANGUAGE_CODE

const ITALIAN_LANGUAGE_CODE = 'it'

◆ JAPANESE_LANGUAGE_CODE

const JAPANESE_LANGUAGE_CODE = 'ja'

◆ KAZAKH_LANGUAGE_CODE

const KAZAKH_LANGUAGE_CODE = 'kk'

◆ KIRGHIZ_LANGUAGE_CODE

const KIRGHIZ_LANGUAGE_CODE = 'ky'

◆ KOREAN_LANGUAGE_CODE

const KOREAN_LANGUAGE_CODE = 'ko'

◆ LATVIAN_LANGUAGE_CODE

const LATVIAN_LANGUAGE_CODE = 'lv'

◆ LITHUANIAN_LANGUAGE_CODE

const LITHUANIAN_LANGUAGE_CODE = 'lt'

◆ MACEDONIAN_LANGUAGE_CODE

const MACEDONIAN_LANGUAGE_CODE = 'mk'

◆ MONGOLIAN_LANGUAGE_CODE

const MONGOLIAN_LANGUAGE_CODE = 'mn'

◆ MYANMAR_LANGUAGE_CODE

const MYANMAR_LANGUAGE_CODE = 'my'

◆ NORWEGIAN_LANGUAGE_CODE

const NORWEGIAN_LANGUAGE_CODE = 'no'

◆ ORIYA_LANGUAGE_CODE

const ORIYA_LANGUAGE_CODE = 'or'

◆ PASHTO_LANGUAGE_CODE

const PASHTO_LANGUAGE_CODE = 'ps'

◆ PERSIAN_LANGUAGE_CODE

const PERSIAN_LANGUAGE_CODE = 'fa'

◆ POLISH_LANGUAGE_CODE

const POLISH_LANGUAGE_CODE = 'pl'

◆ PORTUGUESE_LANGUAGE_CODE

const PORTUGUESE_LANGUAGE_CODE = 'pt'

◆ ROMANIAN_LANGUAGE_CODE

const ROMANIAN_LANGUAGE_CODE = 'ro'

◆ RUSSIAN_GOST_2000_B_LANGUAGE_CODE

const RUSSIAN_GOST_2000_B_LANGUAGE_CODE = 'ru__gost_2000_b'

◆ RUSSIAN_LANGUAGE_CODE

const RUSSIAN_LANGUAGE_CODE = 'ru'

◆ RUSSIAN_PASSPORT_2013_LANGUAGE_CODE

const RUSSIAN_PASSPORT_2013_LANGUAGE_CODE = 'ru__passport_2013'

◆ SERBIAN_CYRILLIC_LANGUAGE_CODE

const SERBIAN_CYRILLIC_LANGUAGE_CODE = 'sr__cyr'

◆ SERBIAN_LANGUAGE_CODE

const SERBIAN_LANGUAGE_CODE = 'sr'

◆ SERBIAN_LATIN_LANGUAGE_CODE

const SERBIAN_LATIN_LANGUAGE_CODE = 'sr__lat'

◆ SLOVAK_LANGUAGE_CODE

const SLOVAK_LANGUAGE_CODE = 'sk'

◆ SWEDISH_LANGUAGE_CODE

const SWEDISH_LANGUAGE_CODE = 'sv'

◆ THAI_LANGUAGE_CODE

const THAI_LANGUAGE_CODE = 'th'

◆ TURKISH_LANGUAGE_CODE

const TURKISH_LANGUAGE_CODE = 'tr'

◆ TURKMEN_LANGUAGE_CODE

const TURKMEN_LANGUAGE_CODE = 'tk'

◆ UKRAINIAN_LANGUAGE_CODE

const UKRAINIAN_LANGUAGE_CODE = 'uk'

◆ UZBEK_LANGUAGE_CODE

const UZBEK_LANGUAGE_CODE = 'uz'

◆ VIETNAMESE_LANGUAGE_CODE

const VIETNAMESE_LANGUAGE_CODE = 'vi'

La documentation de cette classe a été générée à partir du fichier suivant :