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


PHP EasyBlogHelper::triggerEvent方法代码示例

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


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

示例1: formatBlog

 /**
  * Responsible to format the blog posts and append neccessary data.
  *
  * @access	public
  * @param	Array	$data			An array of blog posts.
  * @param	boolean	$loadComments	Determines whether or not to load the comments into the object.
  * @param	boolean $removeFeaturedImage	Determines whether or not to remove featured image from the content.
  * @param	boolean	$loadVideo		If true, video codes will be processed.
  * @param	boolean	$frontpage		Determines whether this is for the front page or not.
  * @return	Array	An array of formatted blog posts.
  */
 public static function formatBlog($data, $loadComments = false, $removeFeaturedImage = true, $loadVideo = true, $frontpage = false, $loadGallery = true)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams('com_easyblog');
     $model = EasyBlogHelper::getModel('Blog');
     $config = EasyBlogHelper::getConfig();
     // @rule: If nothing is supplied, just return the empty data.
     if (empty($data)) {
         return $data;
     }
     // @task: Get the tags relations model.
     $modelPT = EasyBlogHelper::getModel('PostTag');
     // @task : Resultset data
     $result = array();
     for ($i = 0; $i < count($data); $i++) {
         $row =& $data[$i];
         $blog = EasyBlogHelper::getTable('Blog');
         $blog->bind($row);
         // @task: Since the $blog object does not contain 'team_id', we need to set this here.
         if (isset($row->team_id)) {
             $blog->team_id = $row->team_id;
         }
         // @task: Since the $blog object does not contain 'category', we need to set this here.
         $blog->category = $row->category;
         $blog->featuredImage = isset($row->featuredImage) ? $row->featuredImage : '';
         $profile = EasyBlogHelper::getTable('Profile', 'Table');
         $profile->load($blog->created_by);
         // @legacy The following variables are no longer used in 3.5
         // @since 3.5
         $blog->avatar = $profile->getAvatar();
         $blog->avatarLink = $profile->getProfileLink();
         $blog->displayName = $profile->getName();
         // @Assign dynamic properties that must exist everytime formatBlog is called
         // We can't rely on ->author because CB plugins would mess things up.
         $blog->author = $profile;
         $blog->blogger = $profile;
         $blog->isFeatured = EasyBlogHelper::isFeatured('post', $blog->id);
         $blog->category = empty($blog->category) ? JText::_('COM_EASYBLOG_UNCATEGORIZED') : JText::_($blog->category);
         // @task: Detect password protections.
         $requireVerification = false;
         $tmpTitle = $blog->title;
         if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
             $blog->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $blog->title);
             $requireVerification = true;
         }
         // @rule: If user already authenticated with the correct password, we will hide the password
         if ($requireVerification && EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
             $blog->title = $tmpTitle;
             $blog->blogpassword = '';
         }
         // @rule: Initialize all variables
         $blog->videos = array();
         $blog->galleries = array();
         $blog->albums = array();
         $blog->audios = array();
         // @rule: Before anything get's processed we need to format all the microblog posts first.
         if (!empty($blog->source)) {
             self::formatMicroblog($blog);
         }
         // @rule: Detect if the content requires a read more link.
         $blog->readmore = EasyBlogHelper::requireReadmore($blog);
         // @rule: Remove any adsense codes from the content.
         $blog->intro = EasyBlogGoogleAdsense::stripAdsenseCode($blog->intro);
         $blog->content = EasyBlogGoogleAdsense::stripAdsenseCode($blog->content);
         // @rule: Content truncations.
         EasyBlogHelper::truncateContent($blog, $loadVideo, $frontpage, $loadGallery);
         // @task: Legacy fix for blog posts prior to 3.5
         // Remove first image from featured post
         if ($removeFeaturedImage && $blog->isFeatured) {
             $blog->text = EasyBlogHelper::removeFeaturedImage($blog->text);
         }
         // @rule: Add nofollow tags if necessary
         if ($config->get('main_anchor_nofollow')) {
             $blog->text = self::addNoFollow($blog->text);
         }
         // @rule: $limitstart variable is required by content plugins.
         $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
         // @trigger: onEasyBlogPrepareContent
         JPluginHelper::importPlugin('easyblog');
         EasyBlogHelper::triggerEvent('easyblog.prepareContent', $blog, $params, $limitstart);
         $blog->introtext = $blog->intro;
         // @trigger: onPrepareContent / onContentPrepare
         EasyBlogHelper::triggerEvent('prepareContent', $blog, $params, $limitstart);
         $blog->excerpt = $blog->introtext;
         $blog->content = $blog->text;
         //onPrepareContent trigger end
         // @rule: Assign tags to the custom properties.
         $blog->tags = $modelPT->getBlogTags($blog->id);
         // @rule: Assign total comments in this blog post.
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:helper.php

