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


PHP EBR::isBloggerMode方法代码示例

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


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

示例1: getToolbar

 /**
  * Retrieves the toolbar for the site.
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getToolbar()
 {
     // Get the current view
     $view = $this->input->get('view', '', 'cmd');
     // Get a list of available views
     $views = JFolder::folders(JPATH_COMPONENT . '/views');
     // Get the active view name
     $active = $this->getName();
     // If the current active view doesn't exist on our known views, set the latest to be active by default.
     if (!in_array($active, $views)) {
         $active = 'latest';
     }
     // Rebuild the views
     $tmp = new stdClass();
     foreach ($views as $key) {
         $tmp->{$key} = false;
     }
     // Reset back the views to the tmp variable
     $views = $tmp;
     // Set the active menu
     if (isset($views->{$active})) {
         $views->{$active} = true;
     }
     // Get toolbar stuffs
     $title = $this->config->get('main_title');
     $desc = $this->config->get('main_description');
     $desc = nl2br($desc);
     $authorId = '';
     // Entry view, we want to load the toolbar
     if ($active == 'entry') {
         $blog = EB::table('blog');
         $blog->load(JRequest::getInt('id'));
         $authorId = $blog->created_by;
     }
     // Blogger view, just get the id from the query
     if ($active == 'blogger') {
         $authorId = $this->input->get('id', 0, 'int');
     }
     // If the viewer is viewing a blogger, we'll need to display the header accordingly.
     if (($active == 'blogger' || $active == 'entry' && $this->config->get('layout_headers_respect_author')) && $authorId) {
         $author = EB::user($authorId);
         $title = $author->title ? $author->title : $title;
         $desc = $author->getDescription() ? $author->getDescription() : $desc;
     }
     // If the viewer is viewing a team
     if ($active == 'teamblog') {
         $team = EB::table('Teamblog');
         $team->load(JRequest::getInt('id'));
         $title = $team->title ? JText::_($team->title) : $title;
         $desc = $team->getDescription() ? $team->getDescription() : $desc;
     }
     // Get the current menu id
     $itemId = $this->input->get('Itemid', 0, 'int');
     // Determines if the heading should be displayed
     $activeMenu = JFactory::getApplication()->getMenu()->getActive();
     $params = new JRegistry();
     if ($activeMenu) {
         $params = $activeMenu->params;
     }
     $heading = $params->get('show_page_heading', '');
     if ($heading) {
         $title = $params->get('page_heading');
     }
     // Get the total subscribers on the site
     $model = EB::model('Subscription');
     // Load up the subscription record for the current user.
     $subscription = EB::table('Subscriptions');
     if (!$this->my->guest) {
         $subscription->load(array('email' => $this->my->email, 'utype' => 'site'));
     }
     // Determines if this should be on blogger mode
     $bloggerMode = EBR::isBloggerMode();
     // Build the return url
     $return = base64_encode(EBR::_('index.php?option=com_easyblog', false));
     // Load the theme object
     $theme = EB::template();
     $theme->set('view', $view);
     $theme->set('subscription', $subscription);
     $theme->set('bloggerMode', $bloggerMode);
     $theme->set('heading', $heading);
     $theme->set('return', $return);
     $theme->set('title', $title);
     $theme->set('desc', $desc);
     $theme->set('views', $views);
     $output = $theme->output('site/toolbar/default');
     return $output;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:95,代码来源:views.php

示例2: getArchivePostByMonth

 /**
  * Retrieves a list of blog posts by specific month
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getArchivePostByMonth($month = '', $year = '', $showPrivate = false)
 {
     $db = EB::db();
     $user = JFactory::getUser();
     $config = EB::config();
     // used for privacy
     $queryWhere = '';
     $queryExclude = '';
     $queryExcludePending = '';
     $excludeCats = array();
     if ($user->id == 0) {
         $showPrivate = false;
     }
     // Blog privacy setting
     // @integrations: jomsocial privacy
     $privateBlog = '';
     if (EB::easysocial()->exists() && $config->get('integrations_easysocial_privacy') && !EB::isSiteAdmin()) {
         $esPrivacyQuery = EB::easysocial()->buildPrivacyQuery('a');
         $privateBlog .= $esPrivacyQuery;
     } else {
         if ($config->get('main_jomsocial_privacy') && EB::jomsocial()->exists() && !EB::isSiteAdmin()) {
             $friendsModel = CFactory::getModel('Friends');
             $friends = $friendsModel->getFriendIds($user->id);
             // Insert query here.
             $privateBlog .= ' AND (';
             $privateBlog .= ' (a.`access`= 0 ) OR';
             $privateBlog .= ' ( (a.`access` = 20) AND (' . $db->Quote($user->id) . ' > 0 ) ) OR';
             if (!$friends) {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( 1 = 2 ) ) OR';
             } else {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( a.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
             }
             $privateBlog .= ' ( (a.`access` = 40) AND ( a.' . $db->nameQuote('created_by') . '=' . $user->id . ') )';
             $privateBlog .= ' )';
         } else {
             if ($user->id == 0) {
                 $privateBlog .= ' AND a.`access` = ' . $db->Quote(0);
             }
         }
     }
     // Join the query ?
     $privateBlog = $showPrivate ? '' : $privateBlog;
     $isJSGrpPluginInstalled = false;
     $isJSGrpPluginInstalled = JPluginHelper::isEnabled('system', 'groupeasyblog');
     $isEventPluginInstalled = JPluginHelper::isEnabled('system', 'eventeasyblog');
     $isJSInstalled = false;
     // need to check if the site installed jomsocial.
     if (EB::jomsocial()->exists()) {
         $isJSInstalled = true;
     }
     $includeJSGrp = $isJSGrpPluginInstalled && $isJSInstalled ? true : false;
     $includeJSEvent = $isEventPluginInstalled && $isJSInstalled ? true : false;
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a');
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'a');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'a');
     }
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'a');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'a');
     }
     $contributeSQL .= ')';
     $queryWhere .= $contributeSQL;
     //get teamblogs id.
     $query = '';
     $extraSQL = '';
     // If this is on blogger mode, we need to only pick items from the blogger.
     $blogger = EBR::isBloggerMode();
     if ($blogger !== false) {
         $extraSQL = ' AND a.`created_by` = ' . $db->Quote($blogger);
     }
     $tzoffset = EB::date()->getOffSet(true);
     $query = 'SELECT a.*, DAY( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS day,';
     $query .= ' MONTH( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS month,';
     $query .= ' YEAR( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS year ';
     $query .= ' FROM ' . $db->nameQuote('#__easyblog_post') . ' as a';
     $query .= ' WHERE a.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED) . ' ';
     $query .= ' AND a.' . $db->quoteName('state') . ' = ' . $db->Quote(EASYBLOG_POST_NORMAL) . ' ';
     $query .= $privateBlog . ' ';
     $query .= ' AND (a.`created` > ' . $db->Quote($year . '-' . $month . '-01 00:00:00') . ' AND a.`created` < ' . $db->Quote($year . '-' . $month . '-31 23:59:59') . ') ';
     // If do not display private posts, we need to append additional queries here.
     if (!$showPrivate) {
         // sql for category access
         $catLib = EB::category();
         $catAccessSQL = $catLib->genAccessSQL('a.`id`');
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:archive.php

示例3: getPostNavigation

 /**
  * Retrieves the next post in line
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPostNavigation(EasyBlogPost $post, $navigationType)
 {
     $db = EB::db();
     $my = JFactory::getUser();
     $config = EB::config();
     $keys = array('prev', 'next');
     $nav = new stdClass();
     // Get the active menu
     $active = JFactory::getApplication()->getMenu()->getActive();
     $catAccess = array();
     $queryInclude = '';
     $teamId = $post->getTeamAssociation();
     $author = $post->getAuthor();
     // // If there is an active menu for EasyBlog, check if there's any filtering by categories
     // if ($active) {
     // 	$cats = EB::getCategoryInclusion($active->params->get('inclusion'));
     // 	if ($cats && !is_array($cats)) {
     // 		$cats = array($cats);
     // 	}
     // 	$catAccess['include'] = $cats;
     // }
     // // sql for category access
     // $catLib = EB::category();
     // $catAccessSQL = $catLib->genAccessSQL( 'a.`id`', $catAccess);
     foreach ($keys as $key) {
         $query = array();
         $query[] = 'SELECT a.`id`, a.`title`';
         $query[] = ' FROM `#__easyblog_post` AS `a`';
         $query[] = ' WHERE a.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
         $query[] = ' AND a.`state` = ' . $db->Quote(EASYBLOG_POST_NORMAL);
         // EasySocial integrations
         $query[] = EB::easysocial()->buildPrivacyQuery('a');
         // Jomsocial integrations
         $query[] = EB::jomsocial()->buildPrivacyQuery();
         // Blog privacy settings
         if ($my->guest) {
             $query[] = 'AND a.' . $db->qn('access') . '=' . $db->Quote(BLOG_PRIVACY_PUBLIC);
         }
         // Exclude private categories
         // $query[] = 'AND (' . $catAccessSQL . ')';
         // If the current menu is blogger mode, we need to respect this by only loading author related items
         $isBloggerMode = EBR::isBloggerMode();
         if ($isBloggerMode !== false) {
             $query[] = 'AND a.' . $db->qn('created_by') . '=' . $db->Quote($isBloggerMode);
             $query[] = 'AND a.' . $db->qn('source_type') . '=' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE);
         }
         // Filter the next / previous link by team
         if ($navigationType == 'team' && $teamId) {
             $query[] = 'AND (a.' . $db->qn('source_type') . '=' . $db->Quote(EASYBLOG_POST_SOURCE_TEAM) . ' AND a.' . $db->qn('source_id') . '=' . $db->Quote($teamId) . ')';
         }
         // Filter the next / previous by author
         if ($navigationType == 'author') {
             $query[] = 'AND a.' . $db->qn('created_by') . '=' . $db->Quote($author->id);
             $query[] = 'AND a.' . $db->qn('source_type') . '=' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE);
         }
         // Filter the next / previous post items from site wide
         if ($navigationType == 'site') {
             $query[] = 'AND a.' . $db->qn('source_type') . '=' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE);
         }
         // When language filter is enabled, we need to detect the appropriate contents
         $filterLanguage = JFactory::getApplication()->getLanguageFilter();
         if ($filterLanguage) {
             $query[] = EBR::getLanguageQuery('AND', 'a.language');
         }
         if ($key == 'prev') {
             $query[] = ' AND a.`created` < ' . $db->Quote($post->created);
             $query[] = ' ORDER BY a.`created` DESC';
         }
         if ($key == 'next') {
             $query[] = ' AND a.`created` > ' . $db->Quote($post->created);
             $query[] = ' ORDER BY a.`created` ASC';
         }
         $query[] = 'LIMIT 1';
         $query = implode(' ', $query);
         $db->setQuery($query);
         $result = $db->loadObject();
         $nav->{$key} = $result;
     }
     return $nav;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:88,代码来源:blog.php

示例4: __construct

 /**
  * Class Constructor
  *
  * @since	3.7
  * @access	public
  */
 public function __construct($overrideTheme = null, $options = array())
 {
     parent::__construct();
     // Determine if this is an admin location
     if (isset($options['admin']) && $options['admin']) {
         $this->admin = true;
     }
     // Determine the configured theme
     $theme = $this->config->get('layout_theme', $overrideTheme);
     // If a view is provided into the theme, the theme files could call methods from a view
     if (isset($options['view']) && is_object($options['view'])) {
         $this->view = $options['view'];
     }
     $this->theme = $theme;
     $obj = new stdClass();
     $obj->config = EB::config();
     $obj->my = JFactory::getUser();
     $obj->admin = EB::isSiteAdmin();
     $obj->profile = EB::user();
     // If it's development mode, allow user to invoke in the url to change theme.
     $invokeTheme = $this->input->get('theme', '', 'word');
     if ($invokeTheme) {
         $this->theme = $invokeTheme;
     }
     // If this is entry view, or category view, we need to respect the theme's category
     $this->menu = $this->app->getMenu()->getActive();
     $this->params = new JRegistry();
     if ($this->menu) {
         $this->params = $this->menu->params;
         // we will just set it here from the menu when this class first get instantiate. the corresponding view will have to do their own assignment if the view's templates need to access this entryParams
         $this->entryParams = $this->menu->params;
     }
     //is blogger mode flag
     $obj->isBloggerMode = EBR::isBloggerMode();
     $this->my = $obj->my;
     // Assign the acl
     $this->acl = EB::acl();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:44,代码来源:themes.php


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