public static
array
|
#
getXmlIllegalCharacters( )
Get XML illegal characters
Get XML illegal characters
Returns
array
|
public static
string
|
#
xml( string $string )
Correct string to XML legal characters
http://www.w3.org/TR/xml/#charsets
Correct string to XML legal characters
http://www.w3.org/TR/xml/#charsets
Parameters
Returns
string
|
public static
string
|
#
deleteIllegalCharacters( string $string )
Delete illegal characters
Delete illegal characters
Parameters
Returns
string
|
public static
string
|
#
cut( string $string, integer $maxLen = 15 )
Cut string to defined lenght
Cut string to defined lenght
Parameters
- $string
- source string
- $maxLen
- lenght
Returns
string
|
public static
boolean
|
#
startsWith( string $haystack, string $needle )
String starts with the specified string
String starts with the specified string
Parameters
Returns
boolean
|
public static
boolean
|
#
endsWith( string $haystack, string $needle )
String end with the specified string
String end with the specified string
Parameters
Returns
boolean
|
public static
string
|
#
cutWords( string $string, integer $maxLen )
Cut length of words in a string
Cut length of words in a string
Parameters
- $string
- source string
- $maxLen
- word lenght
Returns
string
|
public static
string
|
#
cutSentences( string $text, integer $maxLen = 255 )
Укорачивает описание до заданного количества символов, оставляя целое число предложений
Укорачивает описание до заданного количества символов, оставляя целое число предложений
Parameters
- $text
- $maxLen
-
<?php
$text = 'Текст описания, который необходимо укоротить';
$maxLen = 20;
$cutText = Core_Str::cutSentences($text, $maxLen);
echo $cutText;
?>
Returns
string
|
public static
null|string
|
#
getLastDetectedLanguageCode( )
Get last detected language code by self::translate()
Get last detected language code by self::translate()
Returns
null|string
|
public static
string
|
#
translate( string $string, string $targetLanguageCode = 'en' )
Translation from russian to $targetLanguageCode
Translation from russian to $targetLanguageCode
Parameters
- $string
- source string
- $targetLanguageCode
- target language
Returns
string
|
public static
string
|
#
transliteration( string $string )
Transliteration
Parameters
Returns
string
|
public static
string
|
#
str2ncr( string $str )
Convert HTML entity to numeric character reference (NCR)
Convert HTML entity to numeric character reference (NCR)
Parameters
Returns
string
|
public static
mixed
|
#
ip2hex( string $ip )
Convert IP into hexadecimal value
Convert IP into hexadecimal value
Parameters
Returns
mixed
|
public static
string
|
#
hex2ip( string $hex )
Convert hexadecimal value into IP
Convert hexadecimal value into IP
Parameters
Returns
string
|
protected static
|
#
_callbackChr( $matches )
|
public static
array
|
#
getHashes( string $text, array $param = array() )
Метод очищает HTML от ненужных тегов, хеширует и возвращает массив хэшей слов
Метод очищает HTML от ненужных тегов, хеширует и возвращает массив хэшей слов
Parameters
- $text
- исходный текст;
- $param
массив дополнительных параметров
- $param['hash_function'] = 'md5' {'md5','crc32',''} используемая ХЭШ-функция;
Returns
array массив хэшей слов
|
public static
string
|
#
declension( integer $int, string $word, array $aEndings )
Получение существительного в форме, соответствующей числу
Получение существительного в форме, соответствующей числу
Parameters
- $int
- число, с которым связано существительное
- $word
- основа слова
- $aEndings
массив окончаний слова
<?php
$word = 'новост';
$aEndings = array('ей', 'ь', 'и', 'и', 'и', 'ей', 'ей', 'ей', 'ей', 'ей');
for ($int = 0; $int < 100; $int++)
{
$result = Core_Str::declension($int, $word, $aEndings);
echo "{$num} {$result} <br />";
}
?>
Returns
string
|
protected static
|
#
_stripTagsCallback( $matches )
|
public static
string
|
#
stripTags( string $source, string $allowedTags = '', array $aDisabledAttributes = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavaible', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragdrop', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterupdate', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmoveout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload') )
Удаление HTML-тегов вместе с атрибутами
Удаление HTML-тегов вместе с атрибутами
Parameters
- $source
- Исходная строка
- $allowedTags
- Список разрешенных тегов, например, ""
- $aDisabledAttributes
- Массив запрещенных атрибутов тегов, например array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavaible', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragdrop', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterupdate', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmoveout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload')
Returns
string
|
public static
string
|
#
escapeJavascriptVariable( string $str )
Escaping apostrophe ('), slashes (), 'script' and line breaks.
Escaping apostrophe ('), slashes (), 'script' and line breaks.
Parameters
Returns
string
|
public static
string
|
#
br2nl( string $string, string $lineBreak = PHP_EOL )
Convert HTML line breaks to newlines in a string
Convert HTML line breaks to newlines in a string
Parameters
- $string
- string
- $lineBreak
- line break character
Returns
string
|
public static
integer
|
#
convertSizeToBytes( string $str )
Convert size from 10M to bytes
Convert size from 10M to bytes
Parameters
Returns
integer
|
public static
integer
|
#
getTextSize( integer $size )
Convert size from bytes to kb, mb, etc
Convert size from bytes to kb, mb, etc
Parameters
Returns
integer
|
public static
string
|
#
trimUri( string $uri )
Cut first and last slash
Parameters
Returns
string
|
public static
string
|
#
ltrimUri( string $uri )
Cut first slash
Parameters
Returns
string
|
public static
string
|
#
rtrimUri( string $uri )
Cut last slash
Parameters
Returns
string
|
public static
string
|
#
ucfirst( string $str )
ucfirst for utf-8 string
Parameters
Returns
string
|
public static
string
|
#
lcfirst( string $str )
lcfirst for utf-8 string
Parameters
Returns
string
|
public static
string
|
#
createColor( integer $id, integer $maxColor = 210 )
Get Color By Entity ID
Parameters
- $id
- Entity ID
- $maxColor
- Max color, 0-255, default 210
Returns
string HEX color, e.g. #B781AF
|
public static
string
|
#
rgb2hex( array $array )
Convert RGB to HEX color
Parameters
- $array
- $hex HEX color, e.g. #B781AF or #FF0
Returns
string HEX color, e.g. #B781AF
|
public static
string
|
#
hex2rgba( string $hex, float|null $opacity = NULL )
Convert HEX color to RGB or RGBA
Convert HEX color to RGB or RGBA
Parameters
- $hex
- HEX color, e.g. #B781AF or #FF0
- $opacity
- between 0 and 1, e.g. 0.85
Returns
string
|
public static
|
#
hex2lighter( string $hex, float $opacity )
Lighter HEX color
Parameters
- $hex
- HEX color, e.g. #B781AF or #FF0
- $opacity
- between 0 and 1, e.g. 0.85
|
public static
|
#
hex2darker( string $hex, float $opacity )
Darker HEX color
Parameters
- $hex
- HEX color, e.g. #B781AF or #FF0
- $opacity
- between 0 and 1, e.g. 0.85
|
public static
string
|
#
declensionNumber( integer $number, string $nominative, $genitive_singular, $genitive_plural )
Возвращает строку согласно падежам
Возвращает строку согласно падежам
Parameters
- $number
- number
- $nominative
- Nominative case
- $genitive_singular
- singular case
- $genitive_plural
- plural case
Returns
string
|
public static
string
|
#
removeEmoji( string $str )
Remove emoji (UTF8 4 Byte characters)
Remove emoji (UTF8 4 Byte characters)
Parameters
Returns
string
|
public static
|
#
getInitials( $fullName, $length = 2 )
|
protected static
|
#
_getInitialsReduce( $str, $item )
|
public static
string
|
#
idnToUtf8( string $domain )
Decode Punycode IDN
https://www.ietf.org/rfc/rfc3492.txt
Decode Punycode IDN
https://www.ietf.org/rfc/rfc3492.txt
Parameters
Returns
string
|
public static
string
|
#
idnToAscii( string $domain )
Encode to IDN ASCII
https://www.ietf.org/rfc/rfc3492.txt
Encode to IDN ASCII
https://www.ietf.org/rfc/rfc3492.txt
Parameters
Returns
string
|
protected static
|
#
_idnOrd( $char, $index = 0, & $iBytes = NULL )
|
public static
string
|
#
sanitizePhoneNumber( $phone )
Sanitize phone numbers
Returns
string
|
public static
string
|
#
generateChars( $number )
Get string of rand chars
Returns
string
|
public static
mixed
|
#
iconv( string $from_encoding, string $to_encoding, string|array $mValue )
Convert string to requested character encoding
Convert string to requested character encoding
Parameters
- $from_encoding
- The input charset.
- $to_encoding
- The output charset, e.g. 'UTF-8'
- $mValue
Returns
mixed
|
public static
string
|
#
toStr( mixed $mixed )
Convert $str to the string
Convert $str to the string
Parameters
Returns
string
|
public static
float
|
#
convertWeight( string $from, string $to, mixed $value )
Convert weight
Parameters
- $from
- $from, $to, $value
- $to
- $value
Returns
float
|