|
Perforce Chronicle 2012.2/486814
API Documentation
|
Extends the head title helper to insert a separator between the prefix/postfix and the title. More...
Public Member Functions | |
| toString ($indent=null, $locale=null) | |
| Turn helper into string - overrides parent to put the separator between title parts and prefix/postfix. | |
Protected Member Functions | |
| _stripTitleTag ($output) | |
| Strip title tag from output. | |
Protected Attributes | |
| $_regKey = 'P4Cms_View_Helper_HeadTitle' | |
Extends the head title helper to insert a separator between the prefix/postfix and the title.
| P4Cms_View_Helper_HeadTitle::_stripTitleTag | ( | $ | output | ) | [protected] |
Strip title tag from output.
| string | $output | the output to strip title tags from |
{
return preg_replace('/<\/?title>/i', '', $output);
}
| P4Cms_View_Helper_HeadTitle::toString | ( | $ | indent = null, |
| $ | locale = null |
||
| ) |
Turn helper into string - overrides parent to put the separator between title parts and prefix/postfix.
| string | null | $indent | how much to indent the output |
| string | null | $locale | the locale to inform translation |
Reimplemented in P4Cms_View_Helper_BodyTitle.
{
$indent = (null !== $indent)
? $this->getWhitespace($indent)
: $this->getIndent();
$items = array();
if ($this->_translate && $translator = $this->getTranslator()) {
foreach ($this as $item) {
$items[] = $translator->translate($item, $locale);
}
} else {
foreach ($this as $item) {
$items[] = $item;
}
}
$separator = $this->getSeparator();
$output = '';
if (($prefix = $this->getPrefix())) {
array_unshift($items, $prefix);
}
if (($postfix = $this->getPostfix())) {
array_push($items, $postfix);
}
$output .= implode($separator, $items);
$output = ($this->_autoEscape) ? $this->_escape($output) : $output;
return $indent . '<title>' . $output . '</title>';
}
P4Cms_View_Helper_HeadTitle::$_regKey = 'P4Cms_View_Helper_HeadTitle' [protected] |
Reimplemented in P4Cms_View_Helper_BodyTitle.