本文整理汇总了PHP中BBCode::encode_html方法的典型用法代码示例。如果您正苦于以下问题:PHP BBCode::encode_html方法的具体用法?PHP BBCode::encode_html怎么用?PHP BBCode::encode_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBCode
的用法示例。
在下文中一共展示了BBCode::encode_html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: split_on_bbcodes
protected static function split_on_bbcodes($text, $allowed = 0, $allow_html = false)
{
global $bb_codes;
# Split all bbcodes.
$text_parts = BBCode::split_bbcodes($text);
# Merge all bbcodes and do special actions depending on the type of code.
$text = '';
while ($part = array_shift($text_parts)) {
if ($part['code'] == 'php') {
# [PHP]
$text .= $allowed ? BBCode::decode_php($part['text']) : nl2br(htmlspecialchars($part['text']));
} elseif ($part['code'] == 'code') {
# [CODE]
if (!$allowed && false !== strpos($part['text'], '<')) {
$part['text'] = nl2br(htmlspecialchars($part['text']));
}
$text .= $allowed ? BBCode::decode_code($part['text']) : $part['text'];
} elseif ($part['code'] == 'quote') {
# [QUOTE] and [QUOTE=""]
if ($part['text'][6] == ']') {
$text .= $bb_codes['quote'] . BBCode::split_on_bbcodes(substr($part['text'], 7, -8), $allowed, $allow_html) . $bb_codes['quote_close'];
} else {
$part['text'] = preg_replace('/\\[quote=["]*(.*?)["]*\\]/si', $bb_codes['quote_name'], BBCode::split_on_bbcodes(substr($part['text'], 0, -8), $allowed, $allow_html), 1);
$text .= $part['text'] . $bb_codes['quote_close'];
}
} elseif ($part['subc']) {
$tmptext = '[' . BBCode::split_on_bbcodes(substr($part['text'], 1, -1)) . ']';
$text .= $part['code'] == 'list' ? BBCode::decode_list($tmptext) : $tmptext;
unset($tmptext);
} else {
if ($allow_html) {
$tmptext = false === strpos($part['text'], '<') ? nl2br($part['text']) : $part['text'];
} else {
$tmptext = nl2br(BBCode::encode_html($part['text']));
}
$text .= $part['code'] == 'list' ? BBCode::decode_list($tmptext) : $tmptext;
unset($tmptext);
}
}
return $text;
}
示例2: array
$user_sig = $post_info['user_sig'] != '' && $board_config['allow_sig'] ? $post_info['user_sig'] : '';
}
}
if ($preview) {
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$preview_message = message_prepare($message, $html_on, $bbcode_on);
$preview_subject = $subject;
$preview_username = $username;
//
// Finalise processing as per viewtopic
//
if (!$html_on) {
if ($user_sig != '' || !$userdata['user_allowhtml']) {
$user_sig = BBCode::encode_html($user_sig);
}
}
if ($attach_sig && $user_sig != '') {
$user_sig = decode_bbcode($user_sig, 1, false);
}
if ($bbcode_on) {
$preview_message = decode_bbcode($preview_message, 1, true);
}
if (!empty($orig_word)) {
$preview_username = !empty($username) ? preg_replace($orig_word, $replacement_word, $preview_username) : '';
$preview_subject = !empty($subject) ? preg_replace($orig_word, $replacement_word, $preview_subject) : '';
$preview_message = !empty($preview_message) ? preg_replace($orig_word, $replacement_word, $preview_message) : '';
}
if ($user_sig != '') {
$user_sig = make_clickable($user_sig);