本文整理汇总了PHP中Zend_Markup_Token::getTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Markup_Token::getTag方法的具体用法?PHP Zend_Markup_Token::getTag怎么用?PHP Zend_Markup_Token::getTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Markup_Token
的用法示例。
在下文中一共展示了Zend_Markup_Token::getTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _execute
/**
* Execute the token
*
* @param Zend_Markup_Token $token
* @return string
*/
protected function _execute(Zend_Markup_Token $token)
{
// first return the normal text tags
if ($token->getType() == Zend_Markup_Token::TYPE_NONE) {
return $this->_filter($token->getTag());
}
// if the token doesn't have a notation, return the plain text
if (!isset($this->_markups[$token->getName()])) {
$oldToken = $this->_token;
$return = $this->_filter($token->getTag()) . $this->_render($token) . $token->getStopper();
$this->_token = $oldToken;
return $return;
}
$name = $this->_getMarkupName($token);
$markup = !$name ? false : $this->_markups[$name];
$empty = is_array($markup) && array_key_exists('empty', $markup) && $markup['empty'];
// check if the tag has content
if (!$empty && !$token->hasChildren()) {
return '';
}
// check for the context
if (is_array($markup) && !in_array($markup['group'], $this->_groups[$this->_group])) {
$oldToken = $this->_token;
$return = $this->_filter($token->getTag()) . $this->_render($token) . $token->getStopper();
$this->_token = $oldToken;
return $return;
}
// check for the filter
if (!isset($markup['filter']) || !$markup['filter'] instanceof Zend_Filter_Interface && $markup['filter'] !== false) {
$this->_markups[$name]['filter'] = $this->getDefaultFilter();
}
// save old values to reset them after the work is done
$oldFilter = $this->_filter;
$oldGroup = $this->_group;
$return = '';
// set the filter and the group
$this->_filter = $this->getFilter($name);
if ($group = $this->_getGroup($token)) {
$this->_group = $group;
}
// callback
if (is_array($markup) && $markup['type'] & self::TYPE_CALLBACK) {
// load the callback if the tag doesn't exist
if (!$markup['callback'] instanceof Zend_Markup_Renderer_TokenConverterInterface) {
$class = $this->getPluginLoader()->load($name);
$markup['callback'] = new $class();
if (!$markup['callback'] instanceof Zend_Markup_Renderer_TokenConverterInterface) {
require_once 'Zend/Markup/Renderer/Exception.php';
throw new Zend_Markup_Renderer_Exception("Callback for tag '{$name}' found, but it isn't valid.");
}
if (method_exists($markup['callback'], 'setRenderer')) {
$markup['callback']->setRenderer($this);
}
}
if ($markup['type'] && !$empty) {
$return = $markup['callback']->convert($token, $this->_render($token));
} else {
$return = $markup['callback']->convert($token, null);
}
} else {
// replace
if ($markup['type'] && !$empty) {
$return = $this->_executeReplace($token, $markup);
} else {
$return = $this->_executeSingleReplace($token, $markup);
}
}
// reset to the old values
$this->_filter = $oldFilter;
$this->_group = $oldGroup;
return $return;
}