当前位置: 首页>>代码示例>>PHP>>正文


PHP DiscussHelper::parseContent方法代码示例

本文整理汇总了PHP中DiscussHelper::parseContent方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::parseContent方法的具体用法?PHP DiscussHelper::parseContent怎么用?PHP DiscussHelper::parseContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DiscussHelper的用法示例。


在下文中一共展示了DiscussHelper::parseContent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 function process()
 {
     $view = new EasyDiscussView();
     $date = DiscussHelper::getDate();
     $now = $date->toMySQL();
     $modelSubscribe = $view->getModel('Subscribe');
     $subscribers = $modelSubscribe->getSiteSubscribers($this->interval, $now);
     $total = count($subscribers);
     if (empty($total)) {
         return false;
     }
     foreach ($subscribers as $subscriber) {
         $notify = DiscussHelper::getNotification();
         $data = array();
         $rows = $modelSubscribe->getCreatedPostByInterval($subscriber->sent_out, $now);
         $posts = array();
         if ($rows) {
             foreach ($rows as $row) {
                 $row['categorylink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=categorie&layout=listings&category_id=' . $row['category_id'], false, true);
                 $row['link'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row['id'], false, true);
                 $row['userlink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=profile&id=' . $row['user_id'], false, true);
                 $category = DiscussHelper::getTable('Category');
                 $creator = DiscussHelper::getTable('Profile');
                 $category->load($row['category_id']);
                 $creator->load($row['user_id']);
                 $row['category'] = $category->getTitle();
                 $row['avatar'] = $creator->getAvatar();
                 $row['name'] = $creator->getName();
                 $row['date'] = DiscussDateHelper::toFormat($row['created'], '%b %e, %Y');
                 $row['message'] = DiscussHelper::parseContent($row['content']);
                 $posts[] = $row;
             }
         }
         $data['post'] = $posts;
         $data['total'] = count($data['post']);
         $data['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($subscriber, true, true);
         $subject = $date->toMySQL();
         switch (strtoupper($this->interval)) {
             case 'DAILY':
                 $subject = $date->toFormat('%F');
                 $data['interval'] = JText::_('today');
                 break;
             case 'WEEKLY':
                 $subject = $date->toFormat('%V');
                 $data['interval'] = JText::_('this week');
                 break;
             case 'MONTHLY':
                 $subject = $date->toFormat('%B');
                 $data['interval'] = JText::_('this month');
                 break;
         }
         if (!empty($data['post'])) {
             $notify->addQueue($subscriber->email, JText::sprintf('COM_EASYDISCUSS_YOUR_' . $this->interval . '_SUBSCRIPTION', $subject), '', 'email.subscription.site.interval.php', $data);
         }
         $subscribe = DiscussHelper::getTable('Subscribe');
         $subscribe->load($subscriber->id);
         $subscribe->sent_out = $now;
         $subscribe->store();
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:60,代码来源:subscription.php

示例2: display

 function display($tmpl = null)
 {
     $config = DiscussHelper::getConfig();
     if (!$config->get('main_rss')) {
         return;
     }
     $document = JFactory::getDocument();
     $document->link = JRoute::_('index.php?option=com_easydiscuss&view=index');
     $document->setTitle($this->escape($document->getTitle()));
     $sort = JRequest::getString('sort', 'latest');
     $filter = JRequest::getString('filter', 'allposts');
     $category = JRequest::getInt('category_id', 0);
     $postModel = $this->getModel('Posts');
     $posts = $postModel->getData(true, $sort, null, $filter, $category);
     $pagination = $postModel->getPagination('0', $sort, $filter, $category);
     $jConfig = DiscussHelper::getJConfig();
     $posts = DiscussHelper::formatPost($posts);
     require_once DISCUSS_HELPERS . '/parser.php';
     foreach ($posts as $row) {
         // Assign to feed item
         $title = $this->escape($row->title);
         $title = html_entity_decode($title);
         $category = DiscussHelper::getTable('Category');
         $category->load($row->category_id);
         // load individual item creator class
         $item = new JFeedItem();
         //Problems with other language
         //$item->title		= htmlentities( $title );
         $item->title = $row->title;
         $item->link = JRoute::_('index.php?option=com_easydiscuss&view=post&id=' . $row->id);
         //$row->content		= DiscussHelper::parseContent( $row->content );
         if ($row->content_type == 'bbcode') {
             $row->content = DiscussHelper::parseContent($row->content);
             $row->content = html_entity_decode($row->content);
         }
         // Problems with other language
         //$item->description	= htmlentities( $row->content );
         $item->description = $row->content;
         $item->date = DiscussHelper::getDate($row->created)->toMySQL();
         $item->author = $row->user->getName();
         $item->category = $category->getTitle();
         if ($jConfig->get('feed_email') != 'none') {
             if ($jConfig->get('feed_email') == 'author') {
                 $item->authorEmail = $row->user->user->email;
             } else {
                 $item->authorEmail = $jConfig->get('mailfrom');
             }
         }
         $document->addItem($item);
     }
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:51,代码来源:view.feed.php

示例3: formatConversationReplies

 /**
  * Responsible to format message replies.
  *
  * @since	3.0
  * @access	public
  * @param	Array 	An array of result.
  */
 public static function formatConversationReplies(&$replies)
 {
     if (!$replies) {
         return false;
     }
     foreach ($replies as &$reply) {
         $reply->creator = DiscussHelper::getTable('Profile');
         $reply->creator->load($reply->created_by);
         $reply->message = DiscussHelper::parseContent($reply->message);
         $reply->lapsed = DiscussHelper::getHelper('Date')->getLapsedTime($reply->created);
     }
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:19,代码来源:helper.php

示例4: ajaxSubmitReply


//.........这里部分代码省略.........
         $tempContent = $table->content;
         $table->content = str_replace('@', '@', $tempContent);
         // process content plugins
         DiscussEventsHelper::importPlugin('content');
         DiscussEventsHelper::onContentPrepare('reply', $table);
         $table->event = new stdClass();
         $results = DiscussEventsHelper::onContentBeforeDisplay('reply', $table);
         $table->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = DiscussEventsHelper::onContentAfterDisplay('reply', $table);
         $table->event->afterDisplayContent = trim(implode("\n", $results));
     }
     $tpl = new DiscussThemes();
     $category = DiscussHelper::getTable('Category');
     $category->load($question->category_id);
     $table->access = $table->getAccess($category);
     // Since the reply dont have any comments yet.
     $table->comments = array();
     $tpl->set('category', $category);
     $tpl->set('post', $table);
     $tpl->set('question', $parent);
     $tpl->set('isMine', DiscussHelper::isMine($parent->user_id));
     $tpl->set('isAdmin', DiscussHelper::isSiteAdmin());
     $tpl->set('isMainLocked', $isMainLocked);
     $recaptcha = '';
     $enableRecaptcha = $config->get('antispam_recaptcha', 0);
     $publicKey = $config->get('antispam_recaptcha_public');
     $html = $table->published == DISCUSS_ID_PENDING ? $tpl->fetch('post.reply.item.moderation.php') : $tpl->fetch('post.reply.item.php');
     //send notification to all comment's subscribers that want to receive notification immediately
     $notify = DiscussHelper::getNotification();
     $excludeEmails = array();
     $attachments = $table->getAttachments();
     $emailData['attachments'] = $attachments;
     $emailData['postTitle'] = $parent->title;
     $emailData['comment'] = DiscussHelper::parseContent($table->content);
     $emailData['commentAuthor'] = $my->id ? $creator->getName() : $table->poster_name;
     $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $parent->id, false, true);
     $emailContent = $table->content;
     $isEditing = $isNew == true ? false : true;
     $emailContent = DiscussHelper::bbcodeHtmlSwitcher($table, 'reply', $isEditing);
     $emailContent = $question->trimEmail($emailContent);
     $emailData['replyContent'] = $emailContent;
     $emailData['replyAuthor'] = $my->id ? $creator->getName() : $table->poster_name;
     $emailData['replyAuthorAvatar'] = $creator->getAvatar();
     $emailData['post_id'] = $parent->id;
     $emailData['cat_id'] = $parent->category_id;
     $subscriberEmails = array();
     if (($config->get('main_sitesubscription') || $config->get('main_postsubscription')) && $config->get('notify_subscriber') && $table->published == DISCUSS_ID_PUBLISHED) {
         $emailData['emailTemplate'] = 'email.subscription.reply.new.php';
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
         $posterEmail = $post['poster_email'] ? $post['poster_email'] : $my->email;
         // Get the emails of user who subscribe to this post only
         // This does not send to subscribers whom subscribe to site and category
         $subcribersEmails = DiscussHelper::getHelper('Mailer')->notifyThreadSubscribers($emailData, array($posterEmail, $my->email));
         $excludeEmails[] = $posterEmail;
         $excludeEmails = array_merge($excludeEmails, $subcribersEmails);
         $excludeEmails = array_unique($excludeEmails);
     }
     //notify post owner.
     $postOwnerId = $parent->user_id;
     $postOwner = JFactory::getUser($postOwnerId);
     $ownerEmail = $postOwner->email;
     if ($parent->user_type != 'member') {
         $ownerEmail = $parent->poster_email;
     }
     // Notify Owner
     // if reply under moderation, send owner a notification.
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:67,代码来源:view.ajax.php

示例5: display

 public function display($tmpl = null)
 {
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $config = DiscussHelper::getConfig();
     $category = JRequest::getInt('category_id', 0);
     // Add breadcrumbs
     $this->setPathway(JText::_('COM_EASYDISCUSS_SEARCH'));
     DiscussHelper::setPageTitle();
     // Set the meta of the page.
     DiscussHelper::setMeta();
     $query = JRequest::getString('query', '');
     $limitstart = null;
     $posts = null;
     $pagination = null;
     if (!empty($query)) {
         $searchModel = DiscussHelper::getModel('Search');
         $posts = $searchModel->getData(true, 'latest', null, 'allposts', $category);
         $pagination = $searchModel->getPagination(0, 'latest', 'allposts', $category);
         $posts = DiscussHelper::formatPost($posts, true);
         $badgesTable = DiscussHelper::getTable('Profile');
         if (count($posts) > 0) {
             $searchworda = preg_replace('#\\xE3\\x80\\x80#s', ' ', $query);
             $searchwords = preg_split("/\\s+/u", $searchworda);
             $needle = $searchwords[0];
             $searchwords = array_unique($searchwords);
             for ($i = 0; $i < count($posts); $i++) {
                 $row =& $posts[$i];
                 if (!$row->isProtected()) {
                     if ($config->get('layout_editor') != 'bbcode') {
                         $introtext = strip_tags($row->content);
                         $introtext = preg_replace('/\\s+/', ' ', $introtext);
                     } else {
                         $introtext = preg_replace('/\\s+/', ' ', strip_tags(DiscussHelper::parseContent($row->content)));
                         // clean it to 1 liner
                     }
                     $pos = strpos($introtext, $needle);
                     if ($pos !== false) {
                         $text = '...';
                         $startpos = $pos - 10 >= 0 ? $pos - 10 : 0;
                         //$endpos     = ( $pos - 10 ) >= 0 ? 10 : JString::strlen($needle) + 1;
                         $endpos = $pos - 10 >= 0 ? 10 : $pos - $startpos;
                         $front = JString::substr($introtext, $startpos, $endpos);
                         if (JString::strlen($introtext) > $endpos) {
                             $endpos = $pos + JString::strlen($needle);
                             $end = JString::substr($introtext, $endpos, 10);
                             if (JString::strlen($front) > 0) {
                                 $text = $text . $front;
                             }
                             $text = $text . $needle;
                             if (JString::strlen($end) > 0) {
                                 $text = $text . $end . '...';
                             }
                         } else {
                             $text = $front;
                         }
                         $introtext = $text;
                     }
                 } else {
                     //password protected content.
                     $introtext = $row->content;
                     // when come to here, the content is already contain the password input form ( via formatPost function.)
                 }
                 //$introtext	= JString::substr($introtext, 0, $config->get( 'layout_introtextlength' ));
                 $searchRegex = '#(';
                 $x = 0;
                 foreach ($searchwords as $k => $hlword) {
                     $searchRegex .= $x == 0 ? '' : '|';
                     $searchRegex .= preg_quote($hlword, '#');
                     $x++;
                 }
                 $searchRegex .= '(?!(?>[^<]*(?:<(?!/?a\\b)[^<]*)*)</a>))#iu';
                 $row->title = preg_replace($searchRegex, '<span class="highlight">\\0</span>', $row->title);
                 $row->introtext = $row->isProtected() ? $introtext : preg_replace($searchRegex, '<span class="highlight">\\0</span>', $introtext);
                 //display password input form.
                 if ($row->isProtected()) {
                     $row->content = $row->content;
                     // when come to here, the content is already contain the password input form ( via formatPost function.)
                 } else {
                     $row->content = preg_replace($searchRegex, '<span class="highlight">\\0</span>', $introtext);
                 }
                 $badgesTable->load($row->user->id);
                 $row->badges = $badgesTable->getBadges();
             }
         }
     }
     $tpl = new DiscussThemes();
     $tpl->set('query', $query);
     $tpl->set('posts', $posts);
     $tpl->set('paginationType', DISCUSS_SEARCH_TYPE);
     $tpl->set('pagination', $pagination);
     $tpl->set('parent_id', $query);
     echo $tpl->fetch('search.php');
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:95,代码来源:view.html.php


注:本文中的DiscussHelper::parseContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。