示例2: getCommentCount

    /**
     * Retrieves the comment count for the specific blog
     *
     * @param	int	$blogId	The blog id.
     **/
    public static function getCommentCount($blog)
    {
        $blogId = $blog->id;
        $config = EasyBlogHelper::getConfig();
        // If multiple comments, we output a common link
        if ($config->get('main_comment_multiple')) {
            return false;
        }
        if ($config->get('comment_komento')) {
            $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
            if (JFile::exists($file)) {
                require_once $file;
                $commentsModel = Komento::getModel('comments');
                $commentCount = $commentsModel->getCount('com_easyblog', $blog->id);
                return $commentCount;
            }
        }
        $easysocial = EasyBlogHelper::getHelper('EasySocial');
        if ($config->get('comment_easysocial') && $easysocial->exists()) {
            return $easysocial->getCommentCount($blog);
        }
        if ($config->get('comment_compojoom')) {
            $file = JPATH_ROOT . '/administrator/components/com_comment/plugin/com_easyblog/josc_com_easyblog.php';
            if (JFile::exists($file)) {
                require_once $file;
                return CommentEasyBlog::output($blog, array(), true);
            }
            $file = JPATH_ROOT . '/components/com_comment/helpers/utils.php';
            if (JFile::exists($file)) {
                JLoader::discover('ccommentHelper', JPATH_ROOT . '/components/com_comment/helpers');
                return ccommentHelperUtils::commentInit('com_easyblog', $blog);
            }
        }
        if ($config->get('intensedebate')) {
            return false;
        }
        if ($config->get('comment_disqus')) {
            static $disqus = false;
            if (!$disqus) {
                ob_start();
                ?>
					var disqus_shortname = '<?php 
                echo $config->get('comment_disqus_code');
                ?>
';
					(function () {
					var s = document.createElement('script'); s.async = true;
					s.type = 'text/javascript';
					s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
					(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
					}());
				<?php 
                $contents = ob_get_contents();
                ob_end_clean();
                JFactory::getDocument()->addScriptDeclaration($contents);
                $disqus = true;
            }
            $string = '<!-- Disqus -->';
            $string .= '<span class="discus-comment">';
            $string .= '<a href="' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId) . '#disqus_thread"><span>' . JText::_('COM_EASYBLOG_COMMENTS') . '</span></a>';
            $string .= '</span>';
            return $string;
            // return false;
        }
        if ($config->get('comment_livefyre')) {
            return false;
        }
        if ($config->get('comment_jomcomment')) {
            $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jomcomment' . DIRECTORY_SEPARATOR . 'helper' . DIRECTORY_SEPARATOR . 'minimal.helper.php';
            jimport('joomla.filesystem.file');
            if (!JFile::exists($file)) {
                return false;
            }
            require_once $file;
            return jcCountComment($blogId, 'com_easyblog');
        }
        $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jcomments' . DIRECTORY_SEPARATOR . 'jcomments.php';
        if ($config->get('comment_jcomments') && JFile::exists($file)) {
            $db = EasyBlogHelper::db();
            $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__jcomments') . ' ' . 'WHERE ' . $db->nameQuote('object_id') . '=' . $db->Quote($blogId) . ' ' . 'AND ' . $db->nameQuote('object_group') . '=' . $db->Quote('com_easyblog') . ' ' . 'AND ' . $db->nameQuote('published') . '=' . $db->Quote(1);
            $db->setQuery($query);
            $total = $db->loadResult();
            return $total;
        }
        if ($config->get('comment_rscomments')) {
            return false;
        }
        if ($config->get('comment_facebook')) {
            return false;
        }
        // @task: Let's allow the plugin to also trigger the comment count.
        $params = EasyBlogHelper::getRegistry();
        $result = EasyBlogHelper::triggerEvent('easyblog.commentCount', $blog, $params, 0);
        $count = trim(implode(" ", $result));
        if (!empty($count)) {
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:comment.php

示例3: preview

 function preview()
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $acl = EasyBlogACLHelper::getRuleSet();
     $config = EasyBlogHelper::getConfig();
     $document = JFactory::getDocument();
     $my = JFactory::getUser();
     $params = $mainframe->getParams('com_easyblog');
     if (!EasyBlogHelper::isLoggedIn()) {
         EasyBlogHelper::showLogin();
         return;
     }
     $draftId = JRequest::getVar('draftid', '');
     $draft = EasyBlogHelper::getTable('Draft', 'Table');
     $draft->load($draftId);
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     $blog->bind($draft);
     $blogger = null;
     if ($blog->created_by != 0) {
         $blogger = EasyBlogHelper::getTable('Profile', 'Table');
         $blogger->load($blog->created_by);
     }
     // @rule: Set the author object into the table.
     $blog->author = $blogger;
     $blog->blogger = $blogger;
     $blogId = empty($draft->entry_id) ? $draft->id : $draft->entry_id;
     $limitstart = '0';
     $notice = '';
     $team = '';
     $blog->tags = empty($draft->tags) ? array() : $this->bindTags(explode(',', $draft->tags));
     // metas
     $meta = new stdClass();
     $meta->id = '';
     $meta->keywords = $draft->metakey;
     $meta->description = $draft->metadesc;
     $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
     $document->setTitle($blog->title . $pageTitle);
     // process the video here if nessary
     $blog->intro = EasyBlogHelper::getHelper('Videos')->processVideos($blog->intro);
     $blog->content = EasyBlogHelper::getHelper('Videos')->processVideos($blog->content);
     // @rule: Process audio files.
     $blog->intro = EasyBlogHelper::getHelper('Audio')->process($blog->intro);
     $blog->content = EasyBlogHelper::getHelper('Audio')->process($blog->content);
     // @rule: Before any trigger happens, try to replace the gallery first and append it at the bottom.
     $blog->intro = EasyBlogHelper::getHelper('Gallery')->process($blog->intro, $blog->created_by);
     $blog->content = EasyBlogHelper::getHelper('Gallery')->process($blog->content, $blog->created_by);
     // Process jomsocial album's.
     $blog->intro = EasyBlogHelper::getHelper('Album')->process($blog->intro, $blog->created_by);
     $blog->content = EasyBlogHelper::getHelper('Album')->process($blog->content, $blog->created_by);
     // @trigger: onEasyBlogPrepareContent
     EasyBlogHelper::triggerEvent('easyblog.prepareContent', $blog, $params, $limitstart);
     //onPrepareContent trigger start
     $blog->introtext = $blog->intro;
     $blog->text = $blog->intro . $blog->content;
     // @trigger: onEasyBlogPrepareContent
     EasyBlogHelper::triggerEvent('prepareContent', $blog, $params, $limitstart);
     $blog->intro = $blog->introtext;
     $blog->content = $blog->text;
     $isFeatured = false;
     //page setup
     $blogHtml = '';
     $commentHtml = '';
     $blogHeader = '';
     $blogFooter = '';
     $adsenseHtml = '';
     $trackbackHtml = '';
     $blogger = null;
     if ($blog->created_by != 0) {
         $blogger = EasyBlogHelper::getTable('Profile', 'Table');
         $blogger->load($blog->created_by);
     }
     //onAfterDisplayTitle, onBeforeDisplayContent, onAfterDisplayContent trigger start
     $blog->event = new stdClass();
     // @trigger: onAfterDisplayTitle / onContentAfterTitle
     $results = EasyBlogHelper::triggerEvent('afterDisplayTitle', $blog, $params, $limitstart);
     $blog->event->afterDisplayTitle = JString::trim(implode("\n", $results));
     // @trigger: onBeforeDisplayContent / onContentBeforeDisplay
     $results = EasyBlogHelper::triggerEvent('beforeDisplayContent', $blog, $params, $limitstart);
     $blog->event->beforeDisplayContent = JString::trim(implode("\n", $results));
     // @trigger: onAfterDisplayContent / onContentAfterDisplay
     EasyBlogHelper::triggerEvent('afterDisplayContent', $blog, $params, $limitstart);
     $blog->event->afterDisplayContent = JString::trim(implode("\n", $results));
     if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id)) {
         $this->setPathway($blogger->getName(), $blogger->getLink());
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('entry', $blog->id)) {
         $this->setPathway($blog->title, '');
     }
     $blog->totalComments = 0;
     // Facebook Like integrations
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'facebook.php';
     $facebookLike = EasyBlogFacebookLikes::getLikeHTML($blog);
     $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     //get blog navigation object
     $blogNav = EasyBlogHelper::getBlogNavigation($blog->id, $blog->created, $team, 'team');
     //$team
     $prevLink = array();
     if (!empty($blogNav['prev'])) {
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:view.html.php


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