本文整理汇总了PHP中KunenaHtmlParser::parseText方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaHtmlParser::parseText方法的具体用法?PHP KunenaHtmlParser::parseText怎么用?PHP KunenaHtmlParser::parseText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaHtmlParser
的用法示例。
在下文中一共展示了KunenaHtmlParser::parseText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例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: 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;
}
}
示例4: 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 ' ';
}
示例5: getPersonalText
/**
* Render personal text.
*
* @return string
*
* @since K4.0
*/
public function getPersonalText()
{
if (!isset($this->_personalText)) {
$this->_personalText = KunenaHtmlParser::parseText($this->personalText);
}
return $this->_personalText;
}
示例6: echo
id="radio_name<?php
echo (int) $key;
?>
"
value="<?php
echo (int) $poll_option->id;
?>
"
<?php
if ($this->voted && $this->voted->lastvote == $poll_option->id) {
echo 'checked="checked"';
}
?>
/>
<?php
echo KunenaHtmlParser::parseText($poll_option->text);
?>
</label>
</li>
<?php
}
?>
</ul>
<input id="kpoll-button-vote" class="btn btn-success" type="submit"
value="<?php
echo $this->voted && $this->config->pollallowvoteone ? JText::_('COM_KUNENA_POLL_BUTTON_CHANGEVOTE') : JText::_('COM_KUNENA_POLL_BUTTON_VOTE');
?>
" />
<input id="kpoll_go_results" type="button" class="btn btn-success" value="<?php
示例7: 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 '';
}
示例8: getLastPostLink
/**
* @param $category
* @param null $content
* @param null $title
* @param null $class
* @param int $length
*
* @return mixed
*/
public function getLastPostLink($category, $content = null, $title = null, $class = null, $length = 30)
{
$lastTopic = $category->getLastTopic();
$channels = $category->getChannels();
if (!isset($channels[$lastTopic->category_id])) {
$category = $lastTopic->getCategory();
}
$uri = $lastTopic->getUrl($category, true, 'last');
if (!$content) {
$content = $lastTopic->first_post_id != $lastTopic->last_post_id ? JText::_('COM_KUNENA_RE') . ' ' : '';
$content .= KunenaHtmlParser::parseText($lastTopic->subject, $length);
}
if ($title === null) {
$title = JText::sprintf('COM_KUNENA_TOPIC_LAST_LINK_TITLE', $this->escape($category->getLastTopic()->subject));
}
return JHtml::_('kunenaforum.link', $uri, $content, $title, $class, 'nofollow');
}
示例9: intval
<span class="kcategory-views"> <?php echo JText::_('COM_KUNENA_MY_POSTS'); ?> </span>
</td>
<?php
$last = $this->category->getLastPosted();
if ($last->last_topic_id) : ?>
<td class="kcategory-topic">
<ul>
<?php
if ($this->config->avataroncat > 0) :
$useravatar = KunenaFactory::getUser((int)$last->last_post_userid)->getAvatarImage('klist-avatar', 'list');
if ($useravatar) : ?>
<li class="klatest-avatar"> <?php echo CKunenaLink::GetProfileLink ( intval($last->last_post_userid), $useravatar ); ?></li>
<?php endif; ?>
<?php endif; ?>
<li class="ktopic-title">
<?php echo JText::_('COM_KUNENA_GEN_LAST_POST') . ': '. CKunenaLink::GetThreadPageLink ( 'view', intval($last->id), intval($last->last_topic_id), intval($last->getLastPostLocation()), intval($this->config->messages_per_page), KunenaHtmlParser::parseText($last->last_topic_subject, 30), intval($last->last_post_id) );?>
</li>
<li class="ktopic-details">
<?php
echo JText::_('COM_KUNENA_BY') . ' ';
echo CKunenaLink::GetProfileLink ( intval($last->last_post_userid), $this->escape($last->last_post_guest_name) );
echo KunenaDate::getInstance($last->last_post_time)->toSpan('config_post_dateformat','config_post_dateformat_hover');
?>
</li>
</ul>
</td>
<?php else : ?>
<td class="kcol-mid kcol-knoposts"><?php echo JText::_('COM_KUNENA_NO_POSTS'); ?></td>
<?php endif ?>
示例10:
if ($useravatar) {
?>
<span class="klatest-avatar"> <?php
echo $last->getLastPostAuthor()->getLink($useravatar, null, 'nofollow', '', null, $this->category->id);
?>
</span>
<?php
}
?>
<!-- /Avatar -->
<?php
}
?>
<div class="klatest-subject ks">
<?php
echo JText::_('COM_KUNENA_GEN_LAST_POST') . ': ' . $this->getTopicLink($last, 'last', KunenaHtmlParser::parseText($last->subject, 30));
?>
</div>
<div class="klatest-subject-by ks">
<?php
echo JText::_('COM_KUNENA_BY') . ' ';
echo $last->getLastPostAuthor()->getLink(null, null, 'nofollow', '', null, $this->category->id);
echo '<br /><span class="nowrap" title="' . KunenaDate::getInstance($last->last_post_time)->toKunena('config_post_dateformat_hover') . '">' . KunenaDate::getInstance($last->last_post_time)->toKunena('config_post_dateformat') . '</span>';
?>
</div>
</td>
<?php
} else {
?>
示例11:
?>
</li>
<li><?php
echo $this->displayKarma();
?>
</li>
<?php
if ($PMlink) {
?>
<li><?php
echo $PMlink;
?>
</li>
<?php
}
?>
<?php
if (!empty($this->personalText)) {
?>
<li><strong><?php
echo JText::_('COM_KUNENA_MYPROFILE_ABOUTME');
?>
:</strong> <?php
echo KunenaHtmlParser::parseText($this->personalText);
?>
</li><?php
}
?>
</ul>
</div>
示例12:
echo $this->getTopicClass('k', 'row');
?>
">
<td class="kcol-first kcol-ktopicicon hidden-phone"> <?php
echo $this->getTopicLink($this->topic, 'unread', $this->topic->getIcon());
?>
</td>
<td class="kcol-mid ktopictittle">
<?php
// FIXME:
/*if ($this->message->attachments) {
echo $this->getIcon ( 'ktopicattach', JText::_('COM_KUNENA_ATTACH') );
}*/
?>
<div class="ktopic-title-cover"> <?php
echo $this->getTopicLink($this->topic, $this->message, KunenaHtmlParser::parseText($this->message->subject, 30), KunenaHtmlParser::stripBBCode($this->message->message, 500), 'ktopic-title km');
?>
</div>
</td>
<td class="kcol-mid ktopictittle">
<div class="ktopic-title-cover">
<?php
echo $this->getTopicLink($this->topic, null, null, KunenaHtmlParser::stripBBCode($this->topic->first_post_message, 500), 'ktopic-title km');
if ($this->topic->getUserTopic()->favorite) {
echo $this->getIcon('kfavoritestar', JText::_('COM_KUNENA_FAVORITE'));
}
if ($this->topic->unread) {
echo $this->getTopicLink($this->topic, 'unread', '<sup dir="ltr" class="knewchar">(' . $this->topic->unread . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>');
}
if ($this->topic->locked != 0) {
echo $this->getIcon('ktopiclocked', JText::_('COM_KUNENA_LOCKED_TOPIC'));
示例13: defined
* Kunena Component
* @package Kunena
*
* @Copyright (C) 2008 - 2011 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.kunena.org
**/
defined ( '_JEXEC' ) or die ();
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS') . ' - ' . $this->config->board_title);
?>
<div id="kannounce">
<h2 class="kheader">
<a href="" title="<?php echo JText::_('COM_KUNENA_VIEW_COMMON_ANNOUNCE_LIST') ?>" rel="kannounce-detailsbox">
<?php echo KunenaHtmlParser::parseText($this->announcement->title) ?>
</a>
</h2>
<?php if ($this->canEdit) : ?>
<div class="kactions">
<?php echo CKunenaLink::GetAnnouncementLink( 'edit', $this->announcement->id, JText::_('COM_KUNENA_ANN_EDIT'), JText::_('COM_KUNENA_ANN_EDIT')); ?> |
<?php echo CKunenaLink::GetAnnouncementLink( 'delete', $this->announcement->id, JText::_('COM_KUNENA_ANN_DELETE'), JText::_('COM_KUNENA_ANN_DELETE')); ?> |
<?php echo CKunenaLink::GetAnnouncementLink( 'add',NULL, JText::_('COM_KUNENA_ANN_ADD'), JText::_('COM_KUNENA_ANN_ADD')); ?> |
<?php echo CKunenaLink::GetAnnouncementLink( 'show', NULL, JText::_('COM_KUNENA_ANN_CPANEL'), JText::_('COM_KUNENA_ANN_CPANEL')); ?>
</div>
<?php endif; ?>
<div class="kdetailsbox" id="kannounce-detailsbox">
<ul class="kheader-desc">
<?php if ($this->announcement->showdate > 0) : ?>
<li class="kannounce-date"><?php echo KunenaDate::getInstance($this->announcement->created)->toKunena('date_today') ?></li>
<?php endif; ?>
示例14: displayField
/**
* @param string $field Field to be displayed.
*
* @return int|string
*/
public function displayField($field)
{
switch ($field) {
case 'id':
return intval($this->id);
case 'name':
case 'icon':
return KunenaHtmlParser::parseText($this->name);
case 'description':
case 'headerdesc':
return KunenaHtmlParser::parseBBCode($this->{$field});
}
return '';
}
示例15: loadTopPolls
public function loadTopPolls($limit=0) {
$limit = $limit ? $limit : $this->_config->poppollscount;
if (count($this->topPolls) < $limit) {
$query = "SELECT m.*, poll.*, SUM(opt.votes) AS count
FROM #__kunena_polls_options AS opt
INNER JOIN #__kunena_polls AS poll ON poll.id=opt.pollid
LEFT JOIN #__kunena_messages AS m ON poll.threadid=m.id
GROUP BY pollid
ORDER BY count DESC";
$this->_db->setQuery($query, 0, $limit);
$this->topPolls = $this->_db->loadObjectList();
KunenaError::checkDatabaseError();
$top = reset($this->topPolls);
if (empty($top->count)){
$this->topPolls = array();
return;
}
foreach ($this->topPolls as $item) {
$item->link = CKunenaLink::GetThreadLink( 'view', $item->catid, $item->id, KunenaHtmlParser::parseText ($item->subject), '' );
$item->percent = round(100 * $item->count / $top->count);
}
$top->title = JText::_('COM_KUNENA_STAT_TOP') .' '. $limit .' '. JText::_('COM_KUNENA_STAT_POPULAR') .' '. JText::_('COM_KUNENA_STAT_POPULAR_POLLS_KGSG');
$top->titleName = JText::_('COM_KUNENA_POLL_STATS_NAME');
$top->titleCount = JText::_('COM_KUNENA_USRL_VOTES');
}
return array_slice($this->topPolls, 0, $limit);
}