本文整理汇总了PHP中bbcode::bbcode方法的典型用法代码示例。如果您正苦于以下问题:PHP bbcode::bbcode方法的具体用法?PHP bbcode::bbcode怎么用?PHP bbcode::bbcode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bbcode
的用法示例。
在下文中一共展示了bbcode::bbcode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activeutil
/**
* Constructor
*
* @param $qsf - Quicksilver Forums module
**/
function activeutil(&$qsf)
{
parent::bbcode($qsf);
$this->get =& $qsf->get;
$this->user_id = $qsf->user['user_id'];
$this->time = $qsf->time;
$this->ip = $qsf->ip;
$this->agent = $qsf->agent;
$this->self = $qsf->self;
if (isset($qsf->session['id'])) {
$this->sessionid = $qsf->session['id'];
}
}
示例2: array
/**
* prepare_for_output($topic, $key = '')
* will put together BBcodes and smilies before the output
* @param array $topic
* @access private
*/
function prepare_for_output($topic, $key = '')
{
global $config, $user, $phpbb_seo;
static $bbcode;
static $patterns;
static $replaces;
$bbcode_uid = $topic['bbcode_uid' . $key];
$bitfield = $topic['bbcode_bitfield' . $key];
$message_title = !empty($topic['post_subject' . $key]) ? $topic['post_subject' . $key] : $topic['topic_title'];
$message_title = censor_text($message_title);
$message = '<b>' . $message_title . '</b>' . "\n\n" . $topic['post_text' . $key];
if (!isset($patterns)) {
if (!empty($this->rss_config['rss_msg_filters']['pattern'])) {
$patterns = $this->rss_config['rss_msg_filters']['pattern'];
$replaces = $this->rss_config['rss_msg_filters']['replace'];
} else {
$patterns = $replaces = array();
}
}
if (!empty($patterns)) {
$message = preg_replace($patterns, $replaces, $message);
}
if ($this->rss_config['rss_sumarize'] > 0) {
$message = $this->summarize($message, $this->rss_config['rss_sumarize'], $this->rss_config['rss_sumarize_method']);
// Clean broken tag at the end of the message
$message = preg_replace('`\\<[^\\<\\>]*$`i', ' ...', $message);
// Close broken bbcode tags requiring it
$this->close_bbcode_tags($message, $bbcode_uid);
}
$message = censor_text($message);
if (!$this->rss_config['rss_nohtml']) {
if ($bitfield && $this->rss_config['rss_allow_bbcode']) {
if (!class_exists('bbcode')) {
global $phpbb_root_path, $phpEx;
require $phpbb_root_path . 'includes/bbcode.' . $phpEx;
}
if (empty($bbcode)) {
$bbcode = new bbcode($bitfield);
} else {
$bbcode->bbcode($bitfield);
}
if (!$this->rss_config['rss_allow_links']) {
$message = preg_replace("`\\[/?url(=.*)?\\]`i", "", $message);
}
$bbcode->bbcode_second_pass($message, $bbcode_uid);
}
// Parse smilies
$message = $this->smiley_text($message, !($this->rss_config['rss_allow_smilies'] && $topic['enable_smilies' . $key]));
if ($this->rss_config['rss_sumarize'] > 0) {
// last clean up
static $_find = array('`\\<\\!--[^\\<\\>]+--\\>`Ui', '`\\[\\/?[^\\]\\[]*\\]`Ui');
$message = preg_replace($_find, '', $message);
$message .= "\n\n" . '<a href="' . $topic['topic_url' . $key] . '"><b>' . $user->lang['RSS_MORE'] . ' ...</b></a>' . "\n\n";
}
} else {
$message = strip_tags(preg_replace('`\\[\\/?[^\\]\\[]*\\]`Ui', '', $message));
}
return "\n" . $message;
}
示例3: generate_text_for_display
/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true)
{
static $bbcode;
global $phpbb_dispatcher;
if ($text === '') {
return '';
}
/**
* Use this event to modify the text before it is parsed
*
* @event core.modify_text_for_display_before
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @var bool censor_text Whether or not to apply word censors
* @since 3.1.0-a1
*/
$vars = array('text', 'uid', 'bitfield', 'flags', 'censor_text');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_before', compact($vars)));
if ($censor_text) {
$text = censor_text($text);
}
// Parse bbcode if bbcode uid stored and bbcode enabled
if ($uid && $flags & OPTION_FLAG_BBCODE) {
if (!class_exists('bbcode')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
}
if (empty($bbcode)) {
$bbcode = new bbcode($bitfield);
} else {
$bbcode->bbcode($bitfield);
}
$bbcode->bbcode_second_pass($text, $uid);
}
$text = bbcode_nl2br($text);
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
/**
* Use this event to modify the text after it is parsed
*
* @event core.modify_text_for_display_after
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @since 3.1.0-a1
*/
$vars = array('text', 'uid', 'bitfield', 'flags');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_after', compact($vars)));
return $text;
}
示例4: array
function display_posts(&$master)
{
global $user, $template, $config, $phpEx, $db, $auth, $phpbb_root_path, $cache;
static $bbcode;
static $display_orders = array('first' => 't.topic_id', 'last' => 't.topic_last_post_time');
global $phpbb_seo;
// Usefull for multi bb topic & forum tracking
// Leave default for single forum eg : '_track'
$tracking_cookie_name = (defined('XLANG_AKEY') ? XLANG_AKEY : '') . '_track';
$forum_read_auth =& $master->actions['auth_view_read'];
// Specific options
$display_file =& $master->call['display_file'];
$display_user_info =& $master->call['display_user_info'];
$display_user_link = !empty($master->call['display_user_link']) ? true : false;
$display_user_link_key = $display_user_link ? 'full' : 'no_profile';
$display_link =& $master->call['display_link'];
$display_pagination =& $master->call['display_pagination'];
$display_tracking =& $master->call['display_tracking'];
$display_sig = !empty($master->call['display_sig']) ? (bool) ($config['allow_sig'] && $user->optionget('viewsigs')) : false;
$display_order = isset($display_orders[$master->call['display_order']]) ? $display_orders[$master->call['display_order']] : $display_orders['first'];
$display_post_buttons =& $master->call['display_post_buttons'];
$display_sumarize =& $master->call['display_sumarize'];
$limit_time_sql = !empty($master->call['limit_time']) ? ' AND t.topic_last_post_time > ' . ($user->time_now - $master->call['limit_time']) : '';
$order_sql = @$master->call['sort'] == 'ASC' ? ' ASC' : ' DESC';
if (!$display_tracking) {
$load_db_lastread = $load_anon_lastread = false;
} else {
$load_db_lastread = (bool) ($config['load_db_lastread'] && $user->data['is_registered']);
$load_anon_lastread = (bool) ($config['load_anon_lastread'] || $user->data['is_registered']);
}
// hanlde options
$limit = $master->call['limit'] >= 1 ? (int) $master->call['limit'] : 5;
$start =& $master->start;
if (!$display_pagination || empty($display_file)) {
$start = 0;
$display_pagination = false;
}
$total_topics = 0;
$topic_sql = $master->call['topic_sql'];
$forum_sql = $master->call['forum_sql'];
$s_global = $master->call['s_global'];
$bbcode_bitfield = '';
// Do some reset
$topic_datas = $topic_ids = $forum_ids = $user_cache = $id_cache = $post_datas = $forum_datas = array();
$forum_id = $master->call['forum_id'];
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
// Get The Data, first forums
if (!$s_global && !$master->call['single_forum'] || $master->call['single_forum'] && empty($master->forum_datas[$master->call['forum_id']])) {
$sql_array = array('SELECT' => 'f.*', 'FROM' => array(FORUMS_TABLE => 'f'), 'LEFT_JOIN' => array());
if ($load_db_lastread) {
$sql_array['SELECT'] .= ', ft.mark_time as forum_mark_time';
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id');
}
$sql_array['WHERE'] = $forum_sql ? str_replace('t.forum_id', 'f.forum_id', $forum_sql) : '';
$sql = $db->sql_build_query('SELECT', $sql_array);
unset($sql_array);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$forum_id = (int) $row['forum_id'];
$forum_datas[$forum_id] = $row;
}
$db->sql_freeresult($result);
}
// Now the topics
$sql_array = array('SELECT' => 't.*', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array());
if ($load_db_lastread) {
$sql_array['SELECT'] .= ', tt.mark_time';
$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND tt.topic_id = t.topic_id');
} elseif ($load_anon_lastread && empty($master->tracking_topics)) {
$master->tracking_topics = isset($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) ? STRIP ? stripslashes($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : $_COOKIE[$config['cookie_name'] . $tracking_cookie_name] : '';
$master->tracking_topics = $master->tracking_topics ? tracking_unserialize($master->tracking_topics) : array();
if (!$user->data['is_registered']) {
$user->data['user_lastmark'] = isset($master->tracking_topics['l']) ? (int) (base_convert($master->tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
}
}
$sql_where = ($forum_sql ? $forum_sql : '') . $limit_time_sql;
$sql_where .= $topic_sql ? ($sql_where ? ' AND ' : '') . $topic_sql : '';
$sql_where .= ($sql_where ? ' AND ' : '') . 't.topic_status <> ' . ITEM_MOVED;
if ($master->call['single_forum']) {
$sql_where .= $auth->acl_get('m_approve', $master->call['forum_id']) ? '' : ' AND t.topic_approved = 1';
} else {
// only admins and global moderators will see un-approved topics
// in the forum they have access to.
$sql_where .= $auth->acl_gets('a_') || $auth->acl_getf_global('m_') ? '' : ' AND t.topic_approved = 1';
}
// obtain correct topic count if we display pagination
if ($display_pagination) {
$sql = "SELECT COUNT(t.topic_id) AS num_topics\n\t\t\t\tFROM " . TOPICS_TABLE . " t\n\t\t\t\tWHERE {$sql_where}";
$result = $db->sql_query($sql);
$total_topics = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start > $total_topics) {
$start = $start < 0 ? 0 : floor(($total_topics - 1) / $limit) * $limit;
// Since we've reached here, $start is not set proper, kill the dupe!
$url = $display_file . $master->gym_master->html_add_start($start);
$master->gym_master->seo_kill_dupes($url);
}
}
$sql_array['WHERE'] = $sql_where;
//.........这里部分代码省略.........
示例5: generate_text_for_display
/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $uid, $bitfield, $flags)
{
static $bbcode;
if (!$text) {
return '';
}
$text = censor_text($text);
// Parse bbcode if bbcode uid stored and bbcode enabled
if ($uid && $flags & OPTION_FLAG_BBCODE) {
if (!class_exists('bbcode')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
}
if (empty($bbcode)) {
$bbcode = new bbcode($bitfield);
} else {
$bbcode->bbcode($bitfield);
}
$bbcode->bbcode_second_pass($text, $uid);
}
$text = bbcode_nl2br($text);
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
return $text;
}
示例6: generate_text_for_display
/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $uid, $bitfield)
{
global $__bbcode;
if (!$text) {
return '';
}
// Get flags... they are always allow_bbcode, allow_smilies and allow_urls
$flags = $bitfield;
if ($flags >> 3) {
$flags = bindec(substr(decbin($flags), strlen(decbin($flags >> 3))));
}
// Parse bbcode if bbcode uid stored and bbcode enabled
if ($uid && $flags & 1) {
if (!class_exists('bbcode')) {
global $phpbb_root_path, $phpEx;
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
}
if (empty($__bbcode)) {
$__bbcode = new bbcode($bitfield >> 3);
} else {
$__bbcode->bbcode($bitfield >> 3);
}
$__bbcode->bbcode_second_pass($text, $uid);
}
$text = smiley_text($text, !($flags & 2));
$text = str_replace("\n", '<br />', censor_text($text));
return $text;
}
示例7: generate_text_for_display
/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $uid, $bitfield, $flags)
{
static $bbcode;
if (!$text) {
return '';
}
// Parse bbcode if bbcode uid stored and bbcode enabled
if ($uid && $flags & OPTION_FLAG_BBCODE) {
if (!class_exists('bbcode')) {
require_once SITE_FILE_ROOT . 'includes/forums/bbcode.php';
}
if (empty($bbcode)) {
$bbcode = new bbcode($bitfield);
} else {
$bbcode->bbcode($bitfield);
}
$bbcode->bbcode_second_pass($text, $uid);
}
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
$text = str_replace("\n", '<br />', censor_text($text));
return $text;
}
示例8: array
/**
* prepare_message($message, $bbcode_uid, $bbcode_bitfield, $patterns = array(), $replaces = array())
* will put together BBcodes and smilies before the output
* @access private
*/
function prepare_message(&$message, $bbcode_uid, $bitfield, $patterns = array(), $replaces = array())
{
global $config, $user, $phpbb_root_path;
static $bbcode;
if (!empty($patterns)) {
$message = preg_replace($patterns, $replaces, $message);
}
if ($this->html_config['html_sumarize'] > 0) {
$message = $this->summarize($message, $this->html_config['html_sumarize'], $this->html_config['html_sumarize_method']);
// Clean broken tag at the end of the message
$message = preg_replace('`\\<[^\\<\\>]*$`i', ' ...', $message);
// Close broken bbcode tags requiring it, only quotes for now
$this->close_bbcode_tags($message, $bbcode_uid);
}
$message = censor_text($message);
if ($bitfield && $this->html_config['html_allow_bbcode']) {
if (!class_exists('bbcode')) {
global $phpbb_root_path, $phpEx;
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
}
if (empty($bbcode)) {
$bbcode = new bbcode($bitfield);
} else {
$bbcode->bbcode($bitfield);
}
$bbcode->bbcode_second_pass($message, $bbcode_uid);
}
$message = bbcode_nl2br($message);
// Parse smilies
$message = $this->smiley_text($message, !$this->html_config['html_allow_smilies']);
if ($this->html_config['html_sumarize'] > 0) {
// last clean up
static $_find = array('`\\<\\!--[^\\<\\>]+--\\>`Ui', '`\\[\\/?[^\\]\\[]*\\]`Ui');
$message = preg_replace($_find, '', $message);
}
return true;
}