当前位置: 首页>>代码示例>>PHP>>正文


PHP vB_BbCodeParser::parse_bbcode方法代码示例

本文整理汇总了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;
		}
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:54,代码来源:html.php

示例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;
 }
开发者ID:Tustin,项目名称:firebolt,代码行数:58,代码来源:class_firebolt.php


注:本文中的vB_BbCodeParser::parse_bbcode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。