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


PHP EasyBlogHelper::removeFeaturedImage方法代码示例

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


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


//.........这里部分代码省略.........
         $document->setTitle($blog->title . ' - ' . $pageTitle);
     }
     // There is a possibility that the intro is hidden in the entry view, so we need to get this data.
     $rawIntroText = $blog->intro;
     // @rule: Process microblog post
     if ($blog->source) {
         EasyBlogHelper::formatMicroBlog($blog);
     }
     // 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: Process adsense codes.
     $blog->intro = EasyBlogGoogleAdsense::processsAdsenseCode($blog->intro, $blog->created_by);
     $blog->content = EasyBlogGoogleAdsense::processsAdsenseCode($blog->content, $blog->created_by);
     // @trigger: onEasyBlogPrepareContent
     EasyBlogHelper::triggerEvent('easyblog.prepareContent', $blog, $params, $limitstart);
     // @rule: Hide introtext if necessary
     if ($config->get('main_hideintro_entryview') && !empty($blog->content)) {
         $blog->intro = '';
     }
     //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;
     // @legacy: since 3.5 has blog images, we can remove this in the future.
     // Remove first image for featured blogs
     if ($blog->isFeatured()) {
         $blog->content = EasyBlogHelper::removeFeaturedImage($blog->content);
     }
     $isFeatured = EasyBlogHelper::isFeatured('post', $blog->id);
     /* Post Tags */
     $modelPT = $this->getModel('PostTag');
     $tags = $modelPT->getBlogTags($blog->id);
     //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);
     }
     // @rule: Set the author object into the table.
     $blog->author = $blogger;
     $blog->blogger = $blogger;
     // @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);
     $blog->intro = EasyBlogHelper::getHelper('Album')->process($blog->intro, $blog->created_by);
     $blog->content = EasyBlogHelper::getHelper('Album')->process($blog->content, $blog->created_by);
     //onAfterDisplayTitle, onBeforeDisplayContent, onAfterDisplayContent trigger start
     $blog->event = new stdClass();
     $blog->introtext = $blog->intro;
     $blog->text = $blog->content;
     // @trigger: onAfterDisplayTitle / onContentAfterTitle
     $results = EasyBlogHelper::triggerEvent('afterDisplayTitle', $blog, $params, $limitstart);
     $blog->event->afterDisplayTitle = JString::trim(implode("\n", $results));
开发者ID:Tommar,项目名称:vino2,代码行数:67,代码来源:view.html.php


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