本文整理汇总了PHP中vB_BbCodeParser::parse_smilies方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_BbCodeParser::parse_smilies方法的具体用法?PHP vB_BbCodeParser::parse_smilies怎么用?PHP vB_BbCodeParser::parse_smilies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_BbCodeParser
的用法示例。
在下文中一共展示了vB_BbCodeParser::parse_smilies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _parseBB
private function _parseBB($text, $type = 'pm')
{
include_once DIR . '/includes/class_dle_parse.php';
$parse = new DLE_ParseFilter();
$parse->safe_mode = true;
// $parse->allow_url = false;
// $parse->allow_image = false;
$bbparser = new vB_BbCodeParser($this->vbulletin, fetch_tag_list());
$this->_fetch_home_url();
$text = $bbparser->parse_smilies($text);
$text = preg_replace('#<img .*?src=[\'"]([^h].+?)[\'"] .*?/>#si', "[img]{$this->vbulletin->basepath}\\1[/img]", $text);
$text = $parse->process($text);
if ($type == 'pm') {
$quote = 'Цитата';
if (strtolower($this->vbulletin->userinfo['lang_charset']) != 'utf-8') {
$quote = iconv('utf-8', $this->vbulletin->userinfo['lang_charset'], $quote);
}
$text = preg_replace('#\\[QUOTE\\]#si', "<!--QuoteBegin--><div class=\"quote\"><!--QuoteEBegin-->", $text);
$text = preg_replace('#\\[quote=(.+?)\\]#si', "<!--QuoteBegin \\1 --><div class=\"title_quote\">{$quote}: \\1</div><div class=\"quote\"><!--QuoteEBegin-->", $text);
$text = preg_replace('#\\[/quote\\]#si', "<!--QuoteEnd--></div><!--QuoteEEnd-->", $text);
$text = preg_replace('#\\[post\\]([0-9]+)\\[/post\\]#si', "<a href='" . $this->vbulletin->basepath . "showthread.php?p=\\1#post\\1'>" . $this->vbulletin->basepath . "showthread.php?p=\\1</a>", $text);
} else {
if ($type == 'signature') {
$text = strip_tags($text);
if ($this->vbulletin->options['usefileavatar']) {
$sigpic_url = $this->vbulletin->options['sigpicurl'] . '/sigpic' . $this->vbulletin->userinfo['userid'] . '_' . $this->vbulletin->userinfo['sigpicrevision'] . '.gif';
} else {
$sigpic_url = 'image.php?u=' . $this->vbulletin->userinfo['userid'] . "&type=sigpic&dateline=" . $userinfo_sigpic['sigpicdateline'];
}
$text = preg_replace('#\\[SIGPIC\\]\\[/SIGPIC\\]#si', "[img]{$this->vbulletin->basepath}{$sigpic_url}[/img]", $text);
$text = preg_replace('#\\[SIGPIC\\](.+?)\\[/SIGPIC\\]#si', "[img=|\\1]{$this->vbulletin->basepath}{$sigpic_url}[/img]", $text);
}
}
$text = preg_replace("#\\[size="([^&]+)"\\]#is", "[size=\\1]", $text);
$text = preg_replace("#\\[font="([^&]+)"\\]#is", "[font=\\1]", $text);
$text = $parse->BB_Parse($text, false);
// $text = preg_replace('#\[.+?\]#si', "", $text);
return $text;
}
示例2: parse_post
function parse_post($text, $allowsmilie = false)
{
global $nuke_quotes, $fr_platform, $images;
$images = array();
if (is_ipb()) {
// Replace <br.*/> with \n
$text = preg_replace('#<br.*?/>#is', "\n", $text);
}
$smilies = false;
$v = process_input(array('smilies' => BOOLEAN));
if (isset($v['smilies'])) {
$smilies = $v['smilies'] === true;
}
// Trim each line
$lines = preg_split("/\n/", $text);
for ($i = 0; $i < count($lines); $i++) {
$lines[$i] = trim($lines[$i]);
}
$text = join("\n", $lines);
$text = prepare_utf8_string($text, false);
$bbcode = new StringParser_BBCode();
$bbcode->setGlobalCaseSensitive(false);
// Handle default BBCode
$bbcode->addCode('quote', 'callback_replace', 'handle_quotes', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('url', 'usecontent?', 'handle_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link'));
$bbcode->addCode('source', 'usecontent?', 'handle_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link'));
if (!is_mybb()) {
// myBB wonky attachment codes are already handled
$bbcode->addCode('attach', 'callback_replace', 'handle_attach', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
}
$bbcode->addCode('attach', 'callback_replace', 'handle_attach', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('img', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('imgl', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('imgr', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
//$bbcode->addCode('spoiler', 'callback_replace', 'handle_spoiler', array(), 'inline',
//array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('b', 'callback_replace', 'handle_bbcode_bold', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array());
$bbcode->addCode('i', 'callback_replace', 'handle_bbcode_italic', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array());
$bbcode->addCode('color', 'callback_replace', 'handle_bbcode_color', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array());
$bbcode->setCodeFlag('color', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
// Video Link BBCode
$bbcode->addCode('yt', 'callback_replace', 'fr_handle_youtube', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('youtube', 'callback_replace', 'fr_handle_youtube', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('video', 'callback_replace', 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('ame', 'callback_replace', 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('media', 'callback_replace', is_xen() ? 'handle_xen_media' : 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
$bbcode->addCode('tex', 'callback_replace', 'fr_handle_tex', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
if (function_exists('fr_branded_bbcode_handler')) {
@fr_branded_bbcode_handler($bbcode);
}
if (is_mybb()) {
$bbcode->setMixedAttributeTypes(true);
}
$nuked_quotes = $text;
$text = htmlspecialchars_uni($text);
$nuke_quotes = true;
$nuked_quotes = $bbcode->parse($nuked_quotes);
if (is_ipb()) {
$nuked_quotes = ipb_handle_attachments($nuked_quotes);
}
$nuke_quotes = false;
$text = $bbcode->parse($text);
if (is_ipb()) {
$text = ipb_handle_attachments($text);
}
// Snag out images
preg_match_all('#\\[IMG\\](.*?)\\[/IMG\\]#is', $text, $matches);
$text = preg_replace("#\\[IMG\\](.*?)\\[/IMG\\]#is", '', $text);
$nuked_quotes = preg_replace("#\\[IMG\\](.*?)\\[/IMG\\]#is", '', $nuked_quotes);
if ($smilies) {
if (is_vb()) {
global $vbulletin;
$parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$text = $parser->parse_smilies($text, false);
$text = preg_replace_callback('#img src="(.*?)"#is', parse_post_callback, $text);
}
}
$text = preg_replace("#\n\n\n+#", "\n\n", $text);
$text = preg_replace("#\n#", "<br/>", $text);
$text = remove_bbcode($text);
$nuked_quotes = preg_replace("#\n\n\n+#", "\n\n", $nuked_quotes);
$nuked_quotes = remove_bbcode($nuked_quotes);
return array($text, $nuked_quotes, $images);
}