本文整理汇总了PHP中vB_BbCodeParser::parse_bbcode方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_BbCodeParser::parse_bbcode方法的具体用法?PHP vB_BbCodeParser::parse_bbcode怎么用?PHP vB_BbCodeParser::parse_bbcode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_BbCodeParser
的用法示例。
在下文中一共展示了vB_BbCodeParser::parse_bbcode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Parse an input string with BB code to a final output string of HTML
*
* @param string Input Text (BB code)
* @param bool Whether to parse smilies
* @param bool Whether to parse img (for the video bbcodes)
* @param bool Whether to allow HTML (for smilies)
*
* @return string|false String output Text (HTML) if a valid page, false if invalid page
*/
function parse_bbcode($input_text, $do_smilies, $do_imgcode, $do_html = false)
{
if ($this->output_page)
{
$this->current_page = 1;
$this->pages = array(1 => array('title' => ''));
}
else
{
$this->current_page = 0;
$this->pages = array();
}
if (!$this->candownload)
{
$do_imgcode = false;
}
$last_page_text = parent::parse_bbcode($input_text, $do_smilies, $do_imgcode, $do_html);
$this->parse_output = '';
$this->fetched_valid_page = true;
if ($this->output_page)
{
if ($this->output_page == $this->current_page)
{
return $last_page_text;
}
else if (isset($this->pages[$this->output_page]))
{
return $this->pages[$this->output_page]['text'];
}
else
{
$this->fetched_valid_page = false;
return '';
}
}
else
{
return $last_page_text;
}
}
示例2: fetch_shouts
public function fetch_shouts($limit = 20, $userid = 0)
{
if ($userid < 1) {
$query = $this->vbulletin->db->query("\n SELECT * FROM " . TABLE_PREFIX . "jb_firebolt_shout\n WHERE pmto = '0' OR pmto = '" . intval($this->vbulletin->userinfo['userid']) . "' OR userid = '" . $this->vbulletin->userinfo['userid'] . "'\n ORDER BY id DESC LIMIT 0," . intval($limit));
} else {
$query = $this->vbulletin->db->query("\n SELECT * FROM " . TABLE_PREFIX . "jb_firebolt_shout\n WHERE\n ( userid = '" . intval($userid) . "' && pmto = '" . intval($this->vbulletin->userinfo['userid']) . "' )\n OR\n ( userid = '" . intval($this->vbulletin->userinfo['userid']) . "' && pmto = '" . intval($userid) . "' )\n ORDER BY id DESC LIMIT 0," . intval($limit));
}
$output = '';
if ($this->usersettings['banned']) {
$notice = 'You are currently banned from the shoutbox.';
} else {
$notice = $this->vbulletin->options['jb_firebolt_notice'];
}
if (trim($notice) != null) {
$bbcode_parser = new vB_BbCodeParser($this->vbulletin, fetch_tag_list());
if (!function_exists('convert_url_to_bbcode')) {
require_once DIR . '/includes/functions_newpost.php';
}
$notice = convert_url_to_bbcode($notice);
$notice = $bbcode_parser->parse_bbcode($notice, true, false, false);
$output .= "<b>Notice:</b> " . $notice . "<br />";
}
if (!$this->usersettings['banned']) {
while ($shout = $this->vbulletin->db->fetch_array($query)) {
$bbcode_parser = new vB_BbCodeParser($this->vbulletin, fetch_tag_list());
if (!function_exists('convert_url_to_bbcode')) {
require_once DIR . '/includes/functions_newpost.php';
}
$sdate = vbdate($this->vbulletin->options['dateformat'], $shout['shouttime']);
$stime = vbdate($this->vbulletin->options['timeformat'], $shout['shouttime']);
$message = $shout['shout'];
$message = convert_url_to_bbcode($message);
$message = $bbcode_parser->parse_bbcode($message, true, false, false);
if (trim($message) == null) {
$this->vbulletin->db->query("\n DELETE FROM " . TABLE_PREFIX . "jb_firebolt_shout\n WHERE id = '" . intval($shout['id']) . "'\n ");
continue;
}
$user = fetch_userinfo($shout['userid']);
if (!$this->vbulletin->options['jb_firebolt_new_shout_layout']) {
$message = $this->stylize($message, $user['userid']);
}
if ($this->vbulletin->options['jb_firebolt_new_shout_layout']) {
$username = $user['username'];
$templater = vB_Template::create('jb_firebolt_shout_modern');
$templater->register('user', $user);
} else {
$username = fetch_musername($user);
$templater = vB_Template::create('jb_firebolt_shout');
}
$templater->register('sdate', $sdate);
$templater->register('stime', $stime);
$templater->register('username', $username);
$templater->register('message', $message);
$output .= $templater->render();
}
}
return $output;
}