PHP Класс Horde_View_Helper_Text, horde

Автор: Mike Naberezny ([email protected])
Автор: Derek DeVries ([email protected])
Автор: Chuck Hagenbuch ([email protected])
Наследование: extends Horde_View_Helper_Base
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$_cycles array
$_inflector Horde_Support_Inflector

Открытые методы

Метод Описание
cleanSmartQuotes ( string $str ) : string Removes smart quotes.
cycle ( $firstValue ) Creates a Cycle object whose __toString() method cycles through elements of an array every time it is called.
h ( mixed $var ) : mixed Escapes a value for output in a view template.
highlight ( string $text, string $phrase, string $highlighter = null ) : string Highlights a phrase where it is found in the text by surrounding it like I'm highlighted.
makeBreakable ( string $str ) : string Inserts HTML code to allow linebreaks in a string after slashes or underscores.
pluralize ( integer $count, string $singular, string $plural = null ) Pluralizes the $singular word unless $count is one. If $plural form is not supplied, inflector will be used.
resetCycle ( string $name = 'default' ) Resets a cycle so that it starts from the first element the next time it is called.
truncate ( string $text, integer $length = 30, string $truncateString = '...' ) : string If $text is longer than $length, $text will be truncated to the length of $length and the last three characters will be replaced with the $truncateString.
truncateMiddle ( string $str, integer $maxLength = 80, string $joiner = '...' ) : string Limits a string to a given maximum length in a smarter way than just using substr().

Описание методов

cleanSmartQuotes() публичный Метод

Removes smart quotes.
См. также: http://shiflett.org/blog/2005/oct/convert-smart-quotes-with-php
public cleanSmartQuotes ( string $str ) : string
$str string A string with potential smart quotes.
Результат string The cleaned-up string.

cycle() публичный Метод

This can be used for example, to alternate classes for table rows: "> item You can use named cycles to allow nesting in loops. Passing an array as the last parameter with a name key will create a named cycle. You can manually reset a cycle by calling resetCycle() and passing the name of the cycle: values as $value): ?> resetCycle('colors') ?>
public cycle ( $firstValue )

h() публичный Метод

h($this->templateVar) ?>

public h ( mixed $var ) : mixed
$var mixed The output to escape.
Результат mixed The escaped value.

highlight() публичный Метод

The Highlighter can be customized by passing $highlighter as a string containing $1 as a placeholder where the phrase is supposed to be inserted.
public highlight ( string $text, string $phrase, string $highlighter = null ) : string
$text string A text containing phrases to highlight.
$phrase string A phrase to highlight in $text.
$highlighter string A highlighting replacement.
Результат string The highlighted text.

makeBreakable() публичный Метод

Inserts HTML code to allow linebreaks in a string after slashes or underscores.
public makeBreakable ( string $str ) : string
$str string A string to mark up with linebreak markers.
Результат string The marked-up string.

pluralize() публичный Метод

Pluralizes the $singular word unless $count is one. If $plural form is not supplied, inflector will be used.
public pluralize ( integer $count, string $singular, string $plural = null )
$count integer Count determines singular or plural.
$singular string Singular form.
$plural string Plural form (optional).

resetCycle() публичный Метод

Pass in $name to reset a named cycle.
public resetCycle ( string $name = 'default' )
$name string Name of cycle to reset.

truncate() публичный Метод

$this->truncate('Once upon a time in a world far far away', 14); => Once upon a...
public truncate ( string $text, integer $length = 30, string $truncateString = '...' ) : string
$text string A text to truncate.
$length integer The maximum length of the text
$truncateString string Replacement string for the truncated text.
Результат string The truncated text.

truncateMiddle() публичный Метод

Namely, cut from the MIDDLE instead of from the end so that if we're doing this on (for instance) a bunch of binder names that start off with the same verbose description, and then are different only at the very end, they'll still be different from one another after truncating. $str = 'The quick brown fox jumps over the lazy dog tomorrow morning.'; $shortStr = $this->truncateMiddle($str, 40); $shortStr == 'The quick brown fox... tomorrow morning.'
public truncateMiddle ( string $str, integer $maxLength = 80, string $joiner = '...' ) : string
$str string A text to truncate.
$maxLength integer The maximum length of the text
$joiner string Replacement string for the truncated text.
Результат string The truncated text.

Описание свойств

$_cycles защищенное свойство

protected array $_cycles
Результат array

$_inflector защищенное свойство

protected Horde_Support_Inflector $_inflector
Результат Horde_Support_Inflector