Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques statiques | |
static static | increment ($string, $style='default', $n=0) |
static | is_ascii ($str) |
static | ord ($chr) |
static | strpos ($str, $search, $offset=false) |
static | strrpos ($str, $search, $offset=0) |
static | substr ($str, $offset, $length=false) |
static | strtolower ($str) |
static | strtoupper ($str) |
static | strlen ($str) |
static | str_ireplace ($search, $replace, $str, $count=null) |
static | str_pad ($input, $length, $padStr=' ', $type=STR_PAD_RIGHT) |
static | str_split ($str, $splitLen=1) |
static | strcasecmp ($str1, $str2, $locale=false) |
static | strcmp ($str1, $str2, $locale=false) |
static | strcspn ($str, $mask, $start=null, $length=null) |
static | stristr ($str, $search) |
static | strrev ($str) |
static | strspn ($str, $mask, $start=null, $length=null) |
static | substr_replace ($str, $repl, $start, $length=null) |
static | ltrim ($str, $charlist=false) |
static | rtrim ($str, $charlist=false) |
static | trim ($str, $charlist=false) |
static | ucfirst ($str, $delimiter=null, $newDelimiter=null) |
static | ucwords ($str) |
static | transcode ($source, $fromEncoding, $toEncoding) |
static | valid ($str) |
static | compliant ($str) |
static | unicode_to_utf8 ($str) |
static | unicode_to_utf16 ($str) |
Attributs protégés statiques | |
static | $incrementStyles |
String handling class for UTF-8 data wrapping the phputf8 library. All functions assume the validity of UTF-8 strings.
|
static |
Tests whether a string complies as UTF-8.
This will be much faster than StringHelper::valid() but will pass five and six octet UTF-8 sequences, which are not supported by Unicode and so cannot be displayed correctly in a browser. In other words it is not as strict as StringHelper::valid() but it's faster. If you use it to validate user input, you place yourself at the risk that attackers will be able to inject 5 and 6 byte sequences (which may or may not be a significant risk, depending on what you are are doing).
string | $str | UTF-8 string to check |
Références utf8_compliant().
|
static |
Increments a trailing number in a string.
Used to easily create distinct labels when copying objects. The method has the following styles:
default: "Label" becomes "Label (2)" dash: "Label" becomes "Label-2"
string | $string | The source string. |
string | null | $style | The the style (default|dash). |
integer | $n | If supplied, this number is used for the copy, otherwise it is the 'next' number. |
Référencé par FieldTable\check(), GroupModel\generateGroupTitle(), StageModel\generateNewTitle(), WorkflowModel\generateNewTitle(), TransitionModel\generateNewTitle(), StyleModel\generateNewTitle(), FieldModel\generateNewTitle(), ModuleModel\generateNewTitle(), AdminModel\generateNewTitle(), CategoryModel\generateNewTitle(), ItemModel\generateNewTitle(), et ModuleModel\save().
|
static |
Tests whether a string contains only 7bit ASCII bytes.
You might use this to conditionally check whether a string needs handling as UTF-8 or not, potentially offering performance benefits by using the native PHP equivalent if it's just ASCII e.g.;
if (StringHelper::is_ascii($someString)) { // It's just ASCII - use the native PHP version $someString = strtolower($someString); } else { $someString = StringHelper::strtolower($someString); }
string | $str | The string to test. |
Références utf8_is_ascii().
|
static |
UTF-8 aware replacement for ltrim()
Strip whitespace (or other characters) from the beginning of a string. You only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters. Otherwise ltrim will work normally on a UTF-8 string.
string | $str | The string to be trimmed |
string | boolean | $charlist | The optional charlist of additional characters to trim |
Références utf8_ltrim().
|
static |
UTF-8 aware alternative to ord()
Returns the unicode ordinal for a character.
string | $chr | UTF-8 encoded character |
Références utf8_ord().
Référencé par OutputFilter\stringJSSafe().
|
static |
UTF-8 aware replacement for rtrim()
Strip whitespace (or other characters) from the end of a string. You only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters. Otherwise rtrim will work normally on a UTF-8 string.
string | $str | The string to be trimmed |
string | boolean | $charlist | The optional charlist of additional characters to trim |
Références utf8_rtrim().
|
static |
UTF-8 aware alternative to str_ireplace()
Case-insensitive version of str_replace()
string | $search | String to search |
string | $replace | Existing string to replace |
string | $str | New string to replace with |
integer | null | boolean | $count | Optional count value to be passed by referene |
Références $count, et utf8_ireplace().
Référencé par TagTable\check(), NewsfeedTable\check(), CoreContent\check(), ContactTable\check(), Content\check(), et Zh\tokenise().
|
static |
UTF-8 aware alternative to str_pad()
Pad a string to a certain length with another string. $padStr may contain multi-byte characters.
string | $input | The input string. |
integer | $length | If the value is negative, less than, or equal to the length of the input string, no padding takes place. |
string | $padStr | The string may be truncated if the number of padding characters can't be evenly divided by the string's length. |
integer | $type | The type of padding to apply |
Références $input, $type, et utf8_str_pad().
|
static |
UTF-8 aware alternative to str_split()
Convert a string to an array.
string | $str | UTF-8 encoded string to process |
integer | $splitLen | Number to characters to split string by |
Références utf8_str_split().
|
static |
UTF-8/LOCALE aware alternative to strcasecmp()
A case insensitive string comparison.
string | $str1 | string 1 to compare |
string | $str2 | string 2 to compare |
string | boolean | $locale | The locale used by strcoll or false to use classical comparison |
https://www.php.net/strcoll https://www.php.net/setlocale 1.3.0
Références elseif, StringHelper\stristr(), utf8_strcasecmp(), et utf8_strtolower().
Référencé par ArrayHelper\sortObjects().
|
static |
UTF-8/LOCALE aware alternative to strcmp()
A case sensitive string comparison.
string | $str1 | string 1 to compare |
string | $str2 | string 2 to compare |
mixed | $locale | The locale used by strcoll or false to use classical comparison |
https://www.php.net/strcoll https://www.php.net/setlocale 1.3.0
Références elseif, et StringHelper\stristr().
Référencé par LanguagesModel\getLanguages(), et ArrayHelper\sortObjects().
UTF-8 aware alternative to strcspn()
Find length of initial segment not matching mask.
string | $str | The string to process |
string | $mask | The mask |
integer | boolean | $start | Optional starting character position (in characters) |
integer | boolean | $length | Optional length |
Références $start, et utf8_strcspn().
|
static |
UTF-8 aware alternative to stristr()
Returns all of haystack from the first occurrence of needle to the end. Needle and haystack are examined in a case-insensitive manner to find the first occurrence of a string using case insensitive comparison.
string | $str | The haystack |
string | $search | The needle |
Références utf8_stristr().
Référencé par StringHelper\strcasecmp(), StringHelper\strcmp(), ContactEmailRule\test(), ContactEmailSubjectRule\test(), et ContactEmailMessageRule\test().
|
static |
UTF-8 aware alternative to strlen()
Returns the number of characters in the string (NOT THE NUMBER OF BYTES).
string | $str | UTF-8 string. |
Références utf8_strlen().
Référencé par Token\__construct(), User\check(), InputFilter\cleanTags(), TextDescriptor\describeJoomlaApplication(), Application\doRenderThrowable(), InputFilter\escapeAttributeValues(), TextDescriptor\getColumnWidth(), et Query\processString().
|
static |
UTF-8 aware alternative to strpos()
Find position of first occurrence of a string.
string | $str | String being examined |
string | $search | String being searched for |
integer | null | boolean | $offset | Optional, specifies the position from which the search should be performed |
Références Joomla\Database\Query\$offset, et utf8_strpos().
Référencé par InputFilter\cleanTags(), RandomImageHelper\getFolder(), ActionlogsHelper\getHumanReadableLogMessage(), Helper\getPrimaryLanguage(), HelpModel\getToc(), et Query\processString().
|
static |
UTF-8 aware alternative to strrev()
Reverse a string.
string | $str | String to be reversed |
Références utf8_strrev().
|
static |
UTF-8 aware alternative to strrpos()
Finds position of last occurrence of a string.
string | $str | String being examined. |
string | $search | String being searched for. |
integer | $offset | Offset from the left of the string. |
Références Joomla\Database\Query\$offset, et utf8_strrpos().
UTF-8 aware alternative to strspn()
Find length of initial segment matching mask.
string | $str | The haystack |
string | $mask | The mask |
integer | null | $start | Start optional |
integer | null | $length | Length optional |
Références $start, null, et utf8_strspn().
|
static |
UTF-8 aware alternative to strtolower()
Make a string lowercase
Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example. See Unicode Standard Annex #21: Case Mappings
string | $str | String being processed |
Références utf8_strtolower().
Référencé par SuggestionsModel\getListQuery(), TracksModel\getListQuery(), StylesModel\getListQuery(), TemplatesModel\getListQuery(), ModulesModel\getListQuery(), HelpModel\getToc(), SearchModel\populateState(), Query\processDates(), Query\processString(), SiteApplication\route(), CMSApplication\route(), OutputFilter\stringURLSafe(), OutputFilter\stringUrlSafe(), OutputFilter\stringUrlUnicodeSlug(), Language\tokenise(), et Language\transliterate().
|
static |
UTF-8 aware alternative to strtoupper()
Make a string uppercase
Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example. See Unicode Standard Annex #21: Case Mappings
string | $str | String being processed |
Références utf8_strtoupper().
|
static |
UTF-8 aware alternative to substr()
Return part of a string given character offset (and optionally length).
string | $str | String being processed |
integer | $offset | Number of UTF-8 characters offset (from left) |
integer | null | boolean | $length | Optional length in UTF-8 characters from offset |
Références Joomla\Database\Query\$offset, et utf8_substr().
Référencé par InputFilter\cleanTags(), InputFilter\escapeAttributeValues(), Helper\getPrimaryLanguage(), ArticlesCategoryHelper\groupByDate(), Indexer\index(), et Query\processString().
|
static |
UTF-8 aware alternative to substr_replace()
Replace text within a portion of a string.
string | $str | The haystack |
string | $repl | The replacement string |
integer | $start | Start |
integer | boolean | null | $length | Length (optional) |
Références $start, et utf8_substr_replace().
|
static |
Transcode a string.
string | $source | The string to transcode. |
string | $fromEncoding | The source encoding. |
string | $toEncoding | The target encoding. |
|
static |
UTF-8 aware replacement for trim()
Strip whitespace (or other characters) from the beginning and end of a string. You only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters. Otherwise trim will work normally on a UTF-8 string
string | $str | The string to be trimmed |
string | boolean | $charlist | The optional charlist of additional characters to trim |
Références utf8_trim().
Référencé par InputFilter\cleanTrim(), et Indexer\tokenizeToDb().
UTF-8 aware alternative to ucfirst()
Make a string's first character uppercase or all words' first character uppercase.
string | $str | String to be processed |
string | null | $delimiter | The words delimiter (null means do not split the string) |
string | null | $newDelimiter | The new words delimiter (null means equal to $delimiter) |
Références null, et utf8_ucfirst().
Référencé par FormField\__construct(), et FormHelper\loadClass().
|
static |
UTF-8 aware alternative to ucwords()
Uppercase the first character of each word in a string.
string | $str | String to be processed |
Références utf8_ucwords().
|
static |
Converts Unicode sequences to UTF-16 string.
string | $str | Unicode string to convert |
|
static |
Converts Unicode sequences to UTF-8 string.
string | $str | Unicode string to convert |
|
static |
Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard.
Note: this function has been modified to simple return true or false.
string | $str | UTF-8 encoded string. |
Références utf8_is_valid().
Référencé par UrlRule\test().
|
staticprotected |