本文整理汇总了PHP中KunenaHtmlParser类的典型用法代码示例。如果您正苦于以下问题:PHP KunenaHtmlParser类的具体用法?PHP KunenaHtmlParser怎么用?PHP KunenaHtmlParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KunenaHtmlParser类的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;
}
$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 ' ';
}
示例3: 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);
}
示例4: 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');
}
$content = KunenaHtmlParser::plainBBCode($message->message, $this->params->get('activity_stream_limit', 0));
// Add readmore permalink
$content .= '<br /><a rel="nofollow" href="' . $message->getTopic()->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);
}
示例5: onAfterReply
public function onAfterReply($message) {
$content = KunenaHtmlParser::plainBBCode($message->message, $this->params->get('activity_stream_limit', 0));
// Add readmore permalink
$content .= '<br /><a rel="nofollow" href="'.$message->getTopic()->getPermaUrl().'" class="small profile-newsfeed-item-action">'.JText::_('COM_KUNENA_READMORE').'</a>';
$msg = AwdwallHelperUser::formatUrlInMsg($msg);
$wall =& JTable::getInstance('Wall', 'Table');
$wall->user_id = $message->userid;
$wall->group_id = NULL;
$wall->type = 'text';
$wall->commenter_id = $message->userid;
$wall->user_name = '';
$wall->avatar = '';
$wall->message = JText::sprintf ( 'PLG_KUNENA_JOMWALL_ACTIVITY_REPLY_TITLE', '<a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a>' ).'<br>'.$content;
$wall->reply = 0;
$wall->is_read = 0;
$wall->is_pm = 0;
$wall->is_reply = 0;
$wall->posted_id = NULL;
$wall->wall_date = time();
if (!$wall->store()){
}
}
示例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: 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 ' ';
}
示例8: 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;
}
示例9: 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);
}
示例10: 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);
}
示例11: onAfterReply
public function onAfterReply($message) {
CFactory::load ( 'libraries', 'userpoints' );
CUserPoints::assignPoint ( 'com_kunena.thread.reply' );
// Check for permisions of the current category - activity only if public or registered
if ($message->getCategory()->pub_access <= 0) {
//activity stream - reply post
require_once KPATH_SITE.'/lib/kunena.link.class.php';
$JSPostLink = CKunenaLink::GetThreadPageURL ( 'view', $message->catid, $message->thread, 0 );
kimport('kunena.html.parser');
$content = KunenaHtmlParser::plainBBCode($message->message, $this->_config->activity_limit);
// Add readmore link
$content .= '<br /><a href="'.
CKunenaLink::GetMessageURL($message->id, $message->catid).
'" class="small profile-newsfeed-item-action">'.JText::sprintf('Read more...').'</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::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG1' ) . ' <a href="' . $JSPostLink . '">' . $message->subject . '</a> ' . JText::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2' ) );
$act->content = $content;
$act->app = 'kunena.post';
$act->cid = $message->thread;
// jomsocial 0 = public, 20 = registered members
if ($message->getCategory()->pub_access == 0) {
$act->access = 0;
} else {
$act->access = 20;
}
CFactory::load ( 'libraries', 'activities' );
CActivityStream::add ( $act );
}
}
示例12: onAfterReply
public function onAfterReply($message) {
CFactory::load ( 'libraries', 'userpoints' );
CUserPoints::assignPoint ( 'com_kunena.thread.reply' );
$content = KunenaHtmlParser::plainBBCode($message->message, $this->_config->activity_limit);
// Add readmore permalink
$content .= '<br /><a rel="nofollow" href="'.
KunenaRoute::_($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::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG1' ) . ' <a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a> ' . JText::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2' ) );
$act->content = $content;
$act->app = 'kunena.post';
$act->cid = $message->thread;
$act->access = $this->getAccess($message->getCategory());
CFactory::load ( 'libraries', 'activities' );
CActivityStream::add ( $act );
}
示例13: if
<?php endif; ?>
<?php if ($this->config->userlist_posts) : ?>
<li class="kdetails-posts"><span><?php echo JText::_('COM_KUNENA_USRL_POSTS') ?>:</span> <?php echo intval($this->user->posts); ?></li>
<?php endif; ?>
<?php if ($this->config->userlist_userhits) : ?>
<li class="kdetails-posts"><span><?php echo JText::_('COM_KUNENA_USRL_HITS') ?>:</span> <?php echo intval($this->user->uhits) ?></li>
<?php endif; ?>
<?php if ($this->config->userlist_karma) : ?>
<li class="kdetails-karma"><span><?php echo JText::_('COM_KUNENA_USRL_KARMA') ?>:</span> <?php echo intval($this->user->karma); ?></li>
<?php endif; ?>
<?php if (!empty($this->user->websiteurl)):?>
<li class="kdetails-website"><span><?php echo JText::_('COM_KUNENA_MYPROFILE_WEBSITE') ?>:</span> <a href="http://<?php echo $this->escape($this->user->websiteurl); ?>" target="_blank"><?php echo KunenaHtmlParser::parseText($this->user->websitename ? $this->user->websitename : $this->user->websiteurl); ?></a></li>
<?php endif;?>
<?php if (!empty($this->rank_title)) : ?>
<li class="kdetails-rank"><span><?php echo JText::_('COM_KUNENA_MYPROFILE_RANK') ?>:</span> <?php echo $this->rank_title ?></li>
<?php endif ?>
<?php if (!empty($this->rank_image)) : ?>
<li class="kdetails-rankimg"><?php echo $this->rank_image ?></li>
<?php endif ?>
<li>
<ul class="kdetails-links">
<?php echo $this->user->socialButton('twitter'); ?>
<?php echo $this->user->socialButton('facebook'); ?>
<?php echo $this->user->socialButton('myspace'); ?>
示例14: echo
value="<?php
echo JText::_('COM_KUNENA_EDITOR_VIDEO_INSERT');
?>"
onmouseover="javascript:document.id('helpbox').set('value', '<?php
echo KunenaHtmlParser::JSText('COM_KUNENA_EDITOR_HELPLINE_VIDEOAPPLY2');
?>')" />
</div>
</td>
</tr>
<?php
}
if (!$this->config->disemoticons) : ?>
<tr>
<td class="kpostbuttons">
<div id="smilie"><?php
$emoticons = KunenaHtmlParser::getEmoticons(0, 1);
foreach ( $emoticons as $emo_code=>$emo_url ) {
echo '<img class="btnImage" src="' . $emo_url . '" border="0" alt="' . $emo_code . ' " title="' . $emo_code . ' " onclick="kbbcode.insert(\' '. $emo_code .' \', \'after\', true);" style="cursor:pointer"/> ';
}
?>
</div>
</td>
</tr>
<?php endif; ?>
<!-- end of extendable secondary toolbar -->
<tr>
<td class="kposthint"><input type="text" name="helpbox" id="helpbox" size="45" class="kinputbox" disabled="disabled" maxlength="100"
value="<?php echo (JText::_('COM_KUNENA_EDITOR_HELPLINE_HINT')); ?>" /></td>
</tr>
</table>
示例15: 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');
}