Example #1
0
 /**
  * Displays the calendar layout
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Set the pathway
     $this->setPathway('COM_EASYBLOG_CALENDAR_BREADCRUMB');
     // Get the year and month if it's defined in the menu
     $year = $this->theme->params->get('calendar_year', 0);
     $month = $this->theme->params->get('calendar_month', 0);
     // Perhaps the year and month are being passed as query strings
     $year = $this->input->get('year', $year, 'default');
     $month = $this->input->get('month', $month, 'default');
     $day = $this->input->get('day', '01', 'default');
     // Get the Itemid
     $itemId = $this->input->get('Itemid', 0, 'int');
     // Try to generate timestamp if there's year and month provided
     $timestamp = '';
     if ($year && $month) {
         $timestamp = strtotime($year . '-' . $month . '-' . $day);
     }
     $this->set('timestamp', $timestamp);
     // get the calendar date.
     $date = EB::calendar()->getDateObject($timestamp);
     // meta, too late to add new meta id so we 'trick' the system to use the custom description.
     EB::setMeta('0', META_TYPE_VIEW, JText::_('COM_EASYBLOG_CALENDAR_PAGE_TITLE') . ' ' . $date->year . ', ' . $date->month);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_CALENDAR_PAGE_TITLE') . ' ' . $date->year . ', ' . $date->month);
     parent::setPageTitle($title, false, $this->config->get('main_pagetitle_autoappend'));
     return parent::display('blogs/calendar/default');
 }
Example #2
0
 /**
  * Default display method for featured listings
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tmpl = null)
 {
     // Set the meta tags for this page
     EB::setMeta(META_ID_FEATURED, META_TYPE_VIEW);
     // Add the RSS headers on the page
     EB::feeds()->addHeaders('index.php?option=com_easyblog&view=featured');
     // Add breadcrumbs on the site menu.
     $this->setPathway('COM_EASYBLOG_FEATURED_BREADCRUMB');
     // Get the model
     $model = EB::model('Featured');
     // Get a list of featured posts
     $posts = $model->getPosts();
     // Get the pagination
     $pagination = $model->getPagination();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE'));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Get the current url
     $return = EBR::_('index.php?option=com_easyblog', false);
     $this->set('return', $return);
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/featured/default');
 }
Example #3
0
 /**
  * Displays the calendar layout 
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tpl = null)
 {
     // Set the pathway
     $this->setPathway('COM_EASYBLOG_CALENDAR_BREADCRUMB');
     // Get the year and month if it's defined in the menu
     $year = $this->theme->params->get('calendar_year', 0);
     $month = $this->theme->params->get('calendar_month', 0);
     // dump($year, $month);
     // Perhaps the year and month are being passed as query strings
     $year = $this->input->get('year', $year, 'default');
     $month = $this->input->get('month', $month, 'default');
     $day = $this->input->get('day', '01', 'default');
     // Get the Itemid
     $itemId = $this->input->get('Itemid', 0, 'int');
     // Try to generate timestamp if there's year and month provided
     $timestamp = '';
     if ($year && $month) {
         $timestamp = strtotime($year . '-' . $month . '-' . $day);
     }
     $this->set('timestamp', $timestamp);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_CALENDAR_PAGE_TITLE'));
     parent::setPageTitle($title, false, $this->config->get('main_pagetitle_autoappend'));
     return parent::display('blogs/calendar/default');
 }
Example #4
0
 /**
  * Default display method for my blog listings
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tmpl = null)
 {
     // Require user to be logged in to access this page
     EB::requireLogin();
     // Get the default sorting behavior
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     // Load up the author profile
     $author = EB::user($this->my->id);
     // Set meta tags for blogger
     EB::setMeta($this->my->id, META_ID_BLOGGERS);
     // Set the breadcrumbs
     $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EB::_('index.php?option=com_easyblog&view=blogger'));
     $this->setPathway($author->getName());
     $menu = JFactory::getApplication()->getMenu();
     $categoryInclusion = array();
     if ($menu) {
         $active = $menu->getActive();
         $categoryInclusion = $active->params->get('inclusion');
     }
     $model = EB::model('Blog');
     $posts = $model->getBlogsBy('blogger', $author->id, $sort, 0, EBLOG_FILTER_PUBLISHED, false, false, array(), false, false, true, array(), $categoryInclusion);
     // Get the pagination
     $pagination = $model->getPagination();
     // Set the page title
     $title = $author->getName() . ' - ' . EB::getPageTitle(JText::_('COM_EASYBLOG_MY_BLOG_PAGE_TITLE'));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Add the RSS headers on the page
     EB::feeds()->addHeaders('index.php?option=com_easyblog&view=myblog');
     // Determines if the viewer already subscribed to the author
     $subscribed = false;
     $bloggerModel = EB::model('Blogger');
     if ($bloggerModel->isBloggerSubscribedUser($author->id, $this->my->id, $this->my->email)) {
         $subscribed = true;
     }
     // Get the current url
     $return = EBR::_('index.php?option=com_easyblog', false);
     $this->set('return', $return);
     $this->set('subscribed', $subscribed);
     $this->set('author', $author);
     $this->set('posts', $posts);
     $this->set('sort', $sort);
     $this->set('pagination', $pagination);
     parent::display('blogs/myblog/default');
 }
Example #5
0
 /**
  * Displays the default archives view
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Get the archives model
     $model = EB::model('Archive');
     // Get a list of posts
     $posts = $model->getPosts();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Get the pagination
     $pagination = $model->getPagination();
     // meta
     EB::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW);
     // Update the title of the page if navigating on different pages to avoid Google marking these title's as duplicates.
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE'));
     parent::setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/archives/list');
 }
Example #6
0
 /**
  * Displays a list of blog posts on the site filtered by a category.
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function listings()
 {
     // Retrieve sorting options
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $id = $this->input->get('id', 0, 'int');
     // Try to load the category
     $category = EB::table('Category');
     $category->load($id);
     // If the category isn't found on the site throw an error.
     if (!$id || !$category->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_CATEGORY_NOT_FOUND'));
     }
     // Set the meta description for the category
     EB::setMeta($category->id, META_TYPE_CATEGORY);
     // Set a canonical link for the category page.
     $this->canonical($category->getExternalPermalink());
     // Get the privacy
     $privacy = $category->checkPrivacy();
     if ($privacy->allowed || EB::isSiteAdmin() || !$this->my->guest && $this->config->get('main_allowguestsubscribe')) {
         $this->doc->addHeadLink($category->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         $this->doc->addHeadLink($category->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
     }
     // Set views breadcrumbs
     $this->setViewBreadcrumb($this->getName());
     // Set the breadcrumb for this category
     if (!EBR::isCurrentActiveMenu('categories', $category->id)) {
         // Always add the final pathway to the category title.
         $this->setPathway($category->title, '');
     }
     //get the nested categories
     $category->childs = null;
     // Build nested childsets
     EB::buildNestedCategories($category->id, $category, false, true);
     // Parameterize initial subcategories to display. Ability to configure from backend.
     $nestedLinks = '';
     $initialLimit = $this->app->getCfg('list_limit') == 0 ? 5 : $this->app->getCfg('list_limit');
     if (count($category->childs) > $initialLimit) {
         $initialNestedLinks = '';
         $initialRow = new stdClass();
         $initialRow->childs = array_slice($category->childs, 0, $initialLimit);
         EB::accessNestedCategories($initialRow, $initialNestedLinks, '0', '', 'link', ', ');
         $moreNestedLinks = '';
         $moreRow = new stdClass();
         $moreRow->childs = array_slice($category->childs, $initialLimit);
         EB::accessNestedCategories($moreRow, $moreNestedLinks, '0', '', 'link', ', ');
         // Hide more nested links until triggered
         $nestedLinks .= $initialNestedLinks;
         $nestedLinks .= '<span class="more-subcategories-toggle" data-more-categories-link> ' . JText::_('COM_EASYBLOG_AND') . ' <a href="javascript:void(0);">' . JText::sprintf('COM_EASYBLOG_OTHER_SUBCATEGORIES', count($category->childs) - $initialLimit) . '</a></span>';
         $nestedLinks .= '<span class="more-subcategories" style="display: none;" data-more-categories>, ' . $moreNestedLinks . '</span>';
     } else {
         EB::accessNestedCategories($category, $nestedLinks, '0', '', 'link', ', ');
     }
     $catIds = array();
     $catIds[] = $category->id;
     EB::accessNestedCategoriesId($category, $catIds);
     $category->nestedLink = $nestedLinks;
     // Get the category model
     $model = EB::model('Category');
     // Get total posts in this category
     $category->cnt = $model->getTotalPostCount($category->id);
     // Get teamblog posts count
     // $teamBlogCount = $model->getTeamBlogCount($category->id);
     $limit = EB::call('Pagination', 'getLimit', array(EBLOG_PAGINATION_CATEGORIES));
     // Get the posts in the category
     $data = $model->getPosts($catIds, $limit);
     // Get the pagination
     $pagination = $model->getPagination();
     // Get allowed categories
     $allowCat = $model->allowAclCategory($category->id);
     // Format the data that we need
     $posts = array();
     // Ensure that the user is really allowed to view the blogs
     if (!empty($data)) {
         $posts = EB::formatter('list', $data);
     }
     // Check isCategorySubscribed
     $isCategorySubscribed = $model->isCategorySubscribedEmail($category->id, $this->my->email);
     // If this category has a different theme, we need to output it differently
     if (!empty($category->theme)) {
         $this->setTheme($category->theme);
     }
     // Set the page title
     $title = EB::getPageTitle(JText::_($category->title));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Set the return url
     $return = base64_encode($category->getExternalPermalink());
     // Get the pagination
     $pagination = $pagination->getPagesLinks();
     $this->set('allowCat', $allowCat);
     $this->set('category', $category);
     $this->set('sort', $sort);
     $this->set('posts', $posts);
     $this->set('return', $return);
     $this->set('pagination', $pagination);
     // $this->set('teamBlogCount', $teamBlogCount);
     $this->set('privacy', $privacy);
     $this->set('isCategorySubscribed', $isCategorySubscribed);
     parent::display('blogs/categories/item');
 }
Example #7
0
 /**
  * Displays a list of blog posts from a specific team
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function listings()
 {
     // Get the team id that is being accessed now
     $id = $this->input->get('id', 0, 'int');
     $team = EB::table('TeamBlog');
     $team->load($id);
     if (!$id || !$team->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_INVALID_ID'));
     }
     // set meta tags for teamblog view
     EB::setMeta($id, META_TYPE_TEAM);
     $gid = EB::getUserGids();
     $isMember = $team->isMember($this->my->id, $gid);
     $team->isMember = $isMember;
     $team->isActualMember = $team->isMember($this->my->id, $gid, false);
     // Add rss feed link
     if ($team->access == EBLOG_TEAMBLOG_ACCESS_EVERYONE || $team->isMember) {
         $this->doc->addHeadLink($team->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         $this->doc->addHeadLink($team->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
     }
     // 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');
     }
     // Set the breadcrumbs for this view
     $this->setViewBreadcrumb('teamblog');
     $this->setPathway($team->getTitle());
     // Retrieve the model
     $model = EB::model('TeamBlogs');
     $posts = $model->getPosts($team->id);
     $posts = EB::formatter('list', $posts);
     // Get the pagination
     $pagination = $model->getPagination();
     // Retrieve team's information
     $members = $model->getTeamMembers($team->id);
     // Determines if the team blog is featured
     $team->isFeatured = EB::isFeatured('teamblog', $team->id);
     // Set the page title
     $title = EB::getPageTitle($team->title);
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Check if subscribed
     $isTeamSubscribed = $model->isTeamSubscribedEmail($team->id, $this->my->email);
     // Get the current url
     $return = $team->getPermalink();
     $this->set('return', $return);
     $this->set('team', $team);
     $this->set('members', $members);
     $this->set('pagination', $pagination->getPagesLinks());
     $this->set('posts', $posts);
     $this->set('isTeamSubscribed', $isTeamSubscribed);
     parent::display('teamblogs/item');
 }
Example #8
0
 /**
  * Displays blog listings by specific tags on the site
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function tag()
 {
     // Get the tag id
     $id = $this->input->get('id', '', 'default');
     // Add noindex for tags listing by default
     $this->doc->setMetadata('robots', 'noindex,follow');
     // Load the tag object
     $tag = EB::table('Tag');
     $tag->load($id);
     // The tag could be a permalink
     if (!$tag->id) {
         $tag->load($id, true);
     }
     // Set page title
     $this->setPageTitle($tag->getTitle(), '', $this->config->get('main_pagetitle_autoappend'));
     // set meta tags for tags view
     EB::setMeta(META_ID_TAGS, META_TYPE_VIEW, $tag->getTitle() . ' - ' . EB::getPageTitle($this->config->get('main_title')));
     // Set breadcrumb
     if (!EasyBlogRouter::isCurrentActiveMenu('tags')) {
         $this->setPathway(JText::_('COM_EASYBLOG_TAGS_BREADCRUMB'), EBR::_('index.php?option=com_easyblog&view=tags'));
     }
     $this->setPathway($tag->getTitle());
     // Get the blogs model
     $blogModel = EB::model('Blog');
     $tagModel = EB::model('Tags');
     // Get the blog posts now
     $rows = $blogModel->getTaggedBlogs($tag->id, false, '');
     // Get the pagination
     $pagination = $blogModel->getPagination();
     // Get total number of private blog posts
     $privateCount = 0;
     // Get total number of team blog count
     $teamblogCount = 0;
     if ($this->my->guest) {
         $privateCount = $tagModel->getTagPrivateBlogCount($id);
     }
     // Determines if we should get the team blog count
     if (!$this->config->get('main_includeteamblogpost')) {
         $teamblogCount = $tagModel->getTeamBlogCount($id);
     }
     // Format the blog posts using the standard list formatter
     $posts = EB::formatter('list', $rows);
     $return = base64_encode($tag->getPermalink());
     $this->set('return', $return);
     $this->set('tag', $tag);
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     $this->set('private', $privateCount);
     $this->set('team', $teamblogCount);
     parent::display('tags/item');
 }
Example #9
0
 /**
  * Initializes the header of the html page
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function renderHeaders()
 {
     // Load meta data
     EB::setMeta($this->id, META_TYPE_POST);
     // If there's robots set on the page, initialize it
     if ($this->robots) {
         $this->doc->setMetaData('robots', $this->robots);
     }
     // If there's a copyright notice, add it into the header
     if ($this->copyrights) {
         $this->doc->setMetaData('rights', $this->copyrights);
     }
     // Determines if the user wants to print this page
     $print = $this->input->get('print', 0, 'int');
     // Add noindex for print view by default.
     if ($print) {
         $this->doc->setMetadata('robots', 'noindex,follow');
     }
     $postTitle = $this->title;
     // If a custom title is set, we need to set them here
     if (isset($this->custom_title) && !empty($this->custom_title)) {
         $postTitle = $this->custom_title;
     }
     $this->doc->setTitle($postTitle);
     // Get the page title
     $title = EB::getPageTitle($this->config->get('main_title'));
     if ($title) {
         $this->doc->setTitle($postTitle . ' - ' . $title);
     }
     // Add opengraph tags if required.
     EB::facebook()->addOpenGraphTags($this);
     // Add Twitter card details on page.
     EB::twitter()->addCard($this);
 }
Example #10
0
 /**
  * Displays the quickpost layout
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function quickpost()
 {
     // Require user to be logged in
     EB::requireLogin();
     // Test if microblogging is allowed
     if (!$this->config->get('main_microblog')) {
         $this->info->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         return $this->app->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard', false));
     }
     // Test ACL if add entry is allowed
     if (!$this->acl->get('add_entry')) {
         return $this->app->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard', false));
     }
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_SHARE_A_STORY_TITLE'));
     parent::setPageTitle($title, false, $this->config->get('main_pagetitle_autoappend'));
     // Get active tabs
     $active = $this->input->get('type', 'standard', 'word');
     // Get a list of available auto post sites
     $facebook = EB::oauth()->isUserAssociated('facebook', $this->my->id);
     $twitter = EB::oauth()->isUserAssociated('twitter', $this->my->id);
     $linkedin = EB::oauth()->isUserAssociated('linkedin', $this->my->id);
     // Retrieve existing tags
     $tagsModel = EB::model('Tags');
     $tags = $tagsModel->getTags();
     $this->set('facebook', $facebook);
     $this->set('twitter', $twitter);
     $this->set('linkedin', $linkedin);
     $this->set('active', $active);
     $this->set('tags', $tags);
     parent::display('dashboard/quickpost/default');
 }
Example #11
0
 /**
  * Initializes the header of the html page
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function renderHeaders()
 {
     $doc = JFactory::getDocument();
     // Set meta tags for post
     EB::setMeta($this->id, META_TYPE_POST);
     // If there's robots set on the page, initialize it
     if ($this->robots) {
         $doc->setMetaData('robots', $this->robots);
     }
     // If there's a copyright notice, add it into the header
     if ($this->copyrights) {
         $doc->setMetaData('rights', $this->copyrights);
     }
     // Determines if the user wants to print this page
     $print = JFactory::getApplication()->input->get('print', 0, 'int');
     // Add noindex for print view by default.
     if ($print) {
         $doc->setMetadata('robots', 'noindex,follow');
     }
     $config = EB::config();
     $title = EB::getPageTitle($config->get('main_title'));
     if (empty($title)) {
         $doc->setTitle($this->title);
     } else {
         $doc->setTitle($this->title . ' - ' . $title);
     }
 }
Example #12
0
 /**
  * Displays blog posts created by specific users
  *
  * @since	4.0
  * @access	public
  */
 public function listings()
 {
     // Get sorting options
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $id = $this->input->get('id', 0, 'int');
     // Load the author object
     $author = EB::user($id);
     // Disallow all users from being viewed
     if (!$this->config->get('main_nonblogger_profile') && !EB::isBlogger($author->id) || !$author->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_INVALID_AUTHOR_ID_PROVIDED'));
     }
     // Get the authors acl
     $acl = EB::acl($author->id);
     // Set meta tags for the author if allowed to
     if ($acl->get('allow_seo')) {
         EB::setMeta($author->id, META_TYPE_BLOGGER, true);
     }
     // Set the breadcrumbs
     if (!EBR::isCurrentActiveMenu('blogger', $author->id) && !EBR::isCurrentActiveMenu('blogger')) {
         $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EB::_('index.php?option=com_easyblog&view=blogger'));
         $this->setPathway($author->getName());
     }
     // Get the current active menu
     $active = $this->app->getMenu()->getActive();
     // Excluded categories
     $excludeCats = array();
     if (isset($active->params)) {
         $excludeCats = $active->params->get('exclusion');
         // Ensure that this is an array
         if (!is_array($excludeCats) && $excludeCats) {
             $excludeCats = array($excludeCats);
         }
     }
     // Get the blogs model now to retrieve our blog posts
     $model = EB::model('Blog');
     // Get blog posts
     $posts = $model->getBlogsBy('blogger', $author->id, $sort, 0, '', false, false, '', false, false, false, $excludeCats);
     $pagination = $model->getPagination();
     // Format the blogs with our standard formatter
     $posts = EB::formatter('list', $posts);
     // Add canonical urls
     $this->canonical('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id);
     // Add authors rss links on the header
     if ($this->config->get('main_rss')) {
         if ($this->config->get('main_feedburner') && $this->config->get('main_feedburnerblogger')) {
             $this->doc->addHeadLink(EB::string()->escape($author->getRssLink()), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         } else {
             // Add rss feed link
             $this->doc->addHeadLink($author->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
             $this->doc->addHeadLink($author->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
         }
     }
     // Set the title of the page
     $title = EB::getPageTitle($author->getName());
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Check if subscribed
     $bloggerModel = EB::model('Blogger');
     $isBloggerSubscribed = $bloggerModel->isBloggerSubscribedEmail($author->id, $this->my->email);
     $return = base64_encode($author->getPermalink());
     $this->set('return', $return);
     $this->set('author', $author);
     $this->set('posts', $posts);
     $this->set('sort', $sort);
     $this->set('isBloggerSubscribed', $isBloggerSubscribed);
     parent::display('authors/item');
 }
Example #13
0
 /**
  * Displays the frontpage blog listings on the site.
  *
  * @since	5.0
  * @access	public
  */
 public function display($tmpl = null)
 {
     // Add the RSS headers on the page
     EB::feeds()->addHeaders('index.php?option=com_easyblog');
     // Add breadcrumbs on the site menu.
     $this->setPathway('COM_EASYBLOG_LATEST_BREADCRUMB');
     // Get the current active menu's properties.
     $params = $this->theme->params;
     $inclusion = '';
     if ($params) {
         // Get a list of category inclusions
         $inclusion = EB::getCategoryInclusion($params->get('inclusion'));
         if ($params->get('includesubcategories', 0) && !empty($inclusion)) {
             $tmpInclusion = array();
             foreach ($inclusion as $includeCatId) {
                 // Retrieve nested categories
                 $category = new stdClass();
                 $category->id = $includeCatId;
                 $category->childs = null;
                 EB::buildNestedCategories($category->id, $category);
                 $linkage = '';
                 EB::accessNestedCategories($category, $linkage, '0', '', 'link', ', ');
                 $catIds = array();
                 $catIds[] = $category->id;
                 EB::accessNestedCategoriesId($category, $catIds);
                 $tmpInclusion = array_merge($tmpInclusion, $catIds);
             }
             $inclusion = $tmpInclusion;
         }
     }
     // Sorting for the posts
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $model = EB::model('Blog');
     $tobeCached = array();
     // Retrieve a list of featured blog posts on the site.
     $featured = $model->getFeaturedBlog($inclusion);
     $excludeIds = array();
     // Test if user also wants the featured items to be appearing in the blog listings on the front page.
     // Otherwise, we'll need to exclude the featured id's from appearing on the front page.
     if (!$this->theme->params->get('post_include_featured', true)) {
         foreach ($featured as $item) {
             $excludeIds[] = $item->id;
         }
     }
     // Admin might want to display the featured blogs on all pages.
     $start = $this->input->get('start', 0, 'int');
     $limitstart = $this->input->get('limitstart', 0, 'int');
     if (!$this->theme->params->get('featured_slider_all_pages') && ($start != 0 || $limitstart != 0)) {
         $featured = array();
     }
     if ($featured) {
         $tobeCached = array_merge($tobeCached, $featured);
     }
     // Try to retrieve any categories to be excluded.
     $excludedCategories = $this->config->get('layout_exclude_categories');
     $excludedCategories = empty($excludedCategories) ? '' : explode(',', $excludedCategories);
     // Fetch the blog entries.
     $data = $model->getBlogsBy('', '', $sort, 0, EBLOG_FILTER_PUBLISHED, null, true, $excludeIds, false, false, true, $excludedCategories, $inclusion, null, 'listlength', $this->theme->params->get('post_pin_featured', false));
     if ($data) {
         $tobeCached = array_merge($tobeCached, $data);
     }
     // we will cache it here.
     if ($tobeCached) {
         EB::cache()->insert($tobeCached);
     }
     // Get the pagination
     $pagination = $model->getPagination();
     if ($featured) {
         // Format the featured items without caching
         $featured = EB::formatter('featured', $featured, false);
     }
     // Perform blog formatting without caching
     $posts = EB::formatter('list', $data, false);
     // Update the title of the page if navigating on different pages to avoid Google marking these title's as duplicates.
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_LATEST_PAGE_TITLE'));
     // Set the page title
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Add canonical URLs.
     $this->canonical('index.php?option=com_easyblog');
     // Retrieve the pagination for the latest view
     $pagination = $pagination->getPagesLinks();
     // Meta should be set later because formatter would have cached the post already.
     EB::setMeta(META_ID_LATEST, META_TYPE_VIEW);
     // Get the current url
     $return = EBR::_('index.php?option=com_easyblog', false);
     $this->set('return', $return);
     $this->set('posts', $posts);
     $this->set('featured', $featured);
     $this->set('pagination', $pagination);
     parent::display('blogs/latest/default');
 }