function display($tmpl = null) { $my = JFactory::getUser(); if ($my->id < 1) { EasyBlogHelper::showLogin(); return; } JPluginHelper::importPlugin('easyblog'); $dispatcher = JDispatcher::getInstance(); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $acl = EasyBlogACLHelper::getRuleSet(); $config = EasyBlogHelper::getConfig(); $sort = JRequest::getCmd('sort', $config->get('layout_postorder')); $blogger = EasyBlogHelper::getTable('Profile', 'Table'); $blogger->load($my->id); // set meta tags for blogger EasyBlogHelper::setMeta($my->id, META_ID_BLOGGERS); if (!EasyBlogRouter::isCurrentActiveMenu('myblog', $my->id)) { $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(); $pageNumber = $pagination->get('pages.current'); $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber); $document->setTitle($blogger->getName() . $pageText . EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_MY_BLOG_PAGE_TITLE'))); $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; } } $rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss'); //twitter follow me link $twitterFollowMelink = EasyBlogSocialShareHelper::getLink('twitter', $blogger->id); $theme = new CodeThemes(); $theme->set('rssURL', $rssURL); $theme->set('blogger', $blogger); $theme->set('sort', $sort); $theme->set('blogs', $data); $theme->set('currentURL', 'index.php?option=com_easyblog&view=latest'); $theme->set('pagination', $pagination->getPagesLinks()); $theme->set('twitterFollowMelink', $twitterFollowMelink); $theme->set('my', $my); $theme->set('acl', $acl); echo $theme->fetch('blog.blogger.php'); }
function display($tmpl = null) { JPluginHelper::importPlugin('easyblog'); $dispatcher = JDispatcher::getInstance(); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $acl = EasyBlogACLHelper::getRuleSet(); if (!EasyBlogRouter::isCurrentActiveMenu('featured')) { $this->setPathway(JText::_('COM_EASYBLOG_FEATURED_BREADCRUMB')); } // set meta tags for featured view EasyBlogHelper::setMeta(META_ID_FEATURED, META_TYPE_VIEW); EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=featured'); $model = $this->getModel('Featured'); $data = $model->getFeaturedBlog(); $pagination = $model->getPagination(); $params = $mainframe->getParams('com_easyblog'); $data = EasyBlogHelper::formatBlog($data); $blogModel = $this->getModel('Blog'); $pageNumber = $pagination->get('pages.current'); $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber); $document->setTitle(EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE') . $pageText)); 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; } } $theme = new CodeThemes(); $theme->set('data', $data); $theme->set('pagination', $pagination->getPagesLinks()); $theme->set('currentURL', 'index.php?option=com_easyblog&view=featured'); $theme->set('siteadmin', EasyBlogHelper::isSiteAdmin()); $theme->set('config', $config); $theme->set('acl', $acl); echo $theme->fetch('blog.featured.php'); }
function statistic() { JPluginHelper::importPlugin('easyblog'); $dispatcher = JDispatcher::getInstance(); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $acl = EasyBlogACLHelper::getRuleSet(); // Add noindex for tags view by default. $document->setMetadata('robots', 'noindex,follow'); $sort = JRequest::getCmd('sort', $config->get('layout_postorder')); $bId = JRequest::getCmd('id', '0'); //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 { JTable::addIncludePath(EBLOG_TABLES); $statObject = EasyBlogHelper::getTable('Tag', 'Table'); $statObject->load($statId); } $blogger = EasyBlogHelper::getTable('Profile', 'Table'); $blogger->load($bId); // set meta tags for blogger if ($acl->rules->allow_seo) { EasyBlogHelper::setMeta($blogger->id, META_TYPE_BLOGGER, true); } if (!EasyBlogRouter::isCurrentActiveMenu('blogger')) { $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS'), EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger')); } if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id)) { $this->setPathway($blogger->getName()); } $model = $this->getModel('Blog'); $data = $model->getBlogsBy('blogger', $blogger->id, $sort); $pagination = $model->getPagination(); $data = EasyBlogHelper::formatBlog($data); $rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss'); 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; } } $twitterFollowMelink = EasyBlogSocialShareHelper::getLink('twitter', $blogger->id); if ($config->get('main_rss')) { if ($config->get('main_feedburner') && $config->get('main_feedburnerblogger')) { $document->addHeadLink($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')); } } $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title')); $pageNumber = $pagination->get('pages.current'); $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber); $statTitle = ''; if (isset($statType)) { if ($statType == 'tag') { $statTitle = ' - ' . JText::sprintf('COM_EASYBLOG_BLOGGER_STAT_TAG', $statObject->title); } else { $statTitle = ' - ' . JText::sprintf('COM_EASYBLOG_BLOGGER_STAT_CATEGORY', $statObject->title); } } $document->setTitle($blogger->getName() . $statTitle . $pageText . $pageTitle); $tpl = new CodeThemes(); $tpl->set('blogger', $blogger); $tpl->set('sort', $sort); $tpl->set('blogs', $data); $tpl->set('config', $config); $tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin()); $tpl->set('pagination', $pagination->getPagesLinks()); $tpl->set('twitterFollowMelink', $twitterFollowMelink); $tpl->set('my', $my); $tpl->set('acl', $acl); $tpl->set('currentURL', ltrim('/', JRequest::getURI())); $tpl->set('statType', $statType); $tpl->set('statObject', $statObject); echo $tpl->fetch('blog.blogger.php'); }
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'); }
function display($tmpl = null) { JPluginHelper::importPlugin('easyblog'); $dispatcher = JDispatcher::getInstance(); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $notice = ''; //for trigger $params = $mainframe->getParams('com_easyblog'); $limitstart = JRequest::getInt('limitstart', 0, ''); $blogId = JRequest::getVar('id'); if (JRequest::getInt('print') == 1) { // Add noindex for print view by default. $document->setMetadata('robots', 'noindex,follow'); } if (empty($blogId)) { $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND')); $mainframe->close(); } if ($my->id <= 0 && $config->get('main_login_read')) { $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId . '&layout=login', false)); $mainframe->close(); } $team = JRequest::getVar('team', ''); if (empty($team)) { //try get from session. $team = EasyBlogHelper::getSession('EASYBLOG_TEAMBLOG_ID'); } // set meta tags for post EasyBlogHelper::setMeta($blogId, META_TYPE_POST); $print = JRequest::getBool('print'); if ($print) { $document->setMetaData('robots', 'noindex, nofollow'); } $my = JFactory::getUser(); $blog = EasyBlogHelper::getTable('Blog', 'Table'); if (!$blog->load($blogId)) { $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND')); $mainframe->close(); } if (!empty($blog->robots)) { $document->setMetaData('robots', $blog->robots); } if (!empty($blog->copyrights)) { $document->setMetaData('rights', $blog->copyrights); } //assign the teamid here. $checkIsPrivate = false; //check if blog is password protected. if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) { if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) { $errmsg = ''; $jSession = JFactory::getSession(); if ($jSession->has('PROTECTEDBLOG_' . $blog->id, 'EASYBLOG')) { $errmsg = JText::_('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_INVALID_PASSWORD'); } $theme = new CodeThemes(); $theme->set('id', $blog->id); $theme->set('return', base64_encode(JURI::getInstance()->toString())); $theme->set('errmsg', $errmsg); echo $theme->fetch('blog.protected.php'); return false; } } //if team id provided, then we need to check if the user belong to the team or not. if ($blog->issitewide) { $checkIsPrivate = true; } else { if (empty($team)) { // blog post is not sitewide and teamid is empty? this is not so right. need to check this post contributed to which team one more time. $team = $blog->getTeamContributed(); } /* * if teamblog access set to 'member only' | 'registered user', team blog will supersede blog permision * if teamblog access set to 'everyone' then blog's permission will supersede teamblog access (logged user vs guest) */ if (!empty($team)) { $teamblog = EasyBlogHelper::getTable('TeamBlog', 'Table'); $teamblog->load($team); if ($teamblog->access == '1') { if (!EasyBlogHelper::isTeamBlogJoined($my->id, $team)) { //show error. EasyBlogHelper::showAccessDenied('teamblog', $teamblog->access); return; } } else { if ($teamblog->access == '2') { if (!EasyBlogHelper::isLoggedIn()) { EasyBlogHelper::showLogin(); return; } } else { // if teamblog the access set to 'everyone' then blog permission will supersede teamblog access $checkIsPrivate = true; } } } else { $checkIsPrivate = true; } } $blog->team_id = $team; //check if the blog permission set to private or public. if private, we //need to check if the user has login or not. if ($checkIsPrivate) { $privacy = $blog->isAccessible(); if (!$privacy->allowed) { echo $privacy->error; return; } } // added checking for other statuses switch ($blog->published) { case 0: case 2: case 3: // Unpublished post // Only Admin and blog owner can view this post if ($my->id == $blog->created_by) { $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_OWNER'); } elseif (EasyBlogHelper::isSiteAdmin()) { $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_ADMIN'); } else { EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND')); $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false)); } break; case 5: // Trashed posts. EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND')); $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false)); break; case 1: default: break; } //update the hits $blog->hit(); $acl = EasyBlogACLHelper::getRuleSet(); $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title')); if (empty($pageTitle)) { $document->setTitle($blog->title); } 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); $blog->event->afterDisplayTitle = JString::trim(implode("\n", $results)); // @trigger: onBeforeDisplayContent / onContentBeforeDisplay $results = EasyBlogHelper::triggerEvent('beforeDisplayContent', $blog, $params, $limitstart); $blog->event->beforeDisplayContent = JString::trim(implode("\n", $results)); // @trigger: onAfterDisplayContent / onContentAfterDisplay $results = EasyBlogHelper::triggerEvent('afterDisplayContent', $blog, $params, $limitstart); $blog->event->afterDisplayContent = JString::trim(implode("\n", $results)); $blog->intro = $blog->introtext; $blog->content = $blog->text; unset($blog->introtext); unset($blog->text); if ($print) { $theme = new CodeThemes(); $theme->set('blog', $blog); $theme->set('tags', $tags); $theme->set('config', $config); $theme->set('blogger', $blogger); echo $theme->fetch('blog.read.print.php'); return; } if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id) && $config->get('layout_blogger_breadcrumb')) { $this->setPathway($blogger->getName(), $blogger->getLink()); } if (!EasyBlogRouter::isCurrentActiveMenu('entry', $blog->id)) { $this->setPathway($blog->title, ''); } $blogModel = $this->getModel('Blog'); $theme = new CodeThemes(); // add checking if comment system disabled by site owner if ($config->get('main_comment') && $blog->allowcomment) { // getting blog comments $commentModel = $this->getModel('Comment'); $blogComments = EasyBlogHelper::getHelper('Comment')->getBlogComment($blogId); $commtPagination = EasyBlogHelper::getHelper('Comment')->pagination; $comments = array(); if (!empty($blogComments)) { foreach ($blogComments as $comment) { $row = $comment; $row->comment = EasyBlogCommentHelper::parseBBCode($row->comment); if ($config->get('comment_likes')) { $row->likesAuthor = EasyBlogHelper::getLikesAuthors($row->id, 'comment', $my->id); $row->isLike = $commentModel->isLikeComment($row->id, $my->id); } else { $row->likesAuthor = ''; $row->isLike = 0; } $comments[] = $row; } } // compliant with the #comments at blog.item.comment.php $commentHtml = $config->get('comment_jcomments') ? '' : '<a id="comments"></a>'; $commentHtml .= EasyBlogCommentHelper::getCommentHTML($blog, $comments, $commtPagination); } $blog->totalComments = EasyBlogHelper::getHelper('Comment')->getCommentCount($blog); //get related blog post $blogRelatedPost = ''; if ($config->get('main_relatedpost', true)) { $blogRelatedPost = $blogModel->getRelatedBlog($blogId); } //get author's recent posts. $authorRecentPosts = ''; if ($config->get('main_showauthorinfo') && $config->get('main_showauthorposts')) { $authorPostLimit = $config->get('main_showauthorpostscount'); $authorRecentPosts = $blogModel->getBlogsBy('blogger', $blog->created_by, 'latest', $authorPostLimit); } // Facebook Like integrations require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'facebook.php'; $facebookLike = EasyBlogFacebookLikes::getLikeHTML($blog, $rawIntroText); $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true); // @rule: Add opengraph tags if required. if ($config->get('main_facebook_opengraph')) { EasyBlogFacebookLikes::addOpenGraphTags($blog, $rawIntroText); } // Add Twitter card details on page. EasyBlogHelper::getHelper('Twitter')->addCard($blog, $rawIntroText); // @task: Add canonical URLs. if ($config->get('main_canonical_entry')) { $canonicalUrl = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true, true); $document->addCustomTag('<link rel="canonical" href="' . $canonicalUrl . '"/>'); } // @task: Add rel="nofollow" if necessary. if ($config->get('main_anchor_nofollow')) { $blog->content = EasyBlogHelper::addNoFollow($blog->content); } $prevLink = array(); $nextLink = array(); // construct prev & next link //get blog navigation object if ($config->get('layout_navigation')) { $blogNav = EasyBlogHelper::getBlogNavigation($blogId, $blog->created, $team, 'team'); //$team $prevLink = array(); if (!empty($blogNav['prev'])) { $prevLink['id'] = $blogNav['prev'][0]->id; $prevLink['title'] = JString::strlen($blogNav['prev'][0]->title) > 50 ? JString::substr($blogNav['prev'][0]->title, 0, 50) . '...' : $blogNav['prev'][0]->title; } $nextLink = array(); if (!empty($blogNav['next'])) { $nextLink['id'] = $blogNav['next'][0]->id; $nextLink['title'] = JString::strlen($blogNav['next'][0]->title) > 50 ? JString::substr($blogNav['next'][0]->title, 0, 50) . '...' : $blogNav['next'][0]->title; } } // @rule: Mark notifications item in EasyDiscuss when the blog entry is viewed if ($config->get('integrations_easydiscuss_notification_blog')) { EasyBlogHelper::getHelper('EasyDiscuss')->readNotification($blog->id, EBLOG_NOTIFICATIONS_TYPE_BLOG); } if ($config->get('integrations_easydiscuss_notification_comment')) { EasyBlogHelper::getHelper('EasyDiscuss')->readNotification($blog->id, EBLOG_NOTIFICATIONS_TYPE_COMMENT); } if ($config->get('integrations_easydiscuss_notification_rating')) { EasyBlogHelper::getHelper('EasyDiscuss')->readNotification($blog->id, EBLOG_NOTIFICATIONS_TYPE_RATING); } //get social bookmark provider. require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'bookmark.php'; $bookmark = EasyBlogBookmark::getHTML(); // @task: As we are standardizing the admin tools, we fix the necessary properties here. $blog->isFeatured = $isFeatured; $theme->set('currentURL', EasyBlogRouter::_('index.php?option=com_easyblog&view=latest')); $theme->set('facebookLike', $facebookLike); $theme->set('notice', $notice); $theme->set('team', $team); $theme->set('blog', $blog); $theme->set('tags', $tags); $theme->set('blogger', $blogger); $theme->set('prevLink', $prevLink); $theme->set('nextLink', $nextLink); $theme->set('blogRelatedPost', $blogRelatedPost); $theme->set('authorRecentPosts', $authorRecentPosts); $theme->set('isFeatured', $isFeatured); $theme->set('isMineBlog', EasyBlogHelper::isMineBlog($blog->created_by, $my->id)); $theme->set('acl', $acl); $theme->set('url', $url); $theme->set('commentHTML', $commentHtml); $theme->set('bookmark', $bookmark); $theme->set('pdfLinkProperties', EasyBlogHelper::getPDFlinkProperties()); $theme->set('ispreview', false); // @task: trackbacks $trackbacks = $blogModel->getTrackback($blogId); $theme->set('trackbackURL', EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=trackback&post_id=' . $blog->id, true, true)); $theme->set('trackbacks', $trackbacks); //google adsense $adsense = EasyBlogGoogleAdsense::getHTML($blogger->id); $blogHeader = $adsense->header; $blogFooter = $adsense->footer; $theme->set('adsenseHTML', $adsense->beforecomments); $blogHtml = $theme->fetch('blog.read' . EasyBlogHelper::getHelper('Sources')->getTemplateFile($blog->source) . '.php'); echo $blogHeader; echo $blogHtml; echo $blogFooter; }
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'); }
/** * 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'); }
function display($tmpl = null) { // set meta tags for latest post EasyBlogHelper::setMeta(META_ID_SEARCH, META_TYPE_SEARCH); $document = JFactory::getDocument(); $document->setTitle(EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_SEARCH_PAGE_TITLE'))); if (!EasyBlogRouter::isCurrentActiveMenu('search')) { $this->setPathway(JText::_('COM_EASYBLOG_SEARCH_BREADCRUMB')); } $query = JRequest::getVar('query'); $Itemid = JRequest::getInt('Itemid'); if (empty($query)) { $posts = array(); $pagination = ''; } else { $model = $this->getModel('Search'); $result = $model->getData(); if (count($result) > 0) { // strip out all the media code for ($i = 0; $i < count($result); $i++) { $row =& $result[$i]; // strip videos $row->intro = EasyBlogHelper::getHelper('Videos')->strip($row->intro); $row->content = EasyBlogHelper::getHelper('Videos')->strip($row->content); // strip gallery $row->intro = EasyBlogHelper::getHelper('Gallery')->strip($row->intro); $row->content = EasyBlogHelper::getHelper('Gallery')->strip($row->content); // strip jomsocial album $row->intro = EasyBlogHelper::getHelper('Album')->strip($row->intro); $row->content = EasyBlogHelper::getHelper('Album')->strip($row->content); // strip audio $row->intro = EasyBlogHelper::getHelper('Audio')->strip($row->intro); $row->content = EasyBlogHelper::getHelper('Audio')->strip($row->content); } } $posts = EasyBlogHelper::formatBlog($result); $pagination = $model->getPagination(); } if (count($posts) > 0) { $searchworda = preg_replace('#\\xE3\\x80\\x80#s', ' ', $query); $searchwords = preg_split("/\\s+/u", $searchworda); $needle = $searchwords[0]; $searchwords = array_unique($searchwords); for ($i = 0; $i < count($posts); $i++) { $row = $posts[$i]; $content = preg_replace('/\\s+/', ' ', strip_tags($row->content)); $pattern = '#('; $x = 0; foreach ($searchwords as $k => $hlword) { $pattern .= $x == 0 ? '' : '|'; $pattern .= preg_quote($hlword, '#'); $x++; } $pattern .= ')#iu'; $row->title = preg_replace($pattern, '<span class="search-highlight">\\0</span>', $row->title); $row->content = preg_replace($pattern, '<span class="search-highlight">\\0</span>', JString::substr(strip_tags($row->content), 0, 250)); } } $jConfig = EasyBlogHelper::getJConfig(); $theme = new CodeThemes(); $theme->set('jConfig', $jConfig); $theme->set('query', $query); $theme->set('posts', $posts); $theme->set('pagination', $pagination); $theme->set('Itemid', $Itemid); echo $theme->fetch('search.php'); }