本文整理汇总了PHP中parse_bbcode函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_bbcode函数的具体用法?PHP parse_bbcode怎么用?PHP parse_bbcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_bbcode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_news
function get_news($db)
{
$sql = "SELECT t.topic_id, topic_poster, p.post_text, u.username, u.user_email, t.topic_time, t.topic_posts_approved, t.topic_title, t.forum_id\n" . "FROM phpbb3_topics AS t, phpbb3_users AS u, phpbb3_posts AS p\n" . "WHERE(t.forum_id = 2 or t.forum_id = 38) AND t.topic_poster = u.user_id AND t.topic_id = p.topic_id AND t.topic_time = p.post_time\n" . "ORDER BY t.topic_time DESC\n" . "LIMIT 5";
$res = mysqli_query($db, $sql);
$newstemplate = file_get_contents('templates/newsitem.html');
$news = "";
$newskeys = array('#HEADLINE#', '#BODY#', '#POSTER#', '#POSTDATE#');
while ($row = mysqli_fetch_array($res)) {
if ($row['forum_id'] == 38) {
if (preg_match('/^\\[(game|map|engine|website|misc)\\] (.*)$/', $row['topic_title'], $arr) === FALSE) {
continue;
}
if (sizeof($arr) == 0) {
continue;
}
$title = $arr[1] . ": " . htmlspecialchars_decode($arr[2]);
} else {
$title = $row['topic_title'];
}
$postlink = '/phpbb/viewtopic.php?t=' . $row['topic_id'];
$title = makelink($postlink, $title);
$newstext = link_replace(parse_bbcode($row['post_text']));
$poster = $row['username'];
$postdate = date("Y-m-d H:i", $row['topic_time']);
$newsdata = array($title, $newstext, $poster, $postdate);
$news .= str_replace($newskeys, $newsdata, $newstemplate);
}
return $news;
}
示例2: get_news
function get_news()
{
$sql = "SELECT t.topic_id, topic_poster, p.post_text, u.username, u.user_email, t.topic_time, t.topic_posts_approved, t.topic_title, t.forum_id\n" . "FROM phpbb3_topics AS t, phpbb3_users AS u, phpbb3_posts AS p\n" . "WHERE(t.forum_id = 2 or t.forum_id = 38) AND t.topic_poster = u.user_id AND t.topic_id = p.topic_id AND t.topic_time = p.post_time\n" . "ORDER BY t.topic_time DESC\n" . "LIMIT 10";
$res = mysqli_query($sql);
$newstemplate = file_get_contents('templates/newsitem.html');
$news = "";
$newskeys = array('#HEADLINE#', '#BODY#', '#POSTER#', '#POSTDATE#', '#COMMENTS#');
$i = 0;
while ($row = mysqli_fetch_array($res)) {
if ($row['forum_id'] == 38) {
if (preg_match('/^\\[(game|map|engine|website|misc)\\] (.*)$/', $row['topic_title'], $arr) === FALSE) {
continue;
}
if (sizeof($arr) == 0) {
continue;
}
$title = $arr[1] . ": " . htmlspecialchars_decode($arr[2]);
} else {
$title = $row['topic_title'];
}
$newstext = link_replace(parse_bbcode($row['post_text']));
$poster = '<a href="/phpbb/memberlist.php?mode=viewprofile&u=' . $row['topic_poster'] . '">' . $row['username'] . '</a>';
$postdate = date("Y-m-d H:i", $row['topic_time']);
$comments = '<a href="/phpbb/viewtopic.php?t=' . $row['topic_id'] . '">' . $row['topic_posts_approved'] . ' comments</a>.';
$newsdata = array($title, $newstext, $poster, $postdate, $comments);
$news .= str_replace($newskeys, $newsdata, $newstemplate);
$i++;
if ($i >= 5) {
break;
}
}
return $news;
}
示例3: post
public function post($year = NULL, $month = NULL, $day = NULL, $url_title = NULL)
{
$this->load->module_model('blog', 'comments_model', 'comments');
$this->load->module_model('blog', 'users_model', 'users');
if ($data['post'] = $this->blog->get_post_by_url($year, $month, $day, $url_title)) {
$data['post']['url'] = post_url($data['post']['url_title'], $data['post']['date_posted']);
$data['post']['display_name'] = $this->users->get_user_display_name($data['post']['author']);
if ($data['post']['allow_comments'] == 1) {
$this->comment($data['post']['id'], $data['post']['url']);
}
$data['comments'] = $this->comments->get_comments($data['post']['id']);
if ($data['comments'] != "") {
foreach ($data['comments'] as $key => $comment) {
$data['comments'][$key]['content'] = parse_bbcode(nl2br(parse_smileys($comment['content'], base_url() . 'application/views/admin/static/javascript/tiny_mce/plugins/emotions/img/')));
if ($comment['user_id'] != "") {
$website = $this->users->get_user_website($comment['user_id']);
$display_name = $this->users->get_user_display_name($comment['user_id']);
$data['comments'][$key]['author'] = '<a href="' . prep_url($website) . '" target="_blank">' . $display_name . '</a>';
} else {
if ($comment['author_website'] != "") {
$data['comments'][$key]['author'] = '<a href="' . prep_url($comment['author_website']) . '" target="_blank">' . $comment['author'] . '</a>';
}
}
}
}
$this->_template['page'] = 'blog/single_post';
} else {
$this->_template['page'] = 'errors/404';
}
$this->system_library->load($this->_template['page'], $data);
}
示例4: notify_reply
public function notify_reply($recipients, $reply)
{
$this->CI->load->library('email');
$this->CI->load->helper('url');
foreach ($recipients as $person) {
// No need to email the user that entered the reply
if ($person->email == $this->CI->user->email) {
continue;
}
$text_body = 'View the reply here: ' . anchor('forums/posts/view_reply/' . $reply->id) . '<br /><br />';
$text_body .= '<strong>Message:</strong><br />';
$text_body .= parse_bbcode($reply->content);
$this->CI->email->clear();
$this->CI->email->from($this->CI->settings->item('server_email'), $this->CI->config->item('forums_title'));
$this->CI->email->to($person->email);
$this->CI->email->subject('Subscription Notification: ' . $reply->title);
$text_body = 'Reply to <strong>"' . $reply->title . '"</strong>.<br /><br />' . $text_body;
$text_body .= "<br /><br />Click here to unsubscribe from this topic: " . anchor('forums/unsubscribe/' . $person->id . '/' . $reply->topic_id);
$this->CI->email->message($text_body);
$this->CI->email->send();
}
}
示例5: get_news
function get_news()
{
$sql = "";
$sql .= "SELECT t.topic_id, topic_poster, p.post_text, u.username, u.user_email, t.topic_time, t.topic_replies, t.topic_title ";
$sql .= "FROM phpbb3_topics AS t, phpbb3_users AS u, phpbb3_posts AS p ";
$sql .= "WHERE t.forum_id = 2 AND t.topic_poster = u.user_id AND t.topic_id = p.topic_id AND t.topic_time = p.post_time ";
$sql .= "ORDER BY t.topic_time DESC ";
$sql .= "LIMIT 3";
$res = mysql_query($sql);
$newstemplate = file_get_contents('templates/newsitem.html');
$news = "";
$newskeys = array('#HEADLINE#', '#BODY#', '#POSTER#', '#POSTDATE#', '#COMMENTS#');
while ($row = mysql_fetch_array($res)) {
$newstext = parse_bbcode($row['post_text']);
$poster = '<a href="/phpbb/memberlist.php?mode=viewprofile&u=' . $row['topic_poster'] . '">' . $row['username'] . '</a>';
$postdate = date("Y-m-d H:i", $row['topic_time']);
$comments = '<a href="/phpbb/viewtopic.php?t=' . $row['topic_id'] . '">' . $row['topic_replies'] . ' comments</a>.';
$newsdata = array($row['topic_title'], $newstext, $poster, $postdate, $comments);
$news .= str_replace($newskeys, $newsdata, $newstemplate);
}
return $news;
}
示例6: topic_reply
/**
* Topic Reply
*
* Post a reply to a topic
*
* @access public
* @param int
* @return json
*/
public function topic_reply($topic_id = 0)
{
if (!$this->session->userdata('user_id')) {
redirect('signin');
}
if (is_numeric($topic_id)) {
$topic_data = $this->forum_engine->get_topic_data($topic_id);
} else {
show_error('The topic id must be a valid number!');
}
$this->load->helper('forum');
$this->load->library('form_validation');
$this->load->model('user_engine');
$this->form_validation->set_rules('message', 'Message', 'required|xss_clean|addslashes');
if ($topic_data == FALSE) {
show_404('forum');
} elseif ($topic_data['staff'] == 1) {
if ($this->session->userdata('user_level') == 'user' || !$this->system->is_staff()) {
$this->system->yield('error', lang('header_staff_only'), lang('staff_only_error'));
return;
}
} elseif ($topic_data['topic_status'] == 'locked') {
$this->system->yield('error', 'Topic locked!', 'Replies cannot be made to locked topics.');
return;
}
if ($this->form_validation->run() == TRUE) {
$message = htmlspecialchars($this->input->post('message'));
if ($message == $this->cache->get('old_message_topic:' . $this->system->userdata['user_id'])) {
if ($topic_data['total_posts'] > 11) {
show_error('You cannot post the same thing twice in a row!');
}
}
$this->cache->save('old_message_topic:' . $this->system->userdata['user_id'], $message, 60);
$last_id = $this->forum_engine->create_post($message, $topic_data, $this->system->userdata['user_id']);
if ($topic_data['palladium_enabled'] == 1) {
$palladium = parse_earned_palladium($message);
$this->user_engine->add('user_palladium', $palladium);
// This is for events only
// $this->db->set('special_currency', '(special_currency+1)', FALSE)->where('user_id', $this->system->userdata['user_id'])->update('users');
} elseif ($topic_data['forum_id'] == 32) {
$this->user_engine->add('user_palladium', 1);
} else {
$palladium = 0;
}
$this->cache->save('topic_total_posts' . $topic_id, $topic_data['total_posts'] + 1, 2400);
$page_id = get_topic_page($topic_data['total_posts']);
$full_replies = array();
preg_match_all('/@([A-Za-z0-9\\s]+):\\s((\\w+\\s){0,}\\w+.)/', $message, $replies);
if (isset($replies[0]) && count($replies[0]) > 0) {
foreach ($replies[0] as $key => $reply) {
$full_replies[strtolower($replies[1][$key])] = $replies[2][$key];
}
$reply_users = $this->db->select('user_id, username')->where_in('username', array_keys($full_replies))->limit(count($full_replies))->get('users');
foreach ($reply_users->result_array() as $user) {
$string = $full_replies[strtolower($user['username'])];
$reply = strlen($string) > 18 ? substr($string, 0, 18) . '...' : $string;
$this->notification->broadcast(array('receiver' => $user['username'], 'receiver_id' => $user['user_id'], 'notification_text' => $this->system->userdata['username'] . ' mentioned you: ' . $reply, 'attachment_id' => $last_id, 'attatchment_type' => 'mention', 'attatchment_url' => '/topic/view/' . $topic_id . '/' . $page_id . '#' . $last_id), FALSE);
}
}
if ($this->input->is_ajax_request() == TRUE) {
$json['post_html'] = $this->load->view('forum/partials/post_template', array('post' => array('post_body' => parse_bbcode(stripslashes(nl2br($this->input->post('message')))), 'user_signature' => parse_bbcode(stripslashes(nl2br($this->system->userdata['user_signature']))), 'username' => $this->system->userdata['username'], 'post_id' => $last_id, 'user_id' => $this->system->userdata['user_id'], 'last_action' => time(), 'donated' => $this->system->userdata['donated'], 'user_level' => $this->system->userdata['user_level'], 'post_time' => date("Y-m-d H:i:s", time()))), TRUE);
$this->output->set_content_type('application/json')->set_output(json_encode($json, JSON_NUMERIC_CHECK));
} else {
redirect('topic/view/' . $topic_id . '/' . $page_id . '#footer');
}
}
}
示例7: mysql_query
include_once 'includes/db.php';
include_once 'includes/bbcode.php';
include_once 'includes/thumbs.php';
// Prepare newsitems
$sql = "";
$sql .= "SELECT t.topic_id, topic_poster, p.post_text, u.username, u.user_email, t.topic_time, t.topic_replies, t.topic_title ";
$sql .= "FROM phpbb3_topics AS t, phpbb3_users AS u, phpbb3_posts AS p ";
$sql .= "WHERE t.forum_id = 2 AND t.topic_poster = u.user_id AND t.topic_id = p.topic_id AND t.topic_time = p.post_time ";
$sql .= "ORDER BY t.topic_time DESC ";
$sql .= "LIMIT 3";
$res = mysql_query($sql);
$newstemplate = file_get_contents('templates/newsitem.html');
$news = "";
$newskeys = array('#HEADLINE#', '#BODY#', '#POSTER#', '#POSTDATE#', '#COMMENTS#');
while ($row = mysql_fetch_array($res)) {
$newstext = parse_bbcode($row['post_text']);
$poster = '<a href="http://spring.clan-sy.com/">' . $row['username'] . '</a>';
$postdate = date("Y-m-d H:i", $row['topic_time']);
$comments = '<a href="/phpbb/viewtopic.php?t=' . $row['topic_id'] . '">' . $row['topic_replies'] . ' comments</a>.';
$newsdata = array($row['topic_title'], $newstext, $poster, $postdate, $comments);
$news .= str_replace($newskeys, $newsdata, $newstemplate);
}
// Get a random welcome image
$sql = '';
$sql .= 'select a.attach_id ';
$sql .= 'from phpbb3_attachments as a, phpbb3_topics as t ';
$sql .= "where t.forum_id = 33 and a.topic_id = t.topic_id ";
$sql .= "and (extension = 'gif' or extension = 'jpg' or extension = 'jpeg' or extension = 'png')";
$sql .= 'order by rand() limit 1';
$res = mysql_query($sql);
$row = mysql_fetch_array($res);
示例8: post_html_clean
function post_html_clean($str)
{
global $phpbb_root_path, $phpbb_home, $mobiquo_config;
$search = array("/<a .*?href=\"(.*?)\".*?>(.*?)<\\/a>/si", "/<img .*?src=\"(.*?)\".*?\\/?>/sei", "/<br\\s*\\/?>|<\\/cite>/si", "/<object .*?data=\"(http:\\/\\/www\\.youtube\\.com\\/.*?)\" .*?>.*?<\\/object>/si", "/<object .*?data=\"(http:\\/\\/video\\.google\\.com\\/.*?)\" .*?>.*?<\\/object>/si");
$replace = array('[url=$1]$2[/url]', "'[img]'.url_encode('\$1').'[/img]'", "\n", '[url=$1]YouTube Video[/url]', '[url=$1]Google Video[/url]');
$str = preg_replace('/\\n|\\r/si', '', $str);
// remove smile
$str = preg_replace('/<img [^>]*?src=\\"[^"]*?images\\/smilies\\/[^"]*?\\"[^>]*?alt=\\"([^"]*?)\\"[^>]*?\\/?>/', '$1', $str);
$str = preg_replace('/<img [^>]*?alt=\\"([^"]*?)\\"[^>]*?src=\\"[^"]*?images\\/smilies\\/[^"]*?\\"[^>]*?\\/?>/', '$1', $str);
$str = preg_replace('/<null.*?\\/>/', '', $str);
$str = preg_replace($search, $replace, $str);
$str = strip_tags($str);
$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
// change relative path to absolute URL
$str = preg_replace('/\\[img\\]\\.\\.\\/(.*?)\\[\\/img\\]/si', "[img]{$phpbb_home}/\$1[/img]", $str);
$str = preg_replace('#\\[img\\]' . addslashes($phpbb_root_path) . '(.*?)\\[/img\\]#si', "[img]{$phpbb_home}\$1[/img]", $str);
// remove link on img
$str = preg_replace('/\\[url=[^\\]]*?\\]\\s*(\\[img\\].*?\\[\\/img\\])\\s*\\[\\/url\\]/si', '$1', $str);
// cut quote content to 100 charactors
if ($mobiquo_config['shorten_quote']) {
$str = cut_quote($str, 100);
}
return parse_bbcode($str);
}
示例9: peopleGetBusinessStuff
function peopleGetBusinessStuff($id, $username)
{
_filter_var($id);
_filter_var($username);
global $group_name;
global $access_isAuthenticated;
global $PagePeople_hasview;
global $PagePeople_noview;
$c_content = '<splitme>';
$p = new PeoplePage($group_name);
$c = $p->getBusinessStuff($id);
_filter_res_var($c);
$c_content .= "<input type=\"hidden\" id=\"businessstuff_stripped_content\" value=\"{$c}\">\n";
if (!empty($c)) {
parse_bbcode($c);
// var passes by reference
$c_content .= $c;
$c_content .= "<br />\n";
} else {
$c_content .= "<nodata>";
}
$canShowBusinessStuff = $p->canShowBusinessStuff($username);
if ($canShowBusinessStuff) {
return $PagePeople_hasview . $c_content;
} else {
return $PagePeople_noview . $c_content;
}
}
示例10: __
}
?>
</ul>
<?php
$activities = BaseDocument::convertStringToArray($item['activities']);
if (!array_intersect(array(1, 2, 5), $activities)) {
$conditions_levels = NULL;
}
echo '<div class="col_left col_66">';
if (!empty($conditions) || !empty($conditions_levels)) {
echo '<div class="section_subtitle htext" id="_conditions">' . __('conditions') . '</div><div class="field_value">';
$conditions_levels = $item['conditions_levels'];
if (!empty($conditions_levels) && count($conditions_levels)) {
conditions_levels_data($conditions_levels);
}
echo parse_links(parse_bbcode($conditions, null, false));
echo $other_conditions;
echo '</div>';
if ($needs_translation) {
echo '</div>';
}
}
echo '</div>';
echo '<div class="col_right col_33">';
echo _format_text_data('weather', $item['weather'], null, array('show_images' => false));
echo _format_text_data('timing', $item['timing'], null, array('show_images' => false));
echo '</div>';
echo '<div class="col_left col_66">';
echo _format_text_data('access_comments', $item['access_comments'], null, array('show_images' => false));
echo '</div>';
echo '<div class="col_left col_66">';
示例11: parse_bbcode
</li>
<li id="dislikes"><strong>Dislikes:</strong> <?php
echo $profile_data['dislikes'];
?>
</li>
<li id="hobbies"><strong>Hobbies:</strong><?php
echo $profile_data['hobbies'];
?>
</li>
</ul>
</div>
<div id="content">
<div id="bio">
<h2>About me</h2>
<?php
echo parse_bbcode(stripslashes(nl2br($profile_data['profile_bio'])));
?>
</div>
<div id="friendlist">
<h2>My Friends</h2>
<?php
foreach ($friends as $friend) {
?>
<div id="friend_container">
<a href="/user/<?php
echo urlencode($friend['username']);
?>
">
<img src="/images/avatars/<?php
echo $friend['user_id'];
?>
示例12: _format_text_data
function _format_text_data($name, $value, $label = NULL, $options = array())
{
use_helper('sfBBCode', 'SmartFormat');
if (empty($label)) {
$label = $name;
}
$has_value = !empty($value);
$needs_translation = _option($options, 'needs_translation', false);
$inserted = _option($options, 'inserted_text', '');
$images = _option($options, 'images', null);
$filter_image_type = _option($options, 'filter_image_type', true);
$show_label = _option($options, 'show_label', true);
$show_images = _option($options, 'show_images', true);
$class = _option($options, 'class', '');
$label_id = _option($options, 'label_id', $name);
if (!empty($class)) {
$class = ' ' . $class;
}
if ($show_label) {
$label = content_tag('div', __($label), array('class' => 'section_subtitle htext', 'id' => '_' . $label_id, 'data-tooltip' => '')) . "\n";
} else {
$label = '';
}
$out = $label . $inserted;
if ($has_value) {
$lang = $needs_translation ? ' lang="' . $needs_translation . '"' : '';
$out .= '<div class="field_value"' . $lang . '>' . parse_links(parse_bbcode($value, $images, $filter_image_type, $show_images)) . '</div>';
}
return $out;
}
示例13: date
<p>
Joined Date:
<?php
echo date("m.d.y", $post->author->created_on);
?>
</p>
<p>
Posts:
<?php
echo $post->author->post_count;
?>
</p>
</td>
<td colspan="2" valign="top"><?php
echo parse_bbcode(htmlentities($post->content), 0, TRUE);
?>
</td>
</tr>
<tr class="postlinks">
<td>
<!--<?php
if (isset($user->id)) {
?>
[ <?php
echo anchor('messages/create/' . $post->author->id, 'Message');
?>
]
<?php
}
示例14: anchor
<?php
echo anchor('user/' . urlencode($post['username']), 'View Profile');
?>
<?php
echo user_online($post['last_action']);
?>
</span>
</div>
<div class="post-content">
<span class="post_author">
<a href="#message" class="reply_at" title="@<?php
echo $post['username'];
?>
:"><?php
echo $post['username'];
?>
</a> said:
</span>
<?php
echo display_ribbons($post, $this->system->userdata);
?>
<?php
echo parse_bbcode(stripslashes(nl2br($post['post_body'])));
?>
</div>
<div class="user_signature">
<?php
echo parse_bbcode(stripslashes(nl2br($post['user_signature'])));
?>
</div>
</div>
示例15: parse_bbcode
<h1><?php
echo $page->title;
?>
</h1>
<p><?php
echo parse_bbcode(nl2br(htmlspecialchars($page->content)));
?>
</p>