本文整理匯總了PHP中vB_BbCodeParser::get_preview方法的典型用法代碼示例。如果您正苦於以下問題:PHP vB_BbCodeParser::get_preview方法的具體用法?PHP vB_BbCodeParser::get_preview怎麽用?PHP vB_BbCodeParser::get_preview使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vB_BbCodeParser
的用法示例。
在下文中一共展示了vB_BbCodeParser::get_preview方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPosts
//.........這裏部分代碼省略.........
}
$forumids = array_keys(vB::$vbulletin->forumcache);
foreach ($forumids AS $forumid)
{
$forumperms =& vB::$vbulletin->userinfo['forumpermissions']["$forumid"];
if ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canview']
AND ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewothers'])
AND (($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads']))
AND verify_forum_password($forumid, vB::$vbulletin->forumcache["$forumid"]['password'], false)
)
{
//Don't include the comments forum.
if (vB::$vbulletin->options['vbcmsforumid'] AND (intval(vB::$vbulletin->options['vbcmsforumid']) == intval($forumid)))
{
continue;
}
//Or, if the user selected forums, anything not on the list.
else if (! empty($this->config['forumchoice']) AND !in_array($forumid, $this->config['forumchoice']))
{
continue;
}
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice) )
{
$forumsql = " AND (" . (empty($subscribejoin) ? '' : "subscribeforum.forumid IS NOT NULL OR ") . " thread.forumid IN(" . implode(',', $forumchoice) . ")";
$associatedthread = (vB::$vbulletin->options['vbcmsforumid'] ?
" AND (thread.forumid <> " . vB::$vbulletin->options['vbcmsforumid'] . ") )" : '');
}
else if (! empty($subscribejoin))
{
$forumsql = " AND subscribeforum.forumid IS NOT NULL ";
}
else
{
return $postarray;
}
$posts = vB::$vbulletin->db->query_read_slave($sql = "
SELECT post.dateline, post.pagetext, post.allowsmilie, post.postid,
thread.threadid, thread.title, thread.prefixid, post.attach, thread.replycount,
forum.forumid, post.title AS posttitle, post.dateline AS postdateline,
user.userid, user.username
" . (vB::$vbulletin->options['avatarenabled'] ? ",avatar.avatarpath,
(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,
customavatar.width AS avwidth,customavatar.height AS avheight" : "") .
" FROM " . TABLE_PREFIX . "post AS post
JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)
JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
" . (vB::$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)" : "") . "
$subscribejoin
WHERE 1=1
$forumsql
$associatedthread
AND thread.visible = 1
AND post.visible = 1
AND thread.open <> 10
AND post.dateline > $datecut
$globalignore
" . ($this->userinfo['ignorelist'] ? "AND post.userid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")": '') . "
ORDER BY post.dateline DESC
LIMIT 0," . intval($this->config['count']) . "
");
$parser = new vB_BbCodeParser(vB::$vbulletin, fetch_tag_list());
$optionval = vB::$vbulletin->bf_misc_forumoptions['allowhtml'];
while ($post = vB::$vbulletin->db->fetch_array($posts))
{
$post['title'] = fetch_trimmed_title($post['title'], $this->config['newposts_titlemaxchars']);
$allow_html = ((vB::$vbulletin->forumcache[$post['forumid']]['options'] & $optionval) AND $this->config['allow_html'] ? 1 : 0);
$post['previewtext'] = fetch_censored_text($parser->get_preview($post['pagetext'], $this->default_previewlen, $allow_html));
$post['pagetext'] = fetch_censored_text($parser->do_parse($post['pagetext'], $allow_html));
$post['url'] = fetch_seo_url('thread', $post, array('p' => $post['postid'])) . '#post' . $post['postid'];
$post['newposturl'] = fetch_seo_url('thread', $post, array('goto' => 'newpost'));
$post['date'] = vbdate(vB::$vbulletin->options['dateformat'], $post['dateline'], true);
$post['time'] = vbdate(vB::$vbulletin->options['timeformat'], $post['dateline']);
if (intval($post['userid']) AND vB::$vbulletin->options['avatarenabled'])
{
$avatar = fetch_avatar_from_record($post);
}
else
{
$avatar = false;
}
$post['avatarurl'] = isset($avatar[0]) ? $avatar[0] : false;
unset($avatar);
$postarray[$post['postid']] = $post;
}
return $postarray;
}
示例2: getThreads
//.........這裏部分代碼省略.........
else if (! empty($this->config['forumchoice']) AND !in_array($forumid, $this->config['forumchoice']))
{
continue;
}
$forumchoice[] = $forumid;
}
}
$threadarray = array();
if (!empty($forumchoice) )
{
$forumsql = " AND (" . (empty($subscribejoin) ? '' : "subscribeforum.forumid IS NOT NULL OR ") .
" thread.forumid IN(" . implode(',', $forumchoice) . ")";
$associatedthread = (vB::$vbulletin->options['vbcmsforumid'] ?
" AND (thread.forumid <> " . vB::$vbulletin->options['vbcmsforumid'] . ") )" : '');
}
else if (! empty($subscribejoin))
{
$forumsql = " AND subscribeforum.forumid IS NOT NULL ";
}
else
{
return $threadarray;
}
// remove threads from users on the global ignore list if user is not a moderator
$globalignore = '';
if (trim(vB::$vbulletin->options['globalignore']) != '')
{
require_once(DIR . '/includes/functions_bigthree.php');
if ($Coventry = fetch_coventry('string'))
{
$globalignore = "AND thread.postuserid NOT IN ($Coventry) ";
}
}
// query last threads from visible / chosen forums
$threads = vB::$vbulletin->db->query_read_slave($sql = "
SELECT thread.threadid, thread.title, thread.prefixid, post.attach, post.userid AS postuserid, post.username AS postusername,
thread.postusername, thread.dateline, thread.lastpostid, thread.lastpost, thread.lastposterid, thread.lastposter, thread.replycount,
forum.forumid, forum.title_clean as forumtitle,
post.pagetext AS message, post.allowsmilie, post.postid,
user.userid, user.username, thread.lastposter AS lastpostername
" . (vB::$vbulletin->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight" : "") . "
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (thread.postuserid = user.userid)
" . (vB::$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)" : "") . "
$subscribejoin
WHERE 1=1
$forumsql
AND thread.visible = 1
AND post.visible = 1
AND open <> 10
$datecutoffsql
$globalignore
$associatedthread
" . ($this->userinfo['ignorelist'] ? "AND thread.postuserid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")": '') . "
ORDER BY $ordersql
LIMIT 0," . intval($this->config['count']) . "
");
require_once(DIR . '/includes/class_bbcode.php');
$parser = new vB_BbCodeParser(vB::$vbulletin, fetch_tag_list());
$optionval = vB::$vbulletin->bf_misc_forumoptions['allowhtml'];
while ($thread = vB::$vbulletin->db->fetch_array($threads))
{
$thread['title'] = fetch_trimmed_title($thread['title'], $this->config['threads_titlemaxchars']);
$thread['url'] = fetch_seo_url('thread', $thread);
$thread['newposturl'] = fetch_seo_url('thread', $thread, array('goto' => 'newpost'));
$thread['lastposturl'] = fetch_seo_url('thread', $thread, array('p' => $thread['lastpostid'])) . '#post' . $thread['lastpostid'];
$thread['date'] = vbdate(vB::$vbulletin->options['dateformat'], $thread['dateline'], true);
$thread['time'] = vbdate(vB::$vbulletin->options['timeformat'], $thread['dateline']);
$thread['lastpostdate'] = vbdate(vB::$vbulletin->options['dateformat'], $thread['lastpost'], true);
$thread['lastposttime'] = vbdate(vB::$vbulletin->options['timeformat'], $thread['lastpost']);
$forumid = $thread['forumid'];
$allow_html = ((vB::$vbulletin->forumcache[$forumid]['options'] & $optionval) AND $this->config['allow_html'] ? 1 : 0);
$thread['previewtext'] = fetch_censored_text($parser->get_preview($thread['message'], $this->default_previewlen, $allow_html));
$thread['pagetext'] = fetch_censored_text($parser->do_parse($thread['message'], $allow_html));
// get avatar
if (intval($thread['userid']) AND vB::$vbulletin->options['avatarenabled'])
{
$avatar = fetch_avatar_from_record($thread);
}
if (!isset($avatar))
{
$avatar = false;
}
$thread['avatarurl'] = isset($avatar[0]) ?$avatar[0] : false;
unset($avatar);
$threadarray[$thread['threadid']] = $thread;
}
return $threadarray;
}