本文整理汇总了PHP中BBCode::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP BBCode::parse方法的具体用法?PHP BBCode::parse怎么用?PHP BBCode::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBCode
的用法示例。
在下文中一共展示了BBCode::parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbcode
/**
* 2Moons
* Copyright (C) 2012 Jan Kröpke
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package 2Moons
* @author Jan Kröpke <info@2moons.cc>
* @copyright 2012 Jan Kröpke <info@2moons.cc>
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.7.3 (2013-05-19)
* @info $Id: BBCode.php 2640 2013-03-23 19:23:26Z slaver7 $
* @link http://2moons.cc/
*/
function bbcode($text)
{
require_once 'includes/classes/class.BBCode.php';
$bbcode = new BBCode();
$bbcode->addParser('list', 'bbcode_stripcontents');
//Block-Elements
$bbcode->addCode("quote", "callback_replace", "bbcode_quote", array(), "block", array("block"), array('inline', 'link', 'list'));
$bbcode->addCode("align", "callback_replace", "bbcode_align", array(), "block", array("block"), array('inline', 'link', 'list'));
$bbcode->addCode("spoiler", "simple_replace", null, array('start_tag' => '<div class="bbcode_spoiler"><p><b>Spoiler:</b></p><div>', 'end_tag' => '</div></div>'), "block", array("block"), array('inline', 'link', 'list'));
$bbcode->addCode("bg", "usecontent?", "bbcode_background", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("bgcolor", "callback_replace", "bbcode_bgcolor", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
//Inline-Elements
$bbcode->addCode("b", "simple_replace", null, array('start_tag' => '<b>', 'end_tag' => '</b>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("i", "simple_replace", null, array('start_tag' => '<i>', 'end_tag' => '</i>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("u", "simple_replace", null, array('start_tag' => '<u>', 'end_tag' => '</u>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("s", "simple_replace", null, array('start_tag' => '<s>', 'end_tag' => '</s>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("size", "callback_replace", "bbcode_size", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("color", "callback_replace", "bbcode_color", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("rouge", "callback_replace", "bbcode_rouge", array('start_tag' => '[rouge]', 'end_tag' => '[/rouge]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("orange", "callback_replace", "bbcode_orange", array('start_tag' => '[orange]', 'end_tag' => '[/orange]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("jaune", "callback_replace", "bbcode_jaune", array('start_tag' => '[jaune]', 'end_tag' => '[/jaune]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("chartreuse", "callback_replace", "bbcode_chartreuse", array('start_tag' => '[chartreuse]', 'end_tag' => '[/chartreuse]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("vert", "callback_replace", "bbcode_vert", array('start_tag' => '[vert]', 'end_tag' => '[/vert]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("cyan", "callback_replace", "bbcode_cyan", array('start_tag' => '[cyan]', 'end_tag' => '[/cyan]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("bleu", "callback_replace", "bbcode_bleu", array('start_tag' => '[bleu]', 'end_tag' => '[/bleu]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("violet", "callback_replace", "bbcode_violet", array('start_tag' => '[violet]', 'end_tag' => '[/violet]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("rose", "callback_replace", "bbcode_rose", array('start_tag' => '[rose]', 'end_tag' => '[/rose]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("gris", "callback_replace", "bbcode_gris", array('start_tag' => '[gris]', 'end_tag' => '[/gris]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("blanc", "callback_replace", "bbcode_blanc", array('start_tag' => '[blanc]', 'end_tag' => '[/blanc]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
//Link-Elements
$bbcode->addCode("url", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("link", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("mailto", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("email", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("mail", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
//Code-Elements
$bbcode->addCode("code", "usecontent", "bbcode_code", array('php' => false), 'code', array('block'), array('inline', 'link', 'list'));
$bbcode->addCode("php", "usecontent", "bbcode_code", array('php' => true), 'code', array('block'), array('inline', 'link', 'list'));
//List-Elements
$bbcode->addCode("list", "callback_replace", "bbcode_list", array(), "list", array('block', 'listitem'), array('inline', 'link'));
$bbcode->addCode("*", "simple_replace", null, array('start_tag' => '<li>', 'end_tag' => '</li>'), "listitem", array('list'), array());
//Image-Element
$bbcode->addCode("img", "usecontent", "bbcode_img", array(), "image", array('block', 'inline', 'link', 'listitem'), array());
//Flags
$bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
$bbcode->setGlobalCaseSensitive(false);
//New-Line-Drops
$bbcode->setCodeFlag('*', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
$codes = array('code', 'php', 'quote', 'spoiler');
$flags = array('opentag.before.newline', 'opentag.after.newline', 'closetag.before.newline', 'closetag.after.newline');
foreach ($codes as $code) {
foreach ($flags as $flag) {
$bbcode->setCodeFlag($code, $flag, BBCODE_NEWLINE_DROP);
}
}
return str_replace('&amp;', '&', makebr($bbcode->parse($text)));
}
示例2: ShowSendMessagesPage
function ShowSendMessagesPage()
{
global $USER, $LNG;
$ACTION = HTTP::_GP('action', '');
if ($ACTION == 'send') {
switch ($USER['authlevel']) {
case AUTH_MOD:
$class = 'mod';
break;
case AUTH_OPS:
$class = 'ops';
break;
case AUTH_ADM:
$class = 'admin';
break;
default:
$class = '';
break;
}
$Subject = HTTP::_GP('subject', '', true);
$Message = HTTP::_GP('text', '', true);
$Mode = HTTP::_GP('mode', 0);
$Lang = HTTP::_GP('lang', '');
if (!empty($Message) && !empty($Subject)) {
require 'includes/classes/BBCode.class.php';
if ($Mode == 0 || $Mode == 2) {
$From = '<span class="' . $class . '">' . $LNG['user_level'][$USER['authlevel']] . ' ' . $USER['username'] . '</span>';
$pmSubject = '<span class="' . $class . '">' . $Subject . '</span>';
$pmMessage = '<span class="' . $class . '">' . BBCode::parse($Message) . '</span>';
$USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
PlayerUtil::sendMessage($UserData['id'], $USER['id'], $From, 50, $pmSubject, $sendMessage, TIMESTAMP, NULL, 1, Universe::getEmulated());
}
}
if ($Mode == 1 || $Mode == 2) {
require 'includes/classes/Mail.class.php';
$userList = array();
$USERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$userList[$UserData['email']] = array('username' => $UserData['username'], 'body' => BBCode::parse(str_replace('{USERNAME}', $UserData['username'], $Message)));
}
Mail::multiSend($userList, strip_tags($Subject));
}
exit($LNG['ma_message_sended']);
} else {
exit($LNG['ma_subject_needed']);
}
}
$sendModes = $LNG['ma_modes'];
if (Config::get()->mail_active == 0) {
unset($sendModes[1]);
unset($sendModes[2]);
}
$template = new template();
$template->assign_vars(array('langSelector' => array_merge(array('' => $LNG['ma_all']), $LNG->getAllowedLangs(false)), 'modes' => $sendModes));
$template->show('SendMessagesPage.tpl');
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$sujet = ForumSubjects::where("id", $id)->first();
$categorie = ForumCategories::find($sujet->category);
foreach ($sujet->messages as $message) {
Date::setLocale('fr');
$date = new Date($message->created);
$message->when = $date->format('j F Y');
$message->message = $this::text_humanized($message->message);
$message->message = BBCode::parse($message->message);
}
return view('forum.sujets.show', ['categorie' => $categorie, "sujet" => $sujet]);
}
示例4: bbcode
function bbcode($text)
{
require_once ROOT_PATH . 'includes/classes/class.BBCode.' . PHP_EXT;
$bbcode = new BBCode();
$bbcode->addParser('list', 'bbcode_stripcontents');
//Block-Elements
$bbcode->addCode("quote", "callback_replace", "bbcode_quote", array(), "block", array("block"), array('inline', 'link', 'list'));
$bbcode->addCode("align", "callback_replace", "bbcode_align", array(), "block", array("block"), array('inline', 'link', 'list'));
$bbcode->addCode("spoiler", "simple_replace", null, array('start_tag' => '<div class="bbcode_spoiler"><p><b>Spoiler:</b></p><div>', 'end_tag' => '</div></div>'), "block", array("block"), array('inline', 'link', 'list'));
$bbcode->addCode("bg", "usecontent?", "bbcode_background", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("bgcolor", "callback_replace", "bbcode_bgcolor", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
//Inline-Elements
$bbcode->addCode("b", "simple_replace", null, array('start_tag' => '<b>', 'end_tag' => '</b>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("i", "simple_replace", null, array('start_tag' => '<i>', 'end_tag' => '</i>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("u", "simple_replace", null, array('start_tag' => '<u>', 'end_tag' => '</u>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("s", "simple_replace", null, array('start_tag' => '<s>', 'end_tag' => '</s>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("size", "callback_replace", "bbcode_size", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
$bbcode->addCode("color", "callback_replace", "bbcode_color", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
//Link-Elements
$bbcode->addCode("url", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("link", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("mailto", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("email", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
$bbcode->addCode("mail", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
//Code-Elements
$bbcode->addCode("code", "usecontent", "bbcode_code", array('php' => false), 'code', array('block'), array('inline', 'link', 'list'));
$bbcode->addCode("php", "usecontent", "bbcode_code", array('php' => true), 'code', array('block'), array('inline', 'link', 'list'));
//List-Elements
$bbcode->addCode("list", "callback_replace", "bbcode_list", array(), "list", array('block', 'listitem'), array('inline', 'link'));
$bbcode->addCode("*", "simple_replace", null, array('start_tag' => '<li>', 'end_tag' => '</li>'), "listitem", array('list'), array());
//Image-Element
$bbcode->addCode("img", "usecontent", "bbcode_img", array(), "image", array('block', 'inline', 'link', 'listitem'), array());
//Flags
$bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
$bbcode->setGlobalCaseSensitive(false);
//New-Line-Drops
$bbcode->setCodeFlag('*', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
$codes = array('code', 'php', 'quote', 'spoiler');
$flags = array('opentag.before.newline', 'opentag.after.newline', 'closetag.before.newline', 'closetag.after.newline');
foreach ($codes as $code) {
foreach ($flags as $flag) {
$bbcode->setCodeFlag($code, $flag, BBCODE_NEWLINE_DROP);
}
}
return makebr($bbcode->parse($text));
}
示例5: getBlogsReviews
//.........这里部分代码省略.........
$blog_link = $this->url->link('product/category', 'path=' . $blog_href['path']);
$record_link = $this->url->link('product/product', 'product_id=' . $comment['record_id'] . "&path=" . $blog_href['path']);
$rate = array();
$this->data['text_category'] = $this->language->get('text_category');
$this->data['text_record'] = $this->language->get('text_product');
}
//$comment['type'] == 'categories'
$rate_count = 0;
$rate_delta = 0;
$rate_delta_plus = 0;
$rate_delta_minus = 0;
foreach ($rate as $r) {
$rate_count = $r['rate_count'];
$rate_delta = $r['rate_delta'];
$rate_delta_plus = $r['rate_delta_plus'];
$rate_delta_minus = $r['rate_delta_minus'];
}
//$rate as $r
$this->load->model('tool/image');
if ($comment) {
if ($comment['image']) {
if (isset($thislist['avatar']['width']) && isset($thislist['avatar']['height']) && $thislist['avatar']['width'] != "" && $thislist['avatar']['height'] != "") {
$thumb = $this->model_tool_image->resize($comment['image'], $thislist['avatar']['width'], $thislist['avatar']['height'], 1);
} else {
$thumb = $this->model_tool_image->resize($comment['image'], 150, 150, 1);
}
} else {
$thumb = '';
}
} else {
$thumb = '';
}
if (!isset($comment['text'])) {
$comment['text'] = '';
}
//!isset($comment['text'])
if ($comment['text'] != '') {
$flag_desc = 'none';
if ($thislist['desc_symbols'] != '') {
$amount = $thislist['desc_symbols'];
$flag_desc = 'symbols';
}
//$thislist['desc_symbols'] != ''
if ($thislist['desc_words'] != '') {
$amount = $thislist['desc_words'];
$flag_desc = 'words';
}
//$thislist['desc_words'] != ''
if ($thislist['desc_pred'] != '') {
$amount = $thislist['desc_pred'];
$flag_desc = 'pred';
}
//$thislist['desc_pred'] != ''
switch ($flag_desc) {
case 'symbols':
$pattern = '/((.*?)\\S){0,' . $amount . '}/isu';
preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
$text = $out[0][0];
break;
case 'words':
$pattern = '/((.*?)\\x20){0,' . $amount . '}/isu';
preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
$text = $out[0][0];
break;
case 'pred':
$pattern = '/((.*?)\\.){0,' . $amount . '}/isu';
preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
$text = $out[0][0];
break;
case 'none':
$text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8');
break;
}
//$flag_desc
}
//$comment['text'] != ''
if ($text == '') {
$text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8');
}
//$text == ''
if ($this->rdate($this->language->get('text_date')) == $this->rdate($this->language->get('text_date'), strtotime($comment['date_added']))) {
$date_str = $this->language->get('text_today');
} else {
$date_str = $this->language->get('text_date');
}
$date_available = $this->rdate($date_str . $this->language->get('text_hours'), strtotime($comment['date_added']));
require_once DIR_SYSTEM . 'library/bbcode.class.php';
$text = strip_tags($text);
$text = BBCode::parse($text);
$this->data['comments'][] = array('comment_id' => $comment['comment_id'], 'parent_id' => $comment['parent_id'], 'blog_id' => $comment['blog_id'], 'blog_name' => $comment['blog_name'], 'blog_href' => $blog_link, 'blog_path' => $blog_href['path'], 'record_id' => $comment['record_id'], 'record_comments' => $comment['record_comments'], 'record_viewed' => $comment['record_viewed'], 'record_name' => $comment['record_name'], 'record_rating' => (int) $comment['rating_avg'], 'record_href' => $record_link, 'customer_id' => $comment['customer_id'], 'author' => $comment['author'], 'text' => $text, 'rating' => (int) $comment['rating'], 'rate_count' => $rate_count, 'rate_delta' => $rate_delta, 'rate_delta_plus' => $rate_delta_plus, 'rate_delta_minus' => $rate_delta_minus, 'date' => $date_available, 'image' => $comment['image'], 'thumb' => $thumb, 'text_category' => $this->data['text_category'], 'text_record' => $this->data['text_record']);
}
//$comments as $comment
}
//isset($comments) && count($comments) > 0
$this->cache->set('product.blog.reviews.' . (int) $this->config->get('config_language_id') . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $customer_group_id . '.' . $hash, $this->data);
} else {
$this->data = $row;
}
return $this->data;
}
示例6: BBCode
<?php
require '../include/mellivora.inc.php';
login_session_refresh();
head('Home');
if (cache_start('home', CONFIG_CACHE_TIME_HOME)) {
require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php';
$bbc = new BBCode();
$bbc->SetEnableSmileys(false);
$news = db_query_fetch_all('SELECT * FROM news ORDER BY added DESC');
foreach ($news as $item) {
echo '
<div class="news-container">';
section_head($item['title']);
echo '
<div class="news-body">
', $bbc->parse($item['body']), '
</div>
</div>
';
}
cache_end('home');
}
foot();
示例7: view
function view()
{
global $USER, $LNG;
$ticketID = HTTP::_GP('id', 0);
$answerResult = $GLOBALS['DATABASE']->query("SELECT a.*, t.categoryID, t.status FROM " . TICKETS_ANSWER . " a INNER JOIN " . TICKETS . " t USING(ticketID) WHERE a.ticketID = " . $ticketID . " ORDER BY a.answerID;");
$answerList = array();
$ticket_status = 0;
require 'includes/classes/BBCode.class.php';
while ($answerRow = $GLOBALS['DATABASE']->fetch_array($answerResult)) {
if (empty($ticket_status)) {
$ticket_status = $answerRow['status'];
}
$answerRow['time'] = _date($LNG['php_tdformat'], $answerRow['time'], $USER['timezone']);
$answerRow['message'] = BBCode::parse($answerRow['message']);
$answerList[$answerRow['answerID']] = $answerRow;
}
$GLOBALS['DATABASE']->free_result($answerResult);
$categoryList = $this->ticketObj->getCategoryList();
$this->tplObj->assign_vars(array('ticketID' => $ticketID, 'ticket_status' => $ticket_status, 'categoryList' => $categoryList, 'answerList' => $answerList));
$this->tplObj->show('page.ticket.view.tpl');
}
示例8: send_email
function send_email(array $receivers, $subject, $body, array $cc_list = null, array $bcc_list = null, $from_email = CONFIG_EMAIL_FROM_EMAIL, $from_name = CONFIG_EMAIL_FROM_NAME, $replyto_email = CONFIG_EMAIL_REPLYTO_EMAIL, $replyto_name = CONFIG_EMAIL_REPLYTO_NAME, $is_html = false)
{
$mail = new PHPMailer();
$mail->IsHTML($is_html);
$mail->XMailer = ' ';
$successfully_sent_to = array();
try {
if (CONFIG_EMAIL_USE_SMTP) {
$mail->IsSMTP();
$mail->SMTPDebug = CONFIG_EMAIL_SMTP_DEBUG_LEVEL;
$mail->Host = CONFIG_EMAIL_SMTP_HOST;
$mail->Port = CONFIG_EMAIL_SMTP_PORT;
$mail->SMTPSecure = CONFIG_EMAIL_SMTP_SECURITY;
$mail->SMTPAuth = CONFIG_EMAIL_SMTP_AUTH;
$mail->Username = CONFIG_EMAIL_SMTP_USER;
$mail->Password = CONFIG_EMAIL_SMTP_PASSWORD;
}
$mail->SetFrom($from_email, $from_name);
if ($replyto_email) {
$mail->AddReplyTo($replyto_email, $replyto_name);
}
// add the "To" receivers
foreach ($receivers as $receiver) {
if (!valid_email($receiver)) {
continue;
}
$mail->AddAddress($receiver);
$successfully_sent_to[] = $receiver;
}
if (empty($successfully_sent_to)) {
message_error('There must be at least one valid "To" receiver of this email');
}
// add the "CC" receivers
if (!empty($cc_list)) {
foreach ($cc_list as $cc) {
if (!valid_email($cc)) {
continue;
}
$mail->AddCC($cc);
$successfully_sent_to[] = $cc;
}
}
// add the "BCC" receivers
if (!empty($bcc_list)) {
foreach ($bcc_list as $bcc) {
if (!valid_email($bcc)) {
continue;
}
$mail->AddBCC($bcc);
$successfully_sent_to[] = $bcc;
}
}
$mail->Subject = $subject;
// HTML email
if ($is_html) {
require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php';
$bbc = new BBCode();
$bbc->SetEnableSmileys(false);
// we assume the email has come to us in BBCode format
$mail->MsgHTML($bbc->parse($body));
} else {
$mail->Body = $body;
}
} catch (Exception $e) {
log_exception($e);
message_error('Could not send email! An exception has been logged. Please contact ' . (CONFIG_EMAIL_REPLYTO_EMAIL ? CONFIG_EMAIL_REPLYTO_EMAIL : CONFIG_EMAIL_FROM_EMAIL));
}
return $successfully_sent_to;
}
示例9: signer
private function signer($record_id, $record_info)
{
$record_settings = unserialize($record_info['comment']);
if (isset($record_settings['signer']) && $record_settings['signer']) {
$this->data['record_id'] = $record_id;
$this->data['record_info'] = $record_info;
$this->getChild('common/seoblog');
$this->data['record_info']['link'] = $this->url->link('record/record', '&record_id=' . $this->data['record_id']);
$this->language->load('agoo/signer/signer');
$this->data['login'] = $this->customer->getFirstName() . " " . $this->customer->getLastName();
$this->data['customer_id'] = $this->customer->getId();
if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
$server = $this->config->get('config_ssl');
} else {
$server = $this->config->get('config_url');
}
if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
$this->data['logo'] = $server . 'image/' . $this->config->get('config_logo');
} else {
$this->data['logo'] = false;
}
$this->load->model('agoo/signer/signer');
$record_signers = $this->model_agoo_signer_signer->getStatusId($this->data['record_id'], 'record_id');
if ($record_signers) {
foreach ($record_signers as $par => $singers) {
$template = '/template/module/blog_signer_mail.tpl';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $template)) {
$this->template = $this->config->get('config_template') . $template;
} else {
$this->template = 'default' . $template;
}
$this->data['theme'] = $this->config->get('config_template');
require_once DIR_SYSTEM . 'library/bbcode.class.php';
$this->request->post['text'] = strip_tags($this->request->post['text']);
$text = BBCode::parse($this->request->post['text']);
if ($this->rdate($this->language->get('text_date')) == $this->rdate($this->language->get('text_date'), strtotime(date('Y-m-d H:i:s')))) {
$date_str = $this->language->get('text_today');
} else {
$date_str = $this->language->get('text_date');
}
$date_added = $this->rdate($date_str . $this->language->get('text_hours'), strtotime(date('Y-m-d H:i:s')));
$customer = $this->model_agoo_signer_signer->getCustomer($singers['customer_id']);
foreach ($this->request->post as $comment) {
$this->data['data'] = array('text' => $text, 'comment' => $this->request->post, 'record' => $this->data['record_info'], 'date' => $date_added, 'shop' => $this->config->get('config_name'), 'signers' => serialize($singers), 'signer_customer' => $customer);
}
//$this->request->post as $comment
$html = $this->render();
$message = $html;
$subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
if ($singers['customer_id'] != $this->data['customer_id']) {
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($customer['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($this->config->get('config_name'));
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
$mail->send();
}
//$singers['customer_id'] != $this->data['customer_id']
}
//$record_signers as $par => $singers
}
//$record_signers
}
//isset($record_settings['signer']) && $record_settings['signer']
}
示例10: parseBBCode
public function parseBBCode($text)
{
require_once SPINDASH_TEXTPROC . 'bbcode.inc.php';
$bbcode = new BBCode($this);
return $bbcode->parse($text);
}
示例11: foreach
<?php
if (!$published || !empty($revision) || !empty($preview)) {
?>
<br /><br />
<blockquote>
<strong>Description:</strong><br />
<?php
echo $description;
?>
</blockquote>
<?php
}
?>
<p><?php
echo BBCode::parse($body);
?>
</p>
<?php
if (!empty($mlt)) {
?>
<p><h4>More Like This:</h4>
<?php
foreach ($mlt as $fetched) {
echo '<a href="' . Url::format('article/view/' . Id::create($fetched, 'news')) . '">' . $fetched['title'] . '</a><br />';
}
?>
</p>
<?php
}
示例12: array
?>
)</em>
<table class="table table-bordered">
<tbody>
<tr>
<th style="width: 10%">Title</th>
<td><span><?php
echo $bug['title'];
?>
</span></td>
</tr>
<tr>
<th>Description</th>
<td><p><?php
echo BBCode::parse($bug['description'], '#');
?>
</p></td>
</tr>
<tr>
<th>Steps to Reproduce</th>
<td><p><?php
echo BBCode::parse($bug['reproduction'], '#');
?>
</p></td>
</tr>
</tbody>
</table>
<hr />
<?php
echo Partial::render('comment', array('id' => $bug['_id'], 'page' => $commentPage, 'pageLoc' => $commentPageLoc));
}
示例13: adminDetailApply
protected function adminDetailApply()
{
global $LNG, $USER;
if (!$this->rights['SEEAPPLY'] || !$this->rights['MANAGEAPPLY']) {
$this->redirectToHome();
}
$id = HTTP::_GP('id', 0);
$db = Database::get();
$sql = 'SELECT
r.`applyID`,
r.`time`,
r.`text`,
u.`username`,
u.`register_time`,
u.`onlinetime`,
u.`galaxy`,
u.`system`,
u.`planet`,
CONCAT_WS(\':\', u.`galaxy`, u.`system`, u.`planet`) AS `coordinates`,
@total_fights := u.`wons` + u.`loos` + u.`draws`,
@total_fights_percentage := @total_fights / 100,
@total_fights AS `total_fights`,
u.`wons`,
ROUND(u.`wons` / @total_fights_percentage, 2) AS `wons_percentage`,
u.`loos`,
ROUND(u.`loos` / @total_fights_percentage, 2) AS `loos_percentage`,
u.`draws`,
ROUND(u.`draws` / @total_fights_percentage, 2) AS `draws_percentage`,
u.`kbmetal`,
u.`kbcrystal`,
u.`lostunits`,
u.`desunits`,
stat.`tech_rank`,
stat.`tech_points`,
stat.`build_rank`,
stat.`build_points`,
stat.`defs_rank`,
stat.`defs_points`,
stat.`fleet_rank`,
stat.`fleet_points`,
stat.`total_rank`,
stat.`total_points`,
p.`name`
FROM
%%ALLIANCE_REQUEST%% AS r
LEFT JOIN
%%USERS%% AS u ON r.userId = u.id
INNER JOIN
%%STATPOINTS%% AS stat
LEFT JOIN
%%PLANETS%% AS p ON p.id = u.id_planet
WHERE
applyID = :applyID;';
$applyDetail = $db->selectSingle($sql, array(':applyID' => $id));
if (empty($applyDetail)) {
$this->printMessage($LNG['al_apply_not_exists'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=alliance&mode=admin&action=mangeApply')));
}
require 'includes/classes/BBCode.class.php';
$applyDetail['text'] = BBCode::parse($applyDetail['text']);
$applyDetail['kbmetal'] = pretty_number($applyDetail['kbmetal']);
$applyDetail['kbcrystal'] = pretty_number($applyDetail['kbcrystal']);
$applyDetail['lostunits'] = pretty_number($applyDetail['lostunits']);
$applyDetail['desunits'] = pretty_number($applyDetail['desunits']);
$this->assign(array('applyDetail' => $applyDetail, 'apply_time' => _date($LNG['php_tdformat'], $applyDetail['time'], $USER['timezone']), 'register_time' => _date($LNG['php_tdformat'], $applyDetail['register_time'], $USER['timezone']), 'onlinetime' => _date($LNG['php_tdformat'], $applyDetail['onlinetime'], $USER['timezone'])));
$this->display('page.alliance.admin.detailApply.tpl');
}
示例14: array
?>
</h1>
<small>By <?php
echo $lecturer;
$access = array();
if (CheckAcl::can('editLectures')) {
array_push($access, '<a href="' . Url::format('lecture/edit/' . $_id) . '">Edit</a>');
}
if (CheckAcl::can('deleteLectures')) {
array_push($access, '<a href="' . Url::format('lecture/delete/' . $_id) . '">Delete</a>');
}
if (!empty($access)) {
echo ' - ' . implode(' - ', $access);
}
?>
</small>
<p><?php
echo BBCode::parse($description);
?>
</p>
<em><?php
echo Date::minuteFormat($time);
?>
to
<?php
echo Date::minuteFormat($time + $duration);
?>
</em>
</div>
示例15: Post
public function Post()
{
if (!$this->isLoggedIn) {
return;
}
if ($this->session->accept_token != REQUEST_TOKEN) {
Request::redirect(HOST . 'login');
return;
}
$content = stripslashes(Request::post(false)->content);
#Faz a validação do HTML; HTMLPurifier <3
require_once EXTENSIONS_DIR . 'HTMLPurifier/HTMLPurifier.includes.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
$config->set('HTML.TargetBlank', true);
$config->set('HTML.SafeObject', true);
$config->set('HTML.SafeEmbed', true);
$config->set('HTML.SafeIframe', true);
$config->set('Output.FlashCompat', true);
$config->set('HTML.FlashAllowFullScreen', true);
$config->set('HTML.Allowed', 'i, b, a[href], p, ul, ol, li, span[style], img[src|style], strike, br, hr, blockquote, div, object, param[name|value], embed[src|type|width|height|allowscriptaccess], iframe[src|width|height]');
$config->set('CSS.AllowedProperties', 'color, float, height, width, margin, border');
$config->set('AutoFormat.Linkify', true);
$config->set('URI.MungeResources', true);
$config->set('URI.SafeIframeRegexp', '#^https://((www.)?youtube.com/embed/|player.vimeo.com/video/)#');
$HTMLPurifier = new HTMLPurifier($config);
$content = $HTMLPurifier->purify($content);
$content = preg_replace('/(?<=^|\\s|>)@([A-Za-z0-9_]{1,20})/', '<a class="profile-link" href="' . HOST . 'perfil/$1" data-login="{$1}">@$1</a>', $content);
$bbCodeTags = array('spoiler' => array('<div class="spoiler-alert"><span class="alert"><b>SPOILER ALERT!</b> <a href="javascript:void(0);">Clique aqui</a> para exibir.</span><span class="spoiler-content">', '<span></div>'));
$content = BBCode::parse($content, $bbCodeTags);
Phalanx::loadClasses('Profile', 'Badges', 'PostCategory');
$m = Model::Factory('posts');
$m->user_id = $this->session->user->id;
if (trim($this->post->title) != "") {
$m->title = $this->post->title;
}
$m->content = $content;
$m->public = $this->post->post_privacy;
$m->date = date('Y-m-d H:i:s');
$m->like_count = 0;
$m->dislike_count = 0;
$m->comment_count = 0;
$post_id = $m->insert();
if (isset($this->post->categories)) {
$categories = explode(",", $this->post->categories);
foreach ($categories as $category) {
$category = trim($category);
$categoryID = PostCategory::get($category);
$m = Model::Factory('posts_has_category');
$m->posts_id = $post_id;
$m->category_id = $categoryID;
$m->insert();
}
}
$view = new Views();
$view->title = $this->post->title;
$view->content = $content;
$view->user = $this->session->user->login;
$view->avatar = $this->session->user->other_data->avatar;
$view->when = ' agora';
$view->post_id = $post_id;
$view->rating = new stdClass();
$view->rating->whatever = 0;
$view->rating->megaboga = 0;
$view->my_rating = null;
$view->its_mine = true;
$view->experience = Profile::experience($this->session->user->id);
$view->badges = Badges::from_user($this->session->user->id, 4);
preg_match_all('/(?<=|(?<=[.A-Za-z0-9_-]))@([.A-Za-z0-9_-]+[.A-Za-z0-9_-]+)/', $this->post->content, $usernames);
foreach ($usernames[1] as $username) {
$user = Profile::get_user_info($username);
if ($user) {
$n = new Notification(Notification::TAGGED_IN_A_POST, $this->session->user->id, $post_id, $user->id);
}
}
if ($this->post->post_to_twitter == 1 or $this->post->post_to_facebook == 1) {
$o = new stdClass();
$o->title = $this->post->title;
$o->url = HOST . 'perfil/' . $this->session->user->login . '/post/' . $post_id . '-' . mb_strtolower(preg_replace('/--+/u', '-', preg_replace('/[^\\w\\-]+/u', '-', $this->post->title)));
$o->uid = $this->session->user->id;
$o->content = strip_tags($content);
$o->avatar = MEDIA_DIR . 'images/avatar/big/' . $this->session->user->other_data->avatar;
$o->post_id = $post_id;
try {
if ($this->post->post_to_facebook == 1) {
Phalanx::loadController('FacebookController');
$facebook = new FacebookController();
$facebook->callOpenGraphAction('write', array('article_' => $o->url));
}
if ($this->post->post_to_twitter == 1) {
Phalanx::loadController('TwitterController');
$twitter = new TwitterController();
$twitter->sharePost($o);
}
} catch (Exception $e) {
}
}
header("Content-type: text/html; charset=utf-8");
echo $view->render("post_body.phtml");
}