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


PHP EasyBlogHelper::makeFeatured方法代码示例

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


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

示例1: store

 public function store($log = true)
 {
     // @rule: Load language file from the front end.
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     $config = EasyBlogHelper::getConfig();
     $under_approval = false;
     if (isset($this->under_approval)) {
         $under_approval = true;
         // now we need to reset this variable from the blog object.
         unset($this->under_approval);
     }
     // @trigger: onBeforeSave
     $this->triggerBeforeSave();
     // @rule: Determine if this record is new or not.
     if (empty($this->isnew)) {
         $isNew = empty($this->id) ? true : false;
     } else {
         $isNew = true;
     }
     // @rule: Get the rulesets for this user.
     $acl = EasyBlogACLHelper::getRuleSet();
     // @rule: Process badword filters for title here.
     $blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->title);
     if ($blockedWord !== false) {
         $this->setError(JText::sprintf('COM_EASYBLOG_BLOG_TITLE_CONTAIN_BLOCKED_WORDS', $blockedWord));
         return false;
     }
     // @rule: Check for minimum words in the content if required.
     if ($config->get('main_post_min')) {
         $minimum = $config->get('main_post_length');
         $total = JString::strlen(strip_tags($this->intro . $this->content));
         if ($total < $minimum) {
             $this->setError(JText::sprintf('COM_EASYBLOG_CONTENT_LESS_THAN_MIN_LENGTH', $minimum));
             return false;
         }
     }
     // @rule: Check for invalid title
     if (empty($this->title) || $this->title == JText::_('COM_EASYBLOG_DASHBOARD_WRITE_DEFAULT_TITLE')) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_TITLE_ERROR'));
         return false;
     }
     // @rule: For edited blogs, ensure that they have permissions to edit it.
     if (!$isNew && $this->created_by != JFactory::getUser()->id && !EasyBlogHelper::isSiteAdmin() && empty($acl->rules->moderate_entry)) {
         if (!class_exists('EasyBlogModelTeamBlogs')) {
             jimport('joomla.application.component.model');
             JLoader::import('blog', EBLOG_ROOT . DIRECTORY_SEPARATOR . 'models');
         }
         // @task: Only throw error when this blog post is not a team blog post and it's not owned by the current logged in user.
         JModel::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'models');
         $model = JModel::getInstance('TeamBlogs', 'EasyBlogModel');
         $contribution = $model->getBlogContributed($this->id);
         if (!$contribution || !$model->checkIsTeamAdmin(JFactory::getUser()->id, $contribution->team_id)) {
             $this->setError(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_BLOG'));
             return false;
         }
     }
     // @rule: Every blog post must be assigned to a category
     if (empty($this->category_id)) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_CATEGORY_ERROR'));
         return false;
     }
     // Filter / strip contents that are not allowed
     $filterTags = EasyBlogHelper::getHelper('Acl')->getFilterTags();
     $filterAttributes = EasyBlogHelper::getHelper('Acl')->getFilterAttributes();
     // @rule: Apply filtering on contents
     jimport('joomla.filter.filterinput');
     $inputFilter = JFilterInput::getInstance($filterTags, $filterAttributes, 1, 1, 0);
     $inputFilter->tagBlacklist = $filterTags;
     $inputFilter->attrBlacklist = $filterAttributes;
     if (count($filterTags) > 0 && !empty($filterTags[0]) || count($filterAttributes) > 0 && !empty($filterAttributes[0])) {
         $this->intro = $inputFilter->clean($this->intro);
         $this->content = $inputFilter->clean($this->content);
     }
     // @rule: Process badword filters for content here.
     $blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->intro . $this->content);
     if ($blockedWord !== false) {
         $this->setError(JText::sprintf('COM_EASYBLOG_BLOG_POST_CONTAIN_BLOCKED_WORDS', $blockedWord));
         return false;
     }
     // @rule: Test for the empty-ness
     if (empty($this->intro) && empty($this->content)) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_CONTENT_ERROR'));
     }
     // alway set this to false no matter what! TODO: remove this column.
     $this->ispending = '0';
     $state = parent::store();
     $source = JRequest::getVar('blog_contribute_source', 'easyblog');
     // @trigger: onBeforeSave
     $this->triggerAfterSave();
     // if this is blog edit, then we should see the column isnew to determine
     // whether the post is really new or not.
     if (!$isNew) {
         $isNew = $this->isnew;
     }
     // @task: If auto featured is enabled, we need to feature the blog post automatically since the blogger is featured.
     if ($config->get('main_autofeatured', 0) && EasyBlogHelper::isFeatured('blogger', $this->created_by) && !EasyBlogHelper::isFeatured('post', $this->id)) {
         EasyBlogHelper::makeFeatured('post', $this->id);
     }
     // @task: This is when the blog is either created or updated.
     if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $log) {
//.........这里部分代码省略.........
开发者ID:alexinteam,项目名称:joomla3,代码行数:101,代码来源:blogs.php

示例2: toggleFeatured

 /**
  * Toggle featured bloggers.
  *
  * @since	3.5
  * @access	public
  */
 public function toggleFeatured()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('user');
     $mainframe = JFactory::getApplication();
     $records = JRequest::getVar('cid', '');
     $message = '';
     $task = JRequest::getVar('task');
     if (empty($records)) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_INVALID_BLOGGER_ID'), 'error');
         $mainframe->redirect('index.php?option=com_easyblog&view=users');
         $mainframe->close();
     }
     foreach ($records as $record) {
         if ($task == 'unfeature') {
             EasyBlogHelper::removeFeatured(EBLOG_FEATURED_BLOGGER, $record);
             $message = JText::_('COM_EASYBLOG_BLOGGER_UNFEATURED_SUCCESSFULLY');
         } else {
             EasyBlogHelper::makeFeatured(EBLOG_FEATURED_BLOGGER, $record);
             $message = JText::_('COM_EASYBLOG_BLOGGER_FEATURED_SUCCESSFULLY');
         }
     }
     $mainframe->enqueueMessage($message, 'message');
     $mainframe->redirect('index.php?option=com_easyblog&view=users');
     $mainframe->close();
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:34,代码来源:users.php

示例3: makeFeatured

 /**
  * Mark an item as featured
  *
  * @param	string	$type	The type of this item
  * @param	int		$postId	The unique id of the item
  *
  * @return	string	Json string
  **/
 function makeFeatured($type, $postId)
 {
     $ajax = new Ejax();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleset();
     // Only super admins can feature items
     if (!EasyBlogHelper::isSiteAdmin() && !$acl->rules->feature_entry) {
         $ajax->alert(JText::_('COM_EASYBLOG_NOT_ALLOWED'), '', '450');
         $ajax->send();
         return;
     }
     // Only non protected blog can be feature
     if ($config->get('main_password_protect')) {
         $blog = EasyBlogHelper::getTable('Blog', 'Table');
         $blog->load($postId);
         if (!empty($blog->blogpassword)) {
             $ajax->alert(JText::_('COM_EASYBLOG_PASSWORD_PROTECTED_CANNOT_BE_FEATURED'), '', '450');
             $ajax->send();
             return;
         }
     }
     EasyBlogHelper::makeFeatured($type, $postId);
     $idName = '';
     $message = '';
     switch ($type) {
         case 'blogger':
             $idName = '#blogger_title_' . $postId;
             $message = JText::_('COM_EASYBLOG_BLOGGER_FEATURED');
             break;
         case 'teamblog':
             $idName = '#teamblog_title_' . $postId;
             $message = JText::_('COM_EASYBLOG_TEAMBLOG_FEATURED');
             break;
         case 'post':
         default:
             $idName = '#title_' . $postId;
             $message = JText::_('COM_EASYBLOG_BLOG_FEATURED');
             break;
     }
     $ajax->alert($message, JText::_('COM_EASYBLOG_INFO'), '450', 'auto');
     $ajax->send();
     return;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:51,代码来源:view.ejax.php

示例4: _process


//.........这里部分代码省略.........
         $blogObj->created = !empty($row->created) ? $row->created : $date->toMySQL();
         $blogObj->modified = $date->toMySQL();
         $blogObj->title = $row->title;
         $blogObj->permalink = $row->alias;
         // Need to remap the access.
         $access = 0;
         if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
             switch ($row->access) {
                 case 1:
                     $access = 0;
                     break;
                 default:
                     $access = 1;
                     break;
             }
         } else {
             $access = $row->access == 2 ? 1 : $row->access;
         }
         $blogObj->private = $access;
         if (empty($row->fulltext)) {
             $blogObj->intro = '';
             $blogObj->content = $row->introtext;
         } else {
             $blogObj->intro = $row->introtext;
             $blogObj->content = $row->fulltext;
         }
         // joomla 3.0 intro imag properties.
         if (isset($row->images) && !empty($row->images)) {
             $joomlaImages = json_decode($row->images);
             if (isset($joomlaImages->image_intro) and !empty($joomlaImages->image_intro)) {
                 $imgTag = '<img';
                 if ($joomlaImages->image_intro_caption) {
                     $imgTag .= ' class="caption" title="' . htmlspecialchars($joomlaImages->image_intro_caption) . '"';
                 }
                 $imgTag .= ' src="' . htmlspecialchars($joomlaImages->image_intro) . '" alt="' . htmlspecialchars($joomlaImages->image_intro_alt) . '"/>';
                 $blogObj->intro = $imgTag . $blogObj->intro;
             }
             if (isset($joomlaImages->image_fulltext) and !empty($joomlaImages->image_fulltext)) {
                 $imgTag = '<img';
                 if ($joomlaImages->image_fulltext_caption) {
                     $imgTag .= ' class="caption" title="' . htmlspecialchars($joomlaImages->image_fulltext_caption) . '"';
                 }
                 $imgTag .= ' src="' . htmlspecialchars($joomlaImages->image_fulltext) . '" alt="' . htmlspecialchars($joomlaImages->image_fulltext_alt) . '"/>';
                 $blogObj->content = $imgTag . $blogObj->content;
             }
         }
         //translating the article state into easyblog publish status.
         $blogState = '';
         if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
             $blogState = $row->state == 2 || $row->state == -2 ? 0 : $row->state;
         } else {
             $blogState = $row->state == -1 ? 0 : $row->state;
         }
         $blogObj->published = $blogState;
         $blogObj->publish_up = !empty($row->publish_up) ? $row->publish_up : $date->toMySQL();
         $blogObj->publish_down = !empty($row->publish_down) ? $row->publish_down : $date->toMySQL();
         $blogObj->ordering = $row->ordering;
         $blogObj->hits = $row->hits;
         $blogObj->frontpage = 1;
         $blog->bind($blogObj);
         $blog->store();
         // Run jomcomment migration here.
         if ($jomcomment) {
             $this->migrateJomcomment($row->id, $blog->id, 'com_content');
         }
         //migrate meta description
         $this->_migrateContentMeta($row->metakey, $row->metadesc, $blog->id);
         //isfeatured! only applicable in joomla1.6
         if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
             if ($row->featured) {
                 EasyBlogHelper::makeFeatured('post', $blog->id);
             }
         }
         //update session value
         $migrateStat->blog++;
         $statUser = $migrateStat->user;
         $statUserObj = null;
         if (!isset($statUser[$profile->id])) {
             $statUserObj = new stdClass();
             $statUserObj->name = $profile->nickname;
             $statUserObj->blogcount = 0;
         } else {
             $statUserObj = $statUser[$profile->id];
         }
         $statUserObj->blogcount++;
         $statUser[$profile->id] = $statUserObj;
         $migrateStat->user = $statUser;
         $jSession->set('EBLOG_MIGRATOR_JOOMLA_STAT', $migrateStat, 'EASYBLOG');
         //log the entry into migrate table.
         $migrator = EasyBlogHelper::getTable('Migrate', 'Table');
         $migrator->content_id = $row->id;
         $migrator->post_id = $blog->id;
         $migrator->session_id = $jSession->getToken();
         $migrator->component = 'com_content';
         $migrator->store();
         $ejax->append('progress-status', JText::_('COM_EASYBLOG_MIGRATOR_MIGRATED_JOOMLA_ARTICLE') . ': ' . $row->id . JText::_('COM_EASYBLOG_MIGRATOR_EASYBLOG') . ': ' . $blog->id . '<br />');
         $ejax->script("ejax.load('migrators','_process','{$authorId}', '{$stateId}', '{$catId}', '{$sectionId}', '{$myblogSection}','{$jomcomment}');");
     }
     $ejax->send();
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:101,代码来源:view.ejax.php


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