本文整理汇总了PHP中MyTextSanitizer::htmlSpecialChars方法的典型用法代码示例。如果您正苦于以下问题:PHP MyTextSanitizer::htmlSpecialChars方法的具体用法?PHP MyTextSanitizer::htmlSpecialChars怎么用?PHP MyTextSanitizer::htmlSpecialChars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyTextSanitizer
的用法示例。
在下文中一共展示了MyTextSanitizer::htmlSpecialChars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLinkedText
/**
*
*
* @param string $text
* @param array $glossaryterms
* @param bool $html allow html?
* @return string
**/
function getLinkedText( $text, $glossaryterms, $html ,$addtext )
{
#### matching ####
$count = 0;
$count = count( $glossaryterms );
if ($count > 0 && is_array($glossaryterms))
{
if (!$html)
{
$text = parent::htmlSpecialChars( $text );
}
$q_arr = array();
$parts = array();
$text2 = array();
$text3 = "";
list($spatternf,$spatterne) = explode(",",$this->getModuleConfig("spattern"));
$parts = explode(">", $text);
foreach($parts as $key=>$part)
{
for ( $i = 0; $i < $count; $i++ )
{
foreach($glossaryterms[$i]['list'] as $md)
{
$q_arr1 = array();
$q_arr2 = array();
$q_arr3 = array();
$search_term = array();
$replace_term = $pattern = "";
$title = $md['title'];
if (!$md['title'])
{
continue;
}
if (!$html)
{
$title = $md['title'] = parent::htmlSpecialChars( $md['title'] );
}
if (!$md['image'])
{
$image_url = XOOPS_URL.'/images/icons/posticon2.gif';
}
else
{
$image_url = XOOPS_URL."/modules/".$glossaryterms[$i]['mod']."/".$md['image'];
}
$title = '<a href="'.XOOPS_URL.'/modules/'.$glossaryterms[$i]['mod'].'/'.$md['link'].'" title="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'"><img src="'.$image_url.'" width="21" height="21" alt="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'" />'.$title.'</a>';
$md['title'] = preg_quote($md['title'],"/");
// if (_CHARSET =="EUC-JP")
if ($spatternf && $spatterne)
{
// $search_term[] = $pattern = "/(\xA1[\xAE\xC6\xC8\xCC\xCE\xD0\xD2\xD4\xD6\xD8\xDA])(".$md['title'].")(\xA1[\xAD\xC7\xC9\xCD\xCF\xD1\xD3\xD5\xD7\xD9\xDB])/i";
$search_term[] = $pattern = "/($spatternf)(".$md['title'].")($spatterne)/i";
if (preg_match($pattern,$parts[$key]))
{
$text2[] = $title;
}
}
if (preg_match('/^[\x20-\x7e]+$/',$md['title']))
{
$md['title'] = $md['title']."|".$md['title']."s|".$md['title']."es";
$search_term[] = $pattern = "/([\'\\\"`]|"|')(".$md['title'].")(\\1)/i";
if (preg_match($pattern,$parts[$key]))
{
$text2[] = $title;
}
}
if ($this->getModuleConfig("linktermsposition"))
{
// $replace_term = '<a href="'.XOOPS_URL.'/modules/'.$glossaryterms[$i]['mod'].'/'.$md['link'].'"><img src="'.$image_url.'" width="21" height="21" alt="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'" /></a>$1$2$3';
$replace_term = '<a href="'.XOOPS_URL.'/modules/'.$glossaryterms[$i]['mod'].'/'.$md['link'].'"><img src="'.$image_url.'" width="21" height="21" alt="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'" />$2</a>';
$parts[$key] = preg_replace($search_term, $replace_term, $parts[$key]);
}
}
}
}
$text = implode(">", $parts);
$text2 = array_unique($text2);
if ( $addtext )
{
$text3 = implode(" ", $text2);
$text3 = ( $text3 != "" && !$this->getModuleConfig("linktermsposition")) ? "\n<p style='clear:both;margin:4em 0em 0em 0em;'>".parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$text3."</p>" : "";
$text = $text.$text3;
}
else
{
$text = implode(" ", $text2);
}
}
elseif ( !$addtext )
{
$text = "";
}
//.........这里部分代码省略.........