/** * 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'); }
/** * 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'); }
/** * 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'); }
function listings() { 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', $config->get('layout_postorder')); $bId = JRequest::getCmd('id', '0'); $blogger = EasyBlogHelper::getTable('Profile', 'Table'); $blogger->load($bId); if (!$config->get('main_nonblogger_profile')) { if (!EasyBlogHelper::isBlogger($blogger->id)) { $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false); $mainframe->redirect($redirect); $mainframe->close(); } } // If blogger does not exist, redirect if (!$blogger->id) { $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false); $mainframe->redirect($redirect); $mainframe->close(); } if ($acl->rules->allow_seo) { EasyBlogHelper::setMeta($blogger->id, META_TYPE_BLOGGER, true); } if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id)) { if (!EasyBlogRouter::isCurrentActiveMenu('blogger')) { $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger')); } $this->setPathway($blogger->getName()); } $model = $this->getModel('Blog'); $data = $model->getBlogsBy('blogger', $blogger->id, $sort); $pagination = $model->getPagination(); $data = EasyBlogHelper::formatBlog($data, false, true, true, true); $rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss'); // @task: Add canonical URLs. if ($config->get('main_canonical_entry')) { $canonicalUrl = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $blogger->id, false, true, true); $document->addCustomTag('<link rel="canonical" href="' . $canonicalUrl . '"/>'); } if ($config->get('layout_showcomment', false)) { for ($i = 0; $i < count($data); $i++) { $row =& $data[$i]; $maxComment = $config->get('layout_showcommentcount', 3); $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc'); $comments = EasyBlogHelper::formatBlogCommentsLite($comments); $row->comments = $comments; } } if ($config->get('main_rss')) { if ($config->get('main_feedburner') && $config->get('main_feedburnerblogger')) { $document->addHeadLink(EasyBlogHelper::getHelper('String')->escape($blogger->getRSS()), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0')); } else { // Add rss feed link $document->addHeadLink($blogger->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0')); $document->addHeadLink($blogger->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0')); } } $title = EasyBlogHelper::getPageTitle($blogger->getName()); // @task: Set the page title parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend')); $theme = new CodeThemes(); $theme->set('twitterLink', $blogger->getTwitterLink()); $theme->set('blogger', $blogger); $theme->set('sort', $sort); $theme->set('blogs', $data); $theme->set('pagination', $pagination->getPagesLinks()); $theme->set('my', $my); $theme->set('acl', $acl); $theme->set('currentURL', $blogger->getProfileLink()); $theme->set('showAvatar', false); echo $theme->fetch('blog.blogger.php'); echo EasyBlogHelper::getFBInitScript(); }
function listings() { $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $theme = $config->get('layout_theme'); $my = JFactory::getUser(); $acl = EasyBlogACLHelper::getRuleSet(); //setting pathway $pathway = $mainframe->getPathway(); $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); $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; $team->isActualMember = $team->isMember($my->id, $gid, false); if ($team->access == EBLOG_TEAMBLOG_ACCESS_EVERYONE || $team->isMember) { // Add rss feed link $document->addHeadLink($team->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0')); $document->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'); } //add the pathway for teamblog if (!EasyBlogRouter::isCurrentActiveMenu('teamblog', $team->id)) { if (!EasyBlogRouter::isCurrentActiveMenu('teamblog')) { $this->setPathway(JText::_('COM_EASYBLOG_TEAMBLOG'), EasyBlogRouter::_('index.php?option=com_easyblog&view=teamblog')); } $this->setPathway($team->title, ''); } $tbModel = $this->getModel('TeamBlogs'); $model = $this->getModel('Blog'); $blogs = $model->getBlogsBy('teamblog', $team->id); $blogs = EasyBlogHelper::formatBlog($blogs, true); $pagination = $model->getPagination(); //now get the teams info $members = $tbModel->getTeamMembers($team->id); $teamMembers = EasyBlogHelper::formatTeamMembers($members); $isFeatured = EasyBlogHelper::isFeatured('teamblog', $team->id); $title = EasyBlogHelper::getPageTitle($team->title); // @task: Set the page title parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend')); EasyBlogHelper::storeSession($team->id, 'EASYBLOG_TEAMBLOG_ID'); $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('currentURL', 'index.php?option=com_easyblog&view=teamblog&layout=listings&id=' . $team->id); $tpl->set('config', $config); $tpl->set('my', $my); $tpl->set('acl', $acl); echo $tpl->fetch('blog.teamblogs.php'); }
function calendar($tmpl = null) { JPluginHelper::importPlugin('easyblog'); $dispatcher = JDispatcher::getInstance(); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $acl = EasyBlogACLHelper::getRuleSet(); //setting pathway $pathway = $mainframe->getPathway(); if (!EasyBlogRouter::isCurrentActiveMenu('archive')) { $pathway->addItem(JText::_('COM_EASYBLOG_ARCHIVE_BREADCRUMB'), ''); } EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=archive'); $menuParams = $mainframe->getParams(); $defaultYear = $menuParams->get('es_archieve_year', 0); $defaultMonth = $menuParams->get('es_archieve_month', 0); $archiveYear = JRequest::getVar('archiveyear', $defaultYear, 'REQUEST'); $archiveMonth = JRequest::getVar('archivemonth', $defaultMonth, 'REQUEST'); $archiveDay = JRequest::getVar('archiveday', 0, 'REQUEST'); $itemId = JRequest::getInt('Itemid', 0); if (empty($archiveYear) || empty($archiveMonth)) { // @task: Set the page title $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE')); parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend')); $tpl = new CodeThemes(); $tpl->set('itemId', $itemId); echo $tpl->fetch('calendar.php'); return; } $date = EasyBlogHelper::getDate(); $sort = 'latest'; $model = $this->getModel('Archive'); $year = $model->getArchiveMinMaxYear(); $data = $model->getArchive($archiveYear, $archiveMonth, $archiveDay); $pagination = $model->getPagination(); $params = $mainframe->getParams('com_easyblog'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); $data = EasyBlogHelper::formatBlog($data); //if day is empty if (empty($archiveDay)) { $archiveDay = '01'; $dateformat = '%B %Y'; $emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_MONTH'); } else { $dateformat = '%d %B %Y'; $emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_DAY'); } $archiveDay = strlen($archiveDay) < 2 ? '0' . $archiveDay : $archiveDay; $viewDate = EasyBlogHelper::getDate($archiveYear . '-' . $archiveMonth . '-' . $archiveDay); $formatedDate = $viewDate->toFormat($dateformat); $archiveTitle = JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate); // @task: Set the page title $title = EasyBlogHelper::getPageTitle(JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate)); parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend')); // set meta tags for featured view EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate); // set meta tags for featured view EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate); $tpl = new CodeThemes(); $tpl->set('data', $data); $tpl->set('pagination', $pagination->getPagesLinks()); $tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin()); $tpl->set('archiveYear', $archiveYear); $tpl->set('archiveMonth', $archiveMonth); $tpl->set('archiveDay', $archiveDay); $tpl->set('config', $config); $tpl->set('my', $my); $tpl->set('acl', $acl); $tpl->set('archiveTitle', $archiveTitle); $tpl->set('emptyPostMsg', $emptyPostMsg); echo $tpl->fetch('blog.archive.php'); }
function listings() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $acl = EasyBlogACLHelper::getRuleSet(); $sort = JRequest::getCmd('sort', $config->get('layout_postorder')); $catId = JRequest::getCmd('id', '0'); $category = EasyBlogHelper::getTable('Category', 'Table'); $category->load($catId); if ($category->id == 0) { $category->title = JText::_('COM_EASYBLOG_UNCATEGORIZED'); } // Set the meta description for the category EasyBlogHelper::setMeta($category->id, META_TYPE_CATEGORY); // Set the meta description for the category // $doc->setMetadata( 'description' , strip_tags( $category->description ) ); //setting pathway $pathway = $app->getPathway(); $privacy = $category->checkPrivacy(); $addRSS = true; if (!$privacy->allowed) { if ($my->id == 0 && !$config->get('main_allowguestsubscribe')) { $addRSS = false; } } if ($addRSS) { // Add rss feed link $doc->addHeadLink($category->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0')); $doc->addHeadLink($category->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0')); } if (!EasyBlogRouter::isCurrentActiveMenu('categories', $category->id)) { if (!EasyBlogRouter::isCurrentActiveMenu('categories')) { $this->setPathway(JText::_('COM_EASYBLOG_CATEGORIES_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=categories')); } //add the pathway for category $this->setPathway($category->title, ''); } //get the nested categories $category->childs = null; EasyBlogHelper::buildNestedCategories($category->id, $category, false, true); // TODO: Parameterize initial subcategories to display. Ability to configure from backend. $nestedLinks = ''; $initialLimit = $app->getCfg('list_limit') == 0 ? 5 : $app->getCfg('list_limit'); if (count($category->childs) > $initialLimit) { $initialNestedLinks = ''; $initialRow = new stdClass(); $initialRow->childs = array_slice($category->childs, 0, $initialLimit); EasyBlogHelper::accessNestedCategories($initialRow, $initialNestedLinks, '0', '', 'link', ', '); $moreNestedLinks = ''; $moreRow = new stdClass(); $moreRow->childs = array_slice($category->childs, $initialLimit); EasyBlogHelper::accessNestedCategories($moreRow, $moreNestedLinks, '0', '', 'link', ', '); // Hide more nested links until triggered $nestedLinks .= $initialNestedLinks; $nestedLinks .= '<span class="more-subcategories-toggle"> ' . JText::_('COM_EASYBLOG_AND') . ' <a href="javascript: void(0);onclick="eblog.categories.loadMore( this );">' . JText::sprintf('COM_EASYBLOG_OTHER_SUBCATEGORIES', count($category->childs) - $initialLimit) . '</a></span>'; $nestedLinks .= '<span class="more-subcategories" style="display: none;">, ' . $moreNestedLinks . '</span>'; } else { EasyBlogHelper::accessNestedCategories($category, $nestedLinks, '0', '', 'link', ', '); } $catIds = array(); $catIds[] = $category->id; EasyBlogHelper::accessNestedCategoriesId($category, $catIds); $category->nestedLink = $nestedLinks; $modelC = $this->getModel('Category'); $category->cnt = $modelC->getTotalPostCount($category->id); $modelPT = $this->getModel('PostTag'); $model = $this->getModel('Blog'); $modelCat = $this->getModel('Category'); $data = $model->getBlogsBy('category', $catIds, $sort, null, null, null, null, array(), null, null, null, array(), array(), null, EBLOG_PAGINATION_CATEGORIES); $pagination = $model->getPagination(); $allowCat = $modelCat->allowAclCategory($category->id); //for trigger $params = $app->getParams('com_easyblog'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); if (!empty($data)) { $data = EasyBlogHelper::formatBlog($data, false, true, true, true); if ($config->get('layout_showcomment', false)) { for ($i = 0; $i < count($data); $i++) { $row =& $data[$i]; $maxComment = $config->get('layout_showcommentcount', 3); $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc'); $comments = EasyBlogHelper::formatBlogCommentsLite($comments); $row->comments = $comments; } } } $teamBlogCount = $modelCat->getTeamBlogCount($category->id); $title = EasyBlogHelper::getPageTitle(JText::_($category->title)); // @task: Set the page title parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend')); $themes = new CodeThemes(); $themes->set('allowCat', $allowCat); $themes->set('category', $category); $themes->set('sort', $sort); $themes->set('blogs', $data); $themes->set('currentURL', 'index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id); $themes->set('pagination', $pagination->getPagesLinks()); $themes->set('config', $config); $themes->set('teamBlogCount', $teamBlogCount); $themes->set('my', $my); $themes->set('acl', $acl); $themes->set('privacy', $privacy); echo $themes->fetch('blog.category.php'); }
/** * Responsible to display the front page of the blog listings * * @access public */ function display($tmpl = null) { // @task: Set meta tags for latest post EasyBlogHelper::setMeta(META_ID_LATEST, META_TYPE_VIEW); // @task: Set rss links into headers. EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=latest'); $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $acl = EasyBlogACLHelper::getRuleSet(); // @task: Add a breadcrumb if the current menu that's being accessed is not from the latest view. if (!EasyBlogRouter::isCurrentActiveMenu('latest')) { $this->setPathway(JText::_('COM_EASYBLOG_LATEST_BREADCRUMB'), ''); } // @task: Get the current active menu's properties. $menu = $app->getMenu()->getActive(); $menu = JFactory::getApplication()->getMenu()->getActive(); $inclusion = ''; if (is_object($menu)) { $params = EasyBlogHelper::getRegistry(); $params->load($menu->params); $inclusion = EasyBlogHelper::getCategoryInclusion($params->get('inclusion')); if ($params->get('includesubcategories', 0) && !empty($inclusion)) { $tmpInclusion = array(); foreach ($inclusion as $includeCatId) { //get the nested categories $category = new stdClass(); $category->id = $includeCatId; $category->childs = null; EasyBlogHelper::buildNestedCategories($category->id, $category); $linkage = ''; EasyBlogHelper::accessNestedCategories($category, $linkage, '0', '', 'link', ', '); $catIds = array(); $catIds[] = $category->id; EasyBlogHelper::accessNestedCategoriesId($category, $catIds); $tmpInclusion = array_merge($tmpInclusion, $catIds); } $inclusion = $tmpInclusion; } } // @task: Necessary filters $sort = JRequest::getCmd('sort', $config->get('layout_postorder')); $model = $this->getModel('Blog'); // @task: Retrieve the list of featured blog posts. $featured = $model->getFeaturedBlog($inclusion); $excludeIds = array(); // @task: Add canonical URLs. if ($config->get('main_canonical_entry')) { $canonicalUrl = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=latest', false, true, true); $doc->addCustomTag('<link rel="canonical" href="' . $canonicalUrl . '"/>'); } // 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 (!$config->get('layout_featured_frontpage')) { foreach ($featured as $item) { $excludeIds[] = $item->id; } } // @task: Admin might want to display the featured blogs on all pages. if (!$config->get('layout_featured_allpages') && (JRequest::getInt('start', 0) != 0 || JRequest::getInt('limitstart', 0) != 0)) { $featured = array(); } else { for ($i = 0; $i < count($featured); $i++) { $row = $featured[$i]; $row->featuredImage = EasyBlogHelper::getFeaturedImage($row->intro . $row->content); } $featured = EasyBlogHelper::formatBlog($featured, true, false, false, false, false); } // @task: Try to retrieve any categories to be excluded. $excludedCategories = $config->get('layout_exclude_categories'); $excludedCategories = empty($excludedCategories) ? '' : explode(',', $excludedCategories); // @task: Fetch the blog entries. $data = $model->getBlogsBy('', '', $sort, 0, EBLOG_FILTER_PUBLISHED, null, true, $excludeIds, false, false, true, $excludedCategories, $inclusion); $pagination = $model->getPagination(); $params = $app->getParams('com_easyblog'); // @task: Perform necessary formatting here. $data = EasyBlogHelper::formatBlog($data, true, true, true, true); // @task: Update the title of the page if navigating on different pages to avoid Google marking these title's as duplicates. $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_LATEST_PAGE_TITLE')); // @task: Set the page title parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend')); // @task: Get pagination output here. $paginationHTML = $pagination->getPagesLinks(); $theme = new CodeThemes(); $theme->set('data', $data); $theme->set('featured', $featured); $theme->set('currentURL', EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false)); $theme->set('pagination', $paginationHTML); // @task: Send back response to the browser. echo $theme->fetch('blog.latest.php'); }
/** * Micro blogging layout * * @since 3.0.7706 * @access public * @param null * @return null */ public function microblog() { $mainframe = JFactory::getApplication(); $config = EasyBlogHelper::getConfig(); $acl = EasyBlogACLHelper::getRuleSet(); if (!EasyBlogHelper::isLoggedIn()) { EasyBlogHelper::showLogin(); return; } $my = JFactory::getuser(); $user = EasyBlogHelper::getTable('Profile', 'Table'); $user->load($my->id); // @rule: Test if microblogging is allowed if (!$config->get('main_microblog')) { EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error'); JFactory::getApplication()->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false)); } // @rule: Test ACL if add entry is allowed if (!$acl->rules->add_entry) { $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false), JText::_('COM_EASYBLOG_NO_PERMISSION_TO_CREATE_BLOG')); $mainframe->close(); } $document = JFactory::getDocument(); $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_SHARE_A_STORY_TITLE')); // @task: Set the page title parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend')); // Add toolbar to the output echo $this->showToolbar(__FUNCTION__, $user); // Get active tabs $activeType = JRequest::getVar('type', 'text'); // Add the breadcrumbs $breadcrumbs = array(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB_SHARE_STORY') => ''); // @task: Retrieve existing categories $categoryModel = $this->getModel('Categories'); $categories = EasyBlogHelper::populateCategories('', '', 'select', 'category_id', '', true, true, true); // @task: Retrieve existing tags $tagsModel = $this->getModel('Tags'); $tags = $tagsModel->getTags(); $template = new CodeThemes('dashboard'); $template->set('activeType', $activeType); $template->set('categories', $categories); $template->set('breadcrumbs', $breadcrumbs); $template->set('tags', $tags); echo $template->fetch('dashboard.microblog.php'); }
/** * Display specific tag from the site. **/ function tag() { $document = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $acl = EasyBlogACLHelper::getRuleSet(); $id = JRequest::getVar('id', '', 'REQUEST'); JTable::addIncludePath(EBLOG_TABLES); // Add noindex for tags view by default. $document->setMetadata('robots', 'noindex,follow'); $tag = EasyBlogHelper::getTable('Tag', 'Table'); $tag->load($id); $title = EasyBlogHelper::getPageTitle($tag->title); // @task: Set the page title parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend')); // set meta tags for tags view EasyBlogHelper::setMeta(META_ID_TAGS, META_TYPE_VIEW, JText::_($tag->title) . ' - ' . EasyBlogHelper::getPageTitle($config->get('main_title'))); if (!EasyBlogRouter::isCurrentActiveMenu('tags')) { $this->setPathway(JText::_('COM_EASYBLOG_TAGS_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=tags')); } $this->setPathway(JText::_($tag->title)); $blogModel = $this->getModel('Blog'); $tagModel = $this->getModel('Tags'); $rows = $blogModel->getTaggedBlogs($id); $pagination = $blogModel->getPagination(); $privateBlogCount = 0; $teamBlogCount = 0; if ($my->id == 0) { $privateBlogCount = $tagModel->getTagPrivateBlogCount($id); } if (!$config->get('main_includeteamblogpost')) { $teamBlogCount = $tagModel->getTeamBlogCount($id); } //for trigger only JPluginHelper::importPlugin('easyblog'); $dispatcher = JDispatcher::getInstance(); $mainframe = JFactory::getApplication(); $params = $mainframe->getParams('com_easyblog'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); if (!empty($rows)) { $rows = EasyBlogHelper::formatBlog($rows, true, true, true, true); for ($i = 0; $i < count($rows); $i++) { $row =& $rows[$i]; $row->category = $blogModel->getCategoryName($row->category_id); // $row->readmore = JText::_('COM_EASYBLOG_CONTINUE_READING'); if ($config->get('layout_showcomment', false)) { $maxComment = $config->get('layout_showcommentcount', 3); $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc'); $comments = EasyBlogHelper::formatBlogCommentsLite($comments); $row->comments = $comments; } } } $theme = new CodeThemes(); $theme->set('tag', $tag); $theme->set('rows', $rows); $theme->set('pagination', $pagination); $theme->set('currentURL', 'index.php?option=com_easyblog&view=tags&layout=tag&id=' . $tag->id); $theme->set('privateBlogCount', $privateBlogCount); $theme->set('teamBlogCount', $teamBlogCount); echo $theme->fetch('blog.tags.php'); }
/** * 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'); }