本文整理匯總了PHP中IPSText::decodeNamedHtmlEntities方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::decodeNamedHtmlEntities方法的具體用法?PHP IPSText::decodeNamedHtmlEntities怎麽用?PHP IPSText::decodeNamedHtmlEntities使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::decodeNamedHtmlEntities方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _bbcodeToHtml
/**
* Does the actual bbcode replacement
*
* @access protected
* @param string Current bbcode to parse
* @param string [Optional] Option text
* @param string [Optional for single tag bbcodes] Content text
* @return string Converted text
*/
protected function _bbcodeToHtml($_bbcode, $option = '', $content = '')
{
//-----------------------------------------
// Strip the optional quote delimiters
//-----------------------------------------
$option = str_replace('"', '"', $option);
$option = str_replace(''', "'", $option);
$option = trim($option, '"' . "'");
//-----------------------------------------
// Stop CSS injection
//-----------------------------------------
if ($option) {
//-----------------------------------------
// Cut off for entities in option
// @see http://community.invisionpower.com/tracker/issue-19958-acronym/
//-----------------------------------------
$option = IPSText::UNhtmlspecialchars($option);
$option = str_replace('!', '!', $option);
$option = IPSText::decodeNamedHtmlEntities($option);
if (strpos($option, ';') !== false) {
$option = substr($option, 0, strpos($option, ';'));
}
$charSet = IPS_DOC_CHAR_SET == 'ISO-8859-1' ? 'ISO-8859-15' : IPS_DOC_CHAR_SET;
$option = @htmlentities($option, ENT_NOQUOTES, $charSet);
$option = str_replace('!', '!', $option);
}
$option = str_replace('"', '"', $option);
$option = str_replace("'", ''', $option);
//-----------------------------------------
// Swapping option/content?
//-----------------------------------------
if ($_bbcode['bbcode_switch_option']) {
$_tmp = $content;
$content = $option;
$option = $_tmp;
}
//-----------------------------------------
// Replace
//-----------------------------------------
$replaceCode = $_bbcode['bbcode_replace'];
$replaceCode = str_replace('{base_url}', $this->settings['board_url'] . '/index.php?', $replaceCode);
$replaceCode = str_replace('{image_url}', $this->settings['img_url'], $replaceCode);
preg_match('/\\{text\\.(.+?)\\}/i', $replaceCode, $matches);
if (is_array($matches) and count($matches)) {
$replaceCode = str_replace($matches[0], $this->lang->words[$matches[1]], $replaceCode);
}
$replaceCode = str_replace('{option}', $option, $replaceCode);
$replaceCode = str_replace('{content}', $content, $replaceCode);
//-----------------------------------------
// Fix linebreaks in textareas
//-----------------------------------------
if (stripos($replaceCode, "<textarea") !== false) {
$replaceCode = str_replace('<br />', "", $replaceCode);
$replaceCode = str_replace("\r", "", $replaceCode);
$replaceCode = str_replace("\n", "<br />", $replaceCode);
}
return $replaceCode;
}