本文整理汇总了PHP中XenForo_Helper_String::getLinkClassTarget方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Helper_String::getLinkClassTarget方法的具体用法?PHP XenForo_Helper_String::getLinkClassTarget怎么用?PHP XenForo_Helper_String::getLinkClassTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Helper_String
的用法示例。
在下文中一共展示了XenForo_Helper_String::getLinkClassTarget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderTagUrl
public function renderTagUrl(array $tag, array $rendererStates)
{
if (!empty($tag['option'])) {
$url = $tag['option'];
$text = $this->renderSubTree($tag['children'], $rendererStates);
} else {
$url = $this->stringifyTree($tag['children']);
$text = urldecode($url);
if (!preg_match('/./u', $text)) {
$text = $url;
}
$text = XenForo_Helper_String::censorString($text);
if (!empty($rendererStates['shortenUrl'])) {
$length = utf8_strlen($text);
if ($length > 100) {
$text = utf8_substr_replace($text, '...', 35, $length - 35 - 45);
}
}
$text = htmlspecialchars($text);
}
$url = $this->_getValidUrl($url);
if (!$url) {
return $text;
} else {
list($class, $target, $type) = XenForo_Helper_String::getLinkClassTarget($url);
$class = $class ? " class=\"{$class}\"" : '';
$target = $target ? " target=\"{$target}\"" : '';
if ($type == 'internal') {
$noFollow = '';
} else {
$noFollow = empty($rendererStates['noFollowDefault']) ? '' : ' rel="nofollow"';
}
$url = XenForo_Helper_String::censorString($url);
$test = $this->isImage($url);
if ($test) {
return sprintf($this->_imageTemplate, htmlspecialchars($url), $rendererStates['lightBox'] ? ' LbImage' : '');
}
return $this->_wrapInHtml('<a href="' . htmlspecialchars($url) . '"' . $target . $class . $noFollow . '>', '</a>', $text);
}
}
示例2: _handleImageProxyOption
/**
* Pass an image URL to the image proxy system if appropriate
*
* @param $url
*
* @return string
*/
protected function _handleImageProxyOption($url)
{
list($class, $target, $type, $schemeMatch) = XenForo_Helper_String::getLinkClassTarget($url);
if ($type == 'external' || !$schemeMatch) {
$options = XenForo_Application::getOptions();
if (!empty($options->imageLinkProxy['images'])) {
$url = $this->_generateProxyLink('image', $url);
}
}
return $url;
}