本文整理汇总了PHP中vB_BbCodeParser::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_BbCodeParser::parse方法的具体用法?PHP vB_BbCodeParser::parse怎么用?PHP vB_BbCodeParser::parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_BbCodeParser
的用法示例。
在下文中一共展示了vB_BbCodeParser::parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_pm_bbcode
function parse_pm_bbcode($bbcode, $smilies = true)
{
global $vbulletin;
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
return $bbcode_parser->parse($bbcode, 'privatemessage', $smilies);
}
示例2: parse_usernote_bbcode
function parse_usernote_bbcode($bbcode, $smilies = true)
{
global $vbulletin;
require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
return $bbcode_parser->parse($bbcode, 'usernote', $smilies);
}
示例3: user_name_cell
} else {
print_label_row($vbphrase['rcd_pm_log_dump_from'], "<b>" . $pm['fromusername'] . " (" . $emailline . ", " . $ipline . ")</b>");
}
// show linked username only for existing users
$emailline = $vbphrase['email'] . ": " . $pm['touseremail'];
if (verify_id('user', $pm['touserid'], false)) {
print_label_row($vbphrase['rcd_pm_log_dump_to'], "<a target=\"_blank\" href=\"" . $admincpdir . "/user.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&u=" . $pm['touserid'] . "\"><b>" . $pm['tousername'] . "</b></a> (" . $emailline . ")");
} else {
print_label_row($vbphrase['rcd_pm_log_dump_to'], "<b>" . $pm['tousername'] . " (" . $emailline . ")</b>");
}
print_label_row($vbphrase['rcd_pm_log_sent_date'], vbdate($vbulletin->options['logdateformat'], $pm['dateline']));
print_label_row($vbphrase['subject'], $pm['title']);
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
// force to not allow html and images
print_description_row(html_entity_decode($bbcode_parser->parse($pm['message'], 'privatemessage')), false, 2);
/*
print_description_row( $pm['message'], true, 2 );
*/
print_table_footer(2);
}
print_cp_footer();
// ############## SOME FUNCTIONS ##########################################
function user_name_cell($user_name, $user_id = 0)
{
global $vbulletin, $usermenus, $vbphrase, $user_name_tags;
static $users;
if (empty($users) or is_array($users) and !array_key_exists($user_name, $users)) {
$users[$user_name] = verify_id('user', $user_id, false);
}
// show linked username only for existing users
示例4:
/**
* Prepare the text for display
*/
function process_text()
{
$this->bbcode->set_parse_userinfo($this->response, $this->factory->perm_cache["{$this->response['userid']}"]);
$this->response['message'] = $this->bbcode->parse(
$this->response['pagetext'],
($this->bloginfo['firstblogtextid'] == $this->response['blogtextid']) ? 'blog_entry' : 'blog_comment',
$this->response['allowsmilie'], // fix
false,
$this->response['pagetexthtml'], // fix
$this->response['hasimages'], // fix
$this->cachable
);
$this->parsed_cache =& $this->bbcode->cached;
$this->readmore = ($this->bbcode->createdsnippet);
}
示例5: process_visitor_message_preview
/**
* Parse message content for preview
*
* @param array Message and disablesmilies options
*
* @return string Eval'd html for display as the preview message
*/
function process_visitor_message_preview($message)
{
global $vbulletin, $vbphrase, $show;
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$previewhtml = '';
if ($previewmessage = $bbcode_parser->parse($message['message'], 'socialmessage', $message['disablesmilies'] ? 0 : 1)) {
$templater = vB_Template::create('visitormessage_preview');
$templater->register('errorlist', $errorlist);
$templater->register('message', $message);
$templater->register('newpost', $newpost);
$templater->register('previewmessage', $previewmessage);
$previewhtml = $templater->render();
}
return $previewhtml;
}
示例6: do_get_post
function do_get_post()
{
global $vbulletin, $db, $foruminfo, $threadinfo, $postid, $postinfo;
$vbulletin->input->clean_array_gpc('r', array('type' => TYPE_STR));
$type = 'html';
if ($vbulletin->GPC['type']) {
$type = $vbulletin->GPC['type'];
}
if (!$postinfo['postid']) {
standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']));
}
if ((!$postinfo['visible'] or $postinfo['isdeleted']) and !can_moderate($threadinfo['forumid'])) {
standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']));
}
if ((!$threadinfo['visible'] or $threadinfo['isdeleted']) and !can_moderate($threadinfo['forumid'])) {
standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink']));
}
$forumperms = fetch_permissions($threadinfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
json_error(ERR_NO_PERMISSION);
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0)) {
json_error(ERR_NO_PERMISSION);
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
$postbit_factory = new vB_Postbit_Factory();
$postbit_factory->registry =& $vbulletin;
$postbit_factory->forum =& $foruminfo;
$postbit_factory->cache = array();
$postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$post = $db->query_first_slave("\n\tSELECT\n\tpost.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,\n\t user.*, userfield.*, usertextfield.*,\n\t " . iif($foruminfo['allowicons'], 'icon.title as icontitle, icon.iconpath,') . "\n\t IF(user.displaygroupid=0, user.usergroupid, user.displaygroupid) AS displaygroupid, infractiongroupid,\n\t\t" . iif($vbulletin->options['avatarenabled'], 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight,') . "\n\t\t" . ((can_moderate($threadinfo['forumid'], 'canmoderateposts') or can_moderate($threadinfo['forumid'], 'candeleteposts')) ? 'spamlog.postid AS spamlog_postid,' : '') . "\n\t\teditlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline, editlog.reason AS edit_reason, editlog.hashistory,\n\t\tpostparsed.pagetext_html, postparsed.hasimages,\n\t\tsigparsed.signatureparsed, sigparsed.hasimages AS sighasimages,\n\t\tsigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight\n\t\t" . iif(!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehiddencustomfields']), $vbulletin->profilefield['hidden']) . "\n\t\t{$hook_query_fields}\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)\n\t\t" . iif($foruminfo['allowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)") . "\n\t\t" . iif($vbulletin->options['avatarenabled'], "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)") . "\n\t\t" . ((can_moderate($threadinfo['forumid'], 'canmoderateposts') or can_moderate($threadinfo['forumid'], 'candeleteposts')) ? "LEFT JOIN " . TABLE_PREFIX . "spamlog AS spamlog ON(spamlog.postid = post.postid)" : '') . "\n\t\tLEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON(editlog.postid = post.postid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = " . intval(STYLEID) . " AND postparsed.languageid = " . intval(LANGUAGEID) . ")\n\t\tLEFT JOIN " . TABLE_PREFIX . "sigparsed AS sigparsed ON(sigparsed.userid = user.userid AND sigparsed.styleid = " . intval(STYLEID) . " AND sigparsed.languageid = " . intval(LANGUAGEID) . ")\n\t\tLEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = post.userid)\n\t\t{$hook_query_joins}\n\t\tWHERE post.postid = {$postid}\n ");
$types = vB_Types::instance();
$contenttypeid = $types->getContentTypeID('vBForum_Post');
$attachments = $db->query_read_slave("\n\t\tSELECT\n\t\t\tfd.thumbnail_dateline, fd.filesize, IF(fd.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, fd.thumbnail_filesize,\n\t\t\ta.dateline, a.state, a.attachmentid, a.counter, a.contentid AS postid, a.filename,\n\t\t\ttype.contenttypes\n\t\tFROM " . TABLE_PREFIX . "attachment AS a\n\t\tINNER JOIN " . TABLE_PREFIX . "filedata AS fd ON (a.filedataid = fd.filedataid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "attachmenttype AS type ON (fd.extension = type.extension)\n\t\tWHERE\n\t\t\ta.contentid = {$postid}\n\t\t\t\tAND\n\t\t\ta.contenttypeid = {$contenttypeid}\n\t\tORDER BY a.attachmentid\n\t");
$fr_images = array();
while ($attachment = $db->fetch_array($attachments)) {
$lfilename = strtolower($attachment['filename']);
if (strpos($lfilename, '.jpe') !== false || strpos($lfilename, '.png') !== false || strpos($lfilename, '.gif') !== false || strpos($lfilename, '.jpg') !== false || strpos($lfilename, '.jpeg') !== false) {
$tmp = array('img' => $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid']);
if ($vbulletin->options['attachthumbs']) {
$tmp['tmb'] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'] . '&stc=1&thumb=1';
}
$fr_images[] = $tmp;
}
}
$postbits = '';
$postbit_obj =& $postbit_factory->fetch_postbit('post');
$postbit_obj->cachable = $post_cachable;
$postbits .= $postbit_obj->construct_postbit($post);
if ($type == 'html') {
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$vbulletin->templatecache['bbcode_quote'] = '
<div style=\\"margin:0px; margin-top:0px;\\">
<table cellpadding=\\"$stylevar[cellpadding]\\" cellspacing=\\"0\\" border=\\"0\\" width=\\"100%\\">
<tr>
<td class=\\"alt2\\" style=\\"border:1px solid #777777;\\">
".(($show[\'username\']) ? ("
<div>
" . construct_phrase("$vbphrase[originally_posted_by_x]", "$username") . "
</div>
<div style=\\"font-style:italic\\">$message</div>
") : ("
$message
"))."
</td>
</tr>
</table>
</div>
';
$css = <<<EOF
<style type="text/css">
body {
margin: 0;
padding: 3;
font: 13px Arial, Helvetica, sans-serif;
}
.alt2 {
background-color: #e6edf5;
font: 13px Arial, Helvetica, sans-serif;
}
html {
-webkit-text-size-adjust: none;
}
</style>
EOF;
$html = $css . $bbcode_parser->parse($post['pagetext']);
$image = '';
} else {
if ($type == 'facebook') {
$html = fetch_censored_text(strip_bbcode(strip_quotes($post['pagetext']), false, true));
if (count($fr_images)) {
$image = $fr_images[0]['img'];
}
}
}
// Figure out if we can post
$canpost = true;
if ($threadinfo['isdeleted'] or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
$canpost = false;
//.........这里部分代码省略.........
示例7: intval
$saveparsed = '';
while ($post = $db->fetch_array($posts))
{
# Only cache posts for the chosen style if this post belongs to a forum with a styleoverride
if ($vbulletin->forumcache["$post[forumid]"]['options'] & $vbulletin->bf_misc_forumoptions['styleoverride'])
{
$styleid = $vbulletin->forumcache["$post[forumid]"]['styleid'];
$vbulletin->templatecache =& $stylelist["$styleid"]['templatelist'];
// The fact that we use $userinfo here means that if you were to use any language specific stylevars in these templates (which we don't do by default), they would be of this user's language
// The only remedy for this is to create even more scenarios in the post parsed table with left -> right, right -> left and the imageoverride folder :eek:
$vbulletin->stylevars = $stylelist["$styleid"]['newstylevars'];
fetch_stylevars($stylelist["$styleid"], $vbulletin->userinfo);
$parsedtext = $bbcode_parser->parse($post['pagetext'], $post['forumid'], $post['allowsmilie'], false, '', false, true);
$saveparsed .= ", ($post[postid],
" . intval($post['lastpost']) . ",
" . intval($bbcode_parser->cached['has_images']) . ",
'" . $db->escape_string($bbcode_parser->cached['text']) . "',
" . intval($styleid) . ",
" . intval(LANGUAGEID) . "
)";
echo construct_phrase($vbphrase['processing_x'], $post['postid']) . "<br />\n";
}
else
{
echo construct_phrase($vbphrase['processing_x'], $post['postid']) . "\n";
$count = 0;
示例8: while
}
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
while ($reputation = $db->fetch_array($reputations)) {
if ($reputation['reputation'] > 0) {
$posneg = 'pos';
} else {
if ($reputation['reputation'] < 0) {
$posneg = 'neg';
} else {
$posneg = 'balance';
}
}
$reputation['timeline'] = vbdate($vbulletin->options['timeformat'], $reputation['dateline']);
$reputation['dateline'] = vbdate($vbulletin->options['dateformat'], $reputation['dateline']);
$reputation['reason'] = $bbcode_parser->parse($reputation['reason']);
$threadinfo = array('threadid' => $reputation['threadid'], 'title' => $reputation['title']);
if (vbstrlen($reputation['title']) > 25) {
$reputation['title'] = fetch_trimmed_title($reputation['title'], 24);
}
($hook = vBulletinHook::fetch_hook('usercp_reputationbit')) ? eval($hook) : false;
$pageinfo = array('p' => $reputation['postid']);
$templater = vB_Template::create('usercp_reputationbits');
$templater->register('pageinfo', $pageinfo);
$templater->register('posneg', $posneg);
$templater->register('reputation', $reputation);
$templater->register('reputationbgclass', $reputationbgclass);
$templater->register('threadinfo', $threadinfo);
$reputationcommentbits .= $templater->render();
$show['reputation'] = true;
}
示例9: fr_parse_pm_bbcode
function fr_parse_pm_bbcode($bbcode, $smilies = true)
{
require_once DIR . '/includes/class_core.php';
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser(vB::get_registry(), fetch_tag_list());
return $bbcode_parser->parse($bbcode, 'privatemessage', $smilies);
}
示例10: fr_post_to_bbcode
function fr_post_to_bbcode($node)
{
require_once DIR . '/includes/class_core.php';
require_once DIR . '/includes/class_bbcode.php';
$post = array();
$bbcode_parser = new vB_BbCodeParser(vB::get_registry(), fetch_tag_list());
$post['signature'] = '';
if (!empty($node['content']['signature']['raw'])) {
$bbcode_parser->set_parse_userinfo($node['content']['userinfo']);
$post['signature'] = $bbcode_parser->parse($node['content']['signature']['raw'], 'signature', true, false, '', $node['content']['signaturepic'], true);
$sig = trim(remove_bbcode(strip_tags($post['signature']), true, true), '<a>');
$sig = str_replace(array("\t", "\r"), array('', ''), $sig);
$sig = str_replace("\n\n", "\n", $sig);
$post['signature'] = $sig;
}
list($text, , $images) = parse_post($node['content']['rawtext']);
$post['html'] = $text;
$post['images'] = $images;
return $post;
}
示例11:
/**
* Prepare the text for display
*/
function process_text()
{
$this->note['message'] = $this->bbcode->parse($this->note['pagetext'], 'pt');
}
示例12:
/**
* Prepares the User's Signature
*
*/
function prepare_signature()
{
global $show;
if ($this->userinfo['signature'] and $this->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canusesignature']) {
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($this->registry, fetch_tag_list());
$bbcode_parser->set_parse_userinfo($this->userinfo, $this->userinfo['permissions']);
$this->prepared['signature'] = $bbcode_parser->parse($this->userinfo['signature'], 'signature');
}
}
示例13: parse_calendar_bbcode
function parse_calendar_bbcode($bbcode, $smilies = true)
{
global $calendarinfo, $vbulletin;
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$bbcode = $bbcode_parser->parse($bbcode, 'calendar', $smilies);
return $bbcode;
}
示例14:
/**
* Prepare the text for display
*/
function process_text()
{
global $vbphrase;
$this->bbcode->attachments =& $this->attachments;
$this->bbcode->unsetattach = true;
$this->bbcode->set_parse_userinfo($this->blog, $this->factory->perm_cache["{$this->blog['userid']}"]);
$this->bbcode->containerid = $this->blog['blogid'];
$this->blog['message'] = $this->bbcode->parse(
$this->blog['pagetext'],
'blog_entry',
$this->blog['allowsmilie'],
false,
$this->blog['pagetexthtml'], // fix
$this->blog['hasimages'], // fix
$this->cachable,
$this->blog['htmlstate']
);
if ($this->bbcode->createdsnippet !== true)
{
$this->parsed_cache =& $this->bbcode->cached;
}
$this->readmore = ($this->bbcode->createdsnippet);
}
示例15: array
/**
* Prepare any data needed for the output
*
* @param string The id of the block
* @param array Options specific to the block
*/
function prepare_output($id = '', $options = array())
{
global $show, $vbphrase, $vbulletin, $userperms, $permissions;
if ($vbulletin->options['reputationenable'] and ($this->profile->userinfo['showreputation'] or !($userperms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canhiderep']))) {
$reputations = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT user.username, reputation.whoadded, reputation.postid, thread.title, thread.forumid, post.threadid,\n\t\t\t\treputation.reputation, reputation.reason, reputation.dateline, thread.postuserid, reputation.reputationid\n\t\t\t\tFROM " . TABLE_PREFIX . "reputation AS reputation\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post USING (postid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = reputation.whoadded)\n\t\t\t\tWHERE reputation.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\tAND thread.visible = 1 AND post.visible = 1\n\t\t\t\tORDER BY reputation.dateline DESC\n\t\t\t");
$this->block_data['reputation'] = array();
if ($vbulletin->userinfo['userid'] == $this->profile->userinfo['userid']) {
$options['showraters'] = true;
}
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
while ($reputation = $vbulletin->db->fetch_array($reputations) and $this->count < $options['comments']) {
$forumperms = fetch_permissions($reputation['forumid']);
if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'] or $reputation['postuserid'] == $vbulletin->userinfo['userid'])) {
$this->count++;
if ($reputation['reputation'] > 0) {
$reputation['posneg'] = 'pos';
} else {
if ($reputation['reputation'] < 0) {
$reputation['posneg'] = 'neg';
} else {
$reputation['posneg'] = 'balance';
}
}
$reputation['postinfo'] = array('p' => $reputation['postid']);
$reputation['threadinfo'] = array('title' => $reputation['title'], 'threadid' => $reputation['threadid']);
$reputation['timestamp'] = $reputation['dateline'];
$reputation['showraters'] = $options['showraters'];
$reputation['timeline'] = vbdate($vbulletin->options['timeformat'], $reputation['dateline']);
$reputation['dateline'] = vbdate($vbulletin->options['dateformat'], $reputation['dateline']);
$reputation['reason'] = $bbcode_parser->parse($reputation['reason']);
$reputation['username'] = $reputation['username'] ? $reputation['username'] : $vbphrase['n_a'];
if (empty($reputation['reason'])) {
$reputation['reason'] = $vbphrase['no_comment'];
}
($hook = vBulletinHook::fetch_hook('member_profileblock_reputationbit')) ? eval($hook) : false;
$this->block_data['reputation'][] = $reputation;
}
}
}
}