本文整理汇总了PHP中KunenaHtmlParser::parseBBCode方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaHtmlParser::parseBBCode方法的具体用法?PHP KunenaHtmlParser::parseBBCode怎么用?PHP KunenaHtmlParser::parseBBCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaHtmlParser
的用法示例。
在下文中一共展示了KunenaHtmlParser::parseBBCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDefault
function displayDefault($tpl = null)
{
$params = $this->app->getParams('com_kunena');
$this->header = $params->get('page_title');
$this->body = $params->get('body');
$this->_prepareDocument();
$format = $params->get('body_format');
$this->header = $this->escape($this->header);
if ($format == 'html')
{
$this->body = trim($this->body);
}
elseif ($format == 'text')
{
$this->body = $this->escape($this->body);
}
else
{
$this->body = KunenaHtmlParser::parseBBCode($this->body);
}
$this->render('Widget/Custom', $tpl);
}
示例2: displayAnnouncement
function displayAnnouncement($tpl = null) {
if (KunenaFactory::getConfig()->showannouncement > 0) {
$moderator = intval($this->me->isModerator('global'));
$cache = JFactory::getCache('com_kunena', 'output');
if ($cache->start("{$this->template->name}.common.announcement.{$moderator}", 'com_kunena.template')) return;
// User needs to be global moderator to edit announcements
if ($moderator) {
$this->canEdit = true;
} else {
$this->canEdit = false;
}
// FIXME: move into model
$db = JFactory::getDBO();
$query = "SELECT * FROM #__kunena_announcement WHERE published='1' ORDER BY created DESC";
$db->setQuery ( $query, 0, 1 );
$this->announcement = $db->loadObject ();
if (KunenaError::checkDatabaseError()) return;
if ($this->announcement) {
$this->annTitle = KunenaHtmlParser::parseText($this->announcement->title);
$this->annDescription = $this->announcement->sdescription ? KunenaHtmlParser::parseBBCode($this->announcement->sdescription) : KunenaHtmlParser::parseBBCode($this->announcement->description, 300);
$this->annDate = KunenaDate::getInstance($this->announcement->created);
$this->annListURL = KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=list");
$this->annMoreURL = !empty($this->announcement->description) ? KunenaRoute::_("index.php?option=com_kunena&view=announcement&id={$this->announcement->id}") : null;
$result = $this->loadTemplate($tpl);
if (JError::isError($result)) {
return $result;
}
echo $result;
} else {
echo ' ';
}
$cache->end();
} else echo ' ';
}
示例3: displayAnnouncement
function displayAnnouncement($tpl = null) {
if (KunenaFactory::getConfig()->showannouncement > 0) {
$moderator = intval($this->me->isModerator('global'));
$cache = JFactory::getCache('com_kunena', 'output');
if ($cache->start("{$this->template->name}.common.announcement.{$moderator}", 'com_kunena.template')) return;
// User needs to be global moderator to edit announcements
if ($moderator) {
$this->canEdit = true;
} else {
$this->canEdit = false;
}
$this->announcement = $this->get('Announcement');
if ($this->announcement) {
$this->annTitle = KunenaHtmlParser::parseText($this->announcement->title);
$this->annDescription = $this->announcement->sdescription ? KunenaHtmlParser::parseBBCode($this->announcement->sdescription) : KunenaHtmlParser::parseBBCode($this->announcement->description, 300);
$this->annDate = KunenaDate::getInstance($this->announcement->created);
$this->annListURL = KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=list");
$this->annMoreURL = !empty($this->announcement->description) ? KunenaRoute::_("index.php?option=com_kunena&view=announcement&id={$this->announcement->id}") : null;
$result = $this->loadTemplate($tpl);
if (JError::isError($result)) {
return $result;
}
echo $result;
} else {
echo ' ';
}
$cache->end();
} else echo ' ';
}
示例4: createItem
function createItem($title, $url, $description, $category, $date, $userid, $username)
{
if ($this->config->rss_author_in_title) {
// We want author in item titles
$title .= ' - ' . JText::_('COM_KUNENA_BY') . ': ' . $username;
}
$description = preg_replace('/\\[confidential\\](.*?)\\[\\/confidential\\]/s', '', $description);
$description = preg_replace('/\\[hide\\](.*?)\\[\\/hide\\]/s', '', $description);
$description = preg_replace('/\\[spoiler\\](.*?)\\[\\/spoiler\\]/s', '', $description);
$description = preg_replace('/\\[code\\](.*?)\\[\\/code]/s', '', $description);
if ((bool) $this->config->rss_allow_html) {
$description = KunenaHtmlParser::parseBBCode($description, null, (int) $this->config->rss_word_count);
} else {
$description = KunenaHtmlParser::parseText($description, (int) $this->config->rss_word_count);
}
// Assign values to feed item
$item = new JFeedItem();
$item->title = $title;
$item->link = $url;
$item->description = $description;
$item->date = $date->toSql();
$item->author = $username;
// FIXME: inefficient to load users one by one -- also vulnerable to J! 2.5 user is NULL bug
if ($this->config->rss_author_format != 'name') {
$item->authorEmail = JFactory::getUser($userid)->email;
}
$item->category = $category;
// Finally add item to feed
$this->document->addItem($item);
}
示例5: onAfterReply
public function onAfterReply($message)
{
if (JString::strlen($message->message) > $this->params->get('activity_points_limit', 0)) {
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('com_kunena.thread.reply');
}
$parent = new stdClass();
$parent->forceSecure = true;
$parent->forceMinimal = true;
$content = KunenaHtmlParser::parseBBCode($message->message, $parent, $this->params->get('activity_stream_limit', 0));
// Add readmore permalink
$content .= '<br /><a rel="nofollow" href="' . $message->getPermaUrl() . '" class="small profile-newsfeed-item-action">' . JText::_('COM_KUNENA_READMORE') . '</a>';
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $message->userid;
$act->target = 0;
// no target
$act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TITLE', '<a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a>'));
$act->content = $content;
$act->app = 'kunena.post';
$act->cid = $message->thread;
$act->access = $this->getAccess($message->getCategory());
// Comments and like support
$act->comment_id = $message->thread;
$act->comment_type = 'kunena.post';
$act->like_id = $message->thread;
$act->like_type = 'kunena.post';
// Do not add private activities
if ($act->access > 20) {
return;
}
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
示例6: displayRows
/**
* Method to display the layout of search results
*
* @return void
*/
public function displayRows()
{
// Run events
$params = new JRegistry();
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'search');
$params->set('kunena_layout', 'default');
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->results, &$params, 0));
foreach ($this->results as $this->message) {
$this->topic = $this->message->getTopic();
$this->category = $this->message->getCategory();
$this->categoryLink = $this->getCategoryLink($this->category->getParent()) . ' / ' . $this->getCategoryLink($this->category);
$ressubject = KunenaHtmlParser::parseText($this->message->subject);
$resmessage = KunenaHtmlParser::parseBBCode($this->message->message, 500);
$profile = KunenaFactory::getUser((int) $this->message->userid);
$this->useravatar = $profile->getAvatarImage('kavatar', 'post');
foreach ($this->searchwords as $searchword) {
if (empty($searchword)) {
continue;
}
$ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/iu", '<span class="searchword" >' . $searchword . '</span>', $ressubject);
// FIXME: enable highlighting, but only after we can be sure that we do not break html
// $resmessage = preg_replace ( "/" . preg_quote ( $searchword, '/' ) . "/iu", '<span class="searchword" >' . $searchword . '</span>', $resmessage );
}
$this->author = $this->message->getAuthor();
$this->topicAuthor = $this->topic->getAuthor();
$this->topicTime = $this->topic->first_post_time;
$this->subjectHtml = $ressubject;
$this->messageHtml = $resmessage;
$contents = $this->subLayout('Search/Results/Row')->setProperties($this->getProperties());
echo $contents;
}
}
示例7: displayDefault
function displayDefault($tpl = null) {
$this->header = $this->escape($this->header);
if (empty($this->html)) {
$this->body = KunenaHtmlParser::parseBBCode($this->body);
}
$result = $this->loadTemplateFile($tpl);
if (JError::isError($result)) {
return $result;
}
echo $result;
}
示例8: displayEdit
function displayEdit($tpl = null)
{
$body = JRequest::getVar('body', '', 'post', 'string', JREQUEST_ALLOWRAW);
$response = array();
if ($this->me->exists()) {
$msgbody = KunenaHtmlParser::parseBBCode($body, $this);
$response['preview'] = $msgbody;
}
// Set the MIME type and header for JSON output.
$this->document->setMimeEncoding('application/json');
JResponse::setHeader('Content-Disposition', 'attachment; filename="' . $this->getName() . '.' . $this->getLayout() . '.json"');
echo json_encode($response);
}
示例9: displayEdit
/**
* @param null $tpl
*
* @throws Exception
*/
function displayEdit($tpl = null)
{
$body = JFactory::getApplication()->input->get('body', '', 'post', 'string', 'raw');
// RAW input
$response = array();
if ($this->me->exists() || $this->config->pubwrite) {
$msgbody = KunenaHtmlParser::parseBBCode($body, $this);
$response['preview'] = $msgbody;
}
// Set the MIME type and header for JSON output.
$this->document->setMimeEncoding('application/json');
JFactory::getApplication()->sendHeaders('Content-Disposition', 'attachment; filename="' . $this->getName() . '.' . $this->getLayout() . '.json"');
echo json_encode($response);
}
示例10: displayMessage
function displayMessage($id, $message, $template = null)
{
$layout = $this->getLayout();
if (!$template) {
$template = $this->state->get('profile.location');
$this->setLayout('default');
}
$this->mmm++;
$this->message = $message;
$this->profile = $this->message->getAuthor();
$this->replynum = $message->replynum;
$usertype = $this->me->getType($this->category->id, true);
if ($usertype == 'user' && $this->message->userid == $this->profile->userid) {
$usertype = 'owner';
}
// Thank you info and buttons
$this->thankyou = array();
$this->total_thankyou = 0;
$this->more_thankyou = 0;
if (isset($message->thankyou)) {
if ($this->config->showthankyou && $this->profile->userid) {
$task = "index.php?option=com_kunena&view=topic&task=%s&catid={$this->category->id}&id={$this->topic->id}&mesid={$this->message->id}&" . JSession::getFormToken() . '=1';
// for normal users, show only limited number of thankyou (config->thankyou_max)
if (!$this->me->isAdmin() && !$this->me->isModerator()) {
if (count($message->thankyou) > $this->config->thankyou_max) {
$this->more_thankyou = count($message->thankyou) - $this->config->thankyou_max;
}
$this->total_thankyou = count($message->thankyou);
$thankyous = array_slice($message->thankyou, 0, $this->config->thankyou_max, true);
} else {
$thankyous = $message->thankyou;
}
if ($this->message->authorise('unthankyou') && $this->me->isModerator($this->message->getCategory())) {
$canUnthankyou = true;
} else {
$canUnthankyou = false;
}
$userids_thankyous = array();
foreach ($thankyous as $userid => $time) {
$userids_thankyous[] = $userid;
}
$loaded_users = KunenaUserHelper::loadUsers($userids_thankyous);
$thankyou_delete = '';
foreach ($loaded_users as $userid => $user) {
$thankyou_delete = $canUnthankyou === true ? ' <a title="' . JText::_('COM_KUNENA_BUTTON_THANKYOU_REMOVE_LONG') . '" href="' . KunenaRoute::_(sprintf($task, "unthankyou&userid={$userid}")) . '"><img src="' . $this->ktemplate->getImagePath('icons/publish_x.png') . '" title="" alt="" /></a>' : '';
$this->thankyou[] = $loaded_users[$userid]->getLink() . $thankyou_delete;
}
}
}
// TODO: add context (options, template) to caching
$cache = JFactory::getCache('com_kunena', 'output');
$cachekey = "message.{$this->getTemplateMD5()}.{$layout}.{$template}.{$usertype}.c{$this->category->id}.m{$this->message->id}.{$this->message->modified_time}";
$cachegroup = 'com_kunena.messages';
if ($this->config->reportmsg && $this->me->exists()) {
if (!$this->config->user_report && $this->me->userid == $this->message->userid && !$this->me->isModerator()) {
$this->reportMessageLink = null;
} else {
$this->reportMessageLink = JHTML::_('kunenaforum.link', 'index.php?option=com_kunena&view=topic&layout=report&catid=' . intval($this->category->id) . '&id=' . intval($this->message->thread) . '&mesid=' . intval($this->message->id), JText::_('COM_KUNENA_REPORT'), JText::_('COM_KUNENA_REPORT'));
}
}
$contents = false;
//$cache->get($cachekey, $cachegroup);
if (!$contents) {
//Show admins the IP address of the user:
if ($this->category->authorise('admin') || $this->category->authorise('moderate') && !$this->config->hide_ip) {
if ($this->message->ip) {
if (!empty($this->message->ip)) {
$this->ipLink = '<a href="http://whois.domaintools.com/' . $this->message->ip . '" target="_blank"> IP: ' . $this->message->ip . '</a>';
} else {
$this->ipLink = ' ';
}
} else {
$this->ipLink = null;
}
}
$this->signatureHtml = KunenaHtmlParser::parseBBCode($this->profile->signature, null, $this->config->maxsig);
$this->attachments = $this->message->getAttachments();
// Link to individual message
if ($this->config->ordering_system == 'replyid') {
$this->numLink = $this->getSamePageAnkerLink($message->id, '#[K=REPLYNO]');
} else {
$this->numLink = $this->getSamePageAnkerLink($message->id, '#' . $message->id);
}
if ($this->message->hold == 0) {
$this->class = 'kmsg';
} elseif ($this->message->hold == 1) {
$this->class = 'kmsg kunapproved';
} else {
if ($this->message->hold == 2 || $this->message->hold == 3) {
$this->class = 'kmsg kdeleted';
}
}
// New post suffix for class
$this->msgsuffix = '';
if ($this->message->isNew()) {
$this->msgsuffix = '-new';
}
$contents = (string) $this->loadTemplateFile($template);
if ($usertype == 'guest') {
$contents = preg_replace_callback('|\\[K=(\\w+)(?:\\:(\\w+))?\\]|', array($this, 'fillMessageInfo'), $contents);
//.........这里部分代码省略.........
示例11: displayCommon
/**
* @param null $tpl
*
* @throws Exception
*/
protected function displayCommon($tpl = null)
{
$userid = JFactory::getApplication()->input->getInt('userid');
$this->_db = JFactory::getDBO();
$this->do = JFactory::getApplication()->input->getWord('layout');
if (!$userid) {
$this->user = JFactory::getUser();
} else {
$this->user = JFactory::getUser($userid);
}
if ($this->user->id == 0 || $this->me->userid == 0 && !$this->config->pubprofile) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice');
return;
}
$integration = KunenaFactory::getProfile();
$activityIntegration = KunenaFactory::getActivityIntegration();
$template = KunenaFactory::getTemplate();
$this->params = $template->params;
if (get_class($integration) == 'KunenaProfileNone') {
$this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice');
return;
}
$this->allow = true;
$this->profile = KunenaFactory::getUser($this->user->id);
if (!$this->profile->exists()) {
$this->profile->save();
}
if ($this->profile->userid == $this->me->userid) {
if ($this->do != 'edit') {
$this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_EDIT') . ' »', JText::_('COM_KUNENA_EDIT') . ' »', 'nofollow', 'edit', '');
} else {
$this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_BACK') . ' »', JText::_('COM_KUNENA_BACK') . ' »', 'nofollow', '', '');
}
}
$this->name = $this->user->username;
if ($this->config->showuserstats) {
$this->rank_image = $this->profile->getRank(0, 'image');
$this->rank_title = $this->profile->getRank(0, 'title');
$this->posts = $this->profile->posts;
$this->thankyou = $this->profile->thankyou;
$this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
$this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
}
if ($this->config->userlist_joindate || $this->me->isModerator()) {
$this->registerdate = $this->user->registerDate;
}
if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) {
$this->lastvisitdate = $this->user->lastvisitDate;
}
if (!isset($this->lastvisitdate) || $this->lastvisitdate == "0000-00-00 00:00:00") {
$this->lastvisitdate = null;
}
$this->avatarlink = $this->profile->getAvatarImage('kavatar', 'profile');
$this->personalText = $this->profile->personalText;
$this->signature = $this->profile->signature;
$this->signatureHtml = KunenaHtmlParser::parseBBCode($this->signature, null, $this->config->maxsig);
$this->localtime = KunenaDate::getInstance('now', $this->user->getParam('timezone', $this->app->get('offset', null)));
try {
$offset = new DateTimeZone($this->user->getParam('timezone', $this->app->get('offset', null)));
} catch (Exception $e) {
$offset = null;
}
$this->localtime->setTimezone($offset);
$this->moderator = KunenaAccess::getInstance()->getModeratorStatus($this->profile);
$this->admin = $this->profile->isAdmin();
switch ($this->profile->gender) {
case 1:
$this->genderclass = 'male';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
break;
case 2:
$this->genderclass = 'female';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
break;
default:
$this->genderclass = 'unknown';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
}
if ($this->profile->location) {
$this->locationlink = '<a href="http://maps.google.com?q=' . $this->escape($this->profile->location) . '" target="_blank">' . $this->escape($this->profile->location) . '</a>';
} else {
$this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');
}
$this->online = $this->profile->isOnline();
$this->showUnusedSocial = true;
if (!preg_match("~^(?:f|ht)tps?://~i", $this->profile->websiteurl)) {
$this->websiteurl = 'http://' . $this->profile->websiteurl;
} else {
$this->websiteurl = $this->profile->websiteurl;
}
$avatar = KunenaFactory::getAvatarIntegration();
$this->editavatar = $avatar instanceof KunenaAvatarKunena ? true : false;
$this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
$this->canBan = $this->banInfo->canBan();
if ($this->config->showbannedreason) {
//.........这里部分代码省略.........
示例12: getSignature
/**
* Render user signature.
*
* @return string
*
* @since K4.0
*/
public function getSignature()
{
if (!isset($this->_signature)) {
$this->_signature = KunenaHtmlParser::parseBBCode($this->signature, $this, KunenaConfig::getInstance()->maxsig);
}
return $this->_signature;
}
示例13:
<div class="kblock">
<div class="kheader clearfix">
<span class="ktoggler"><a class="ktoggler close" title="<?php
echo JText::_('COM_KUNENA_TOGGLER_COLLAPSE');
?>
" rel="frontstats_tbody"></a></span>
<h2><span><?php
echo JText::_('COM_KUNENA_FORUM_HEADER');
?>
</span></h2>
</div>
<div class="kcontainer" id="frontstats_tbody">
<div class="kbody">
<div class="kfheadercontent">
<?php
echo KunenaHtmlParser::parseBBCode($this->category->headerdesc);
?>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
if (!$this->category->isSection()) {
?>
<table class="klist-actions">
<tr>
<td class="klist-actions-goto">
示例14: if
</ul>
</div>
</div>
<div class="clrline"></div>
<div id="kprofile-rightcolbot">
<div class="kprofile-rightcol2">
<ul>
<?php if ($this->config->showemail && (!$this->profile->hideEmail || $this->me->isModerator())): ?><li><span class="kicon-profile kicon-profile-email"></span><?php echo JHTML::_('email.cloak', $this->user->email) ?></li><?php endif; ?>
<?php // FIXME: we need a better way to add http/https ?>
<li><?php if (!empty($this->profile->websiteurl)):?><span class="kicon-profile kicon-profile-website"></span><?php endif;?><a href="http://<?php echo $this->escape($this->profile->websiteurl); ?>" target="_blank"><?php echo KunenaHtmlParser::parseText($this->profile->websitename); ?></a></li>
</ul>
</div>
<div class="kprofile-rightcol1">
<h4><?php echo JText::_('COM_KUNENA_MYPROFILE_SIGNATURE'); ?></h4>
<div class="kmsgsignature"><div><?php echo KunenaHtmlParser::parseBBCode($this->signature); ?></div></div>
</div>
</div>
<div class="clrline"></div>
<div id="kprofile-tabs">
<dl class="tabs">
<?php if ($this->me->isModerator()): ?>
<dt class="open" title="<?php echo JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION'); ?>"><?php echo JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION'); ?></dt>
<dd style="display: none;">
<?php $this->displayUnapprovedPosts(); ?>
</dd>
<?php endif; ?>
<dt class="open" title="<?php echo JText::_('COM_KUNENA_USERPOSTS'); ?>"><?php echo JText::_('COM_KUNENA_USERPOSTS'); ?></dt>
示例15: displayField
/**
* @param string $field
*
* @return int|string
*/
public function displayField($field, $html = true)
{
switch ($field) {
case 'id':
return intval($this->id);
case 'subject':
return KunenaHtmlParser::parseText($this->subject);
case 'message':
// FIXME: add context to BBCode parser (and fix logic in the parser)
return $html ? KunenaHtmlParser::parseBBCode($this->message, $this) : KunenaHtmlParser::stripBBCode($this->message, $this->parent, $html);
}
return '';
}