PHP 클래스 Horde_View_Helper_Text, horde

저자: Mike Naberezny ([email protected])
저자: Derek DeVries ([email protected])
저자: Chuck Hagenbuch ([email protected])
상속: extends Horde_View_Helper_Base
파일 보기 프로젝트 열기: horde/horde

보호된 프로퍼티들

프로퍼티 타입 설명
$_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