本文整理匯總了PHP中IPSText::convertNumericEntityToNamed方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::convertNumericEntityToNamed方法的具體用法?PHP IPSText::convertNumericEntityToNamed怎麽用?PHP IPSText::convertNumericEntityToNamed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::convertNumericEntityToNamed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _parseBBCodeTag
/**
* 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 _parseBBCodeTag($_bbcode, $option = '', $content = '')
{
// -----------------------------------------
// Strip the optional quote delimiters
// -----------------------------------------
$option = str_replace('"', '"', $option);
$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);
/* http://community.invisionpower.com/resources/bugs.html/_/ip-board/error-in-accented-characters-in-the-option-tag-bbcode-r40739 */
$option = IPSText::convertNumericEntityToNamed($option);
$option = IPSText::decodeNamedHtmlEntities($option);
$option = IPSText::UNhtmlspecialchars($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;
}