本文整理汇总了PHP中EasyBlogHelper::isFeatured方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::isFeatured方法的具体用法?PHP EasyBlogHelper::isFeatured怎么用?PHP EasyBlogHelper::isFeatured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::isFeatured方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) {
//.........这里部分代码省略.........
示例2: isFeatured
/**
* Determines whether the blogger is a featured blogger
**/
function isFeatured()
{
return EasyBlogHelper::isFeatured('blogger', $this->id);
}
示例3: listItemTask
echo $contributionDisplay;
?>
</td>
<td align="center">
<a href="javascript:void(0);" onclick="return listItemTask('cb<?php
echo $i;
?>
','<?php
echo EasyBlogHelper::isFeatured(EBLOG_FEATURED_BLOG, $row->id) ? 'unfeature' : 'feature';
?>
')">
<img src="<?php
echo JURI::root();
?>
administrator/components/com_easyblog/assets/images/<?php
echo EasyBlogHelper::isFeatured(EBLOG_FEATURED_BLOG, $row->id) ? 'default.png' : 'nodefault.png';
?>
" width="16" height="16" border="0" />
</a>
</td>
<td align="center">
<?php
if ($row->published == 2) {
?>
<img src="<?php
echo JURI::base() . 'components/com_easyblog/assets/images/schedule.png';
?>
" border="0" alt="<?php
echo JText::_('COM_EASYBLOG_SCHEDULED');
?>
" />
示例4: 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.
//.........这里部分代码省略.........
示例5: statistic
function statistic()
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
$sort = JRequest::getCmd('sort', 'latest');
$id = JRequest::getInt('id', 0);
//setting pathway
$pathway = $mainframe->getPathway();
$this->setPathway(JText::_('COM_EASYBLOG_TEAMBLOG'), EasyBlogRouter::_('index.php?option=com_easyblog&view=teamblog'));
$id = JRequest::getInt('id', 0);
if ($id == 0) {
echo JText::_('COM_EASYBLOG_TEAMBLOG_INVALID_ID');
return;
}
// set meta tags for teamblog view
EasyBlogHelper::setMeta($id, META_TYPE_TEAM);
//stats type
$statType = JRequest::getString('stat', '');
$statId = $statType == 'tag' ? JRequest::getString('tagid', '') : JRequest::getString('catid', '');
$statObject = null;
if ($statType == 'category') {
$statObject = EasyBlogHelper::getTable('Category', 'Table');
$statObject->load($statId);
} else {
$statObject = EasyBlogHelper::getTable('Tag', 'Table');
$statObject->load($statId);
}
$team = EasyBlogHelper::getTable('TeamBlog', 'Table');
$team->load($id);
$team->avatar = $team->getAvatar();
$gid = EasyBlogHelper::getUserGids();
$isMember = $team->isMember($my->id, $gid);
//check if the logged in user a teammember when the team set to member only.
if ($team->access == EBLOG_TEAMBLOG_ACCESS_MEMBER) {
$isMember = $team->isMember($my->id, $gid);
}
$team->isMember = $isMember;
// check if team description is emtpy or not. if yes, show default message.
if (empty($team->description)) {
$team->description = JText::_('COM_EASYBLOG_TEAMBLOG_NO_DESCRIPTION');
}
//add the pathway for teamblog
$this->setPathway($team->title, '');
$tbModel = $this->getModel('TeamBlogs');
$model = $this->getModel('Blog');
$blogs = $model->getBlogsBy('teamblog', $team->id);
$blogs = EasyBlogHelper::formatBlog($blogs);
$pagination = $model->getPagination();
//now get the teams info
$members = $tbModel->getTeamMembers($team->id);
$teamMembers = EasyBlogHelper::formatTeamMembers($members);
$isFeatured = EasyBlogHelper::isFeatured('teamblog', $team->id);
$pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
$pageNumber = $pagination->get('pages.current');
$pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
$document->setTitle($team->title . $pageText . $pageTitle);
EasyBlogHelper::storeSession($team->id, 'EASYBLOG_TEAMBLOG_ID');
//var_dump($blogs);exit;
$tpl = new CodeThemes();
$tpl->set('team', $team);
$tpl->set('teamMembers', $teamMembers);
$tpl->set('data', $blogs);
$tpl->set('isFeatured', $isFeatured);
$tpl->set('pagination', $pagination->getPagesLinks());
$tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
$tpl->set('config', $config);
$tpl->set('my', $my);
$tpl->set('acl', $acl);
$tpl->set('statType', $statType);
$tpl->set('statObject', $statObject);
echo $tpl->fetch('blog.teamblogs.php');
}
示例6: display
//.........这里部分代码省略.........
} else {
$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);
示例7: listItemTask
?>
<?php
}
?>
</td>
<td class="nowrap hidden-phone center">
<a class="btn btn-micro jgrid" onclick="return listItemTask('cb<?php
echo $i;
?>
','<?php
echo EasyBlogHelper::isFeatured(EBLOG_FEATURED_BLOG, $row->id) ? 'unfeature' : 'feature';
?>
')">
<?php
if (EasyBlogHelper::isFeatured(EBLOG_FEATURED_BLOG, $row->id)) {
?>
<i class="icon-star"></i>
<?php
} else {
?>
<i class="icon-star-empty"></i>
<?php
}
?>
</a>
</td>
<td class="nowrap hidden-phone center">
<a onclick="return listItemTask('cb<?php
echo $i;