PHP Class yupe\helpers\YText

Afficher le fichier Open project: yupe/yupe Class Usage Examples

Méthodes publiques

Méthode 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 méthode

public static asciiToEntities ( $str ) : string
$str
Résultat string

characterLimiter() public static méthode

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

entitiesToAscii() public static méthode

public static entitiesToAscii ( $str, boolean | true $all = true ) : mixed
$str
$all boolean | true
Résultat mixed

highlightPhrase() public static méthode

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

langToflag() public static méthode

public static langToflag ( $lang ) : string
$lang
Résultat string

shortName() public static méthode

public static shortName ( $name ) : mixed
$name
Résultat mixed

translit() public static méthode

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

wordCensor() public static méthode

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

wordLimiter() public static méthode

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

wordWrap() public méthode

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
Résultat string