PHP Class yupe\helpers\YText

Show file Open project: yupe/yupe Class Usage Examples

Public Methods

Method Description
asciiToEntities ( $str ) : string
characterLimiter ( $str, $n = 500, $end_char = '…' ) : string Character Limiter
entitiesToAscii ( $str, boolean | true $all = true ) : mixed
highlightPhrase ( $str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>' ) : string Выделить фразу
langToflag ( $lang ) : string
shortName ( $name ) : mixed
translit ( $str, string $separator = '-' ) : mixed | string
wordCensor ( $str, $censored, $replacement = '' ) : string Цензор слов
wordLimiter ( $str, $limit = 100, $end_char = '&#8230;' ) : string Word Limiter
wordWrap ( $str, $charlim = '76' ) : string Word Wrap

Method Details

asciiToEntities() public static method

public static asciiToEntities ( $str ) : string
$str
return string

characterLimiter() public static method

Обрезать текст до определенного колиства символов, добавив в конце "..."
public static characterLimiter ( $str, $n = 500, $end_char = '&#8230;' ) : string
return string - новая строка

entitiesToAscii() public static method

public static entitiesToAscii ( $str, boolean | true $all = true ) : mixed
$str
$all boolean | true
return mixed

highlightPhrase() public static method

Выделить фразу в тексте
public static highlightPhrase ( $str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>' ) : string
return string - строка с выделенными фразами

langToflag() public static method

public static langToflag ( $lang ) : string
$lang
return string

shortName() public static method

public static shortName ( $name ) : mixed
$name
return mixed

translit() public static method

public static translit ( $str, string $separator = '-' ) : mixed | string
$str
$separator string
return mixed | string

wordCensor() public static method

Принимает строку и массив запрещенных слов. Слова в строке, которые содержатся в массиве заменяются на символы ###
public static wordCensor ( $str, $censored, $replacement = '' ) : string
return string - строка после замены

wordLimiter() public static method

Обрезать текст до определенного колиства слов, добавив в конце "..."
public static wordLimiter ( $str, $limit = 100, $end_char = '&#8230;' ) : string
return string - новая строка

wordWrap() public method

Wraps text at the specified character. Maintains the integrity of words. Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor will URLs.
public wordWrap ( $str, $charlim = '76' ) : string
return string