/** * Displays the pagination links at the bottom of the page. * * @since 5.0 * @access public * @param string * @return */ public function toHTML($view = 'index', $replace = false) { // Retrieve the pagination data. $data = $this->getData(); // If there's no pagination at all, skip this if (count($data->pages) == $this->get('pages.total') && $this->get('pages.total') == 1 || $this->get('pages.total') == 0) { return false; } $queries = ''; if (!empty($data) && $replace) { $currentPageLink = 'index.php?option=com_easyblog&view=' . $view . $queries; foreach ($data->pages as $page) { if (!empty($page->link)) { $limitstart = !empty($page->base) ? '&limitstart=' . $page->base : ''; $page->link = EBR::_($currentPageLink . $limitstart); } } if (!empty($data->next->link)) { $limitstart = !empty($data->next->base) ? '&limitstart=' . $data->next->base : ''; $data->next->link = EBR::_($currentPageLink . $limitstart); } if (!empyt($data->previous->link)) { $limitstart = !empty($data->previous->base) ? '&limitstart=' . $data->previous->base : ''; $data->previous->link = EBR::_($currentPageLink . $limitstart); } } $template = EB::template(); $template->set('data', $data); return $template->output('site/blogs/pagination/default'); }
public function display($tmpl = null) { // Checks if rss is enabled if (!$this->config->get('main_rss')) { return; } // Get the archives model $model = EB::model('Archive'); // Get a list of posts $posts = $model->getPosts(); // Format the posts $posts = EB::formatter('list', $posts); // Set the link for this feed $this->doc->link = EBR::_('index.php?option=com_easyblog&view=archive'); $this->doc->setTitle(JText::_('COM_EASYBLOG_ARCHIVED_POSTS')); $this->doc->setDescription(JText::_('COM_EASYBLOG_ARCHIVED_POSTS_DESC')); if (!$posts) { return; } foreach ($posts as $post) { $image = ''; if ($post->getImage('medium', true, true)) { $image = '<img src=' . $post->getImage('medium', true, true) . '" alt="' . $post->title . '" />'; } $item = new JFeedItem(); $item->title = $post->title; $item->link = $post->getPermalink(); $item->description = $image . $post->getIntro(); $item->date = $post->getCreationDate()->format(); $item->category = $post->getPrimaryCategory()->getTitle(); $item->author = $post->author->getName(); $item->authorEmail = $this->getRssEmail($post->author); $this->doc->addItem($item); } }
/** * @since 3.0 * Unsubscribe a user with email to a blog post * * @param int Subscription ID * @param int Blog post ID * * @return bool True on success */ public function unsubscribe() { $subscriptionId = JRequest::getInt('subscription_id'); $blogId = JRequest::getInt('blog_id'); $my = JFactory::getUser(); $mainframe = JFactory::getApplication(); $redirect = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $blogId, false); // Check variables if ($my->id == 0 || !$subscriptionId || !$blogId) { EB::info()->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error'); $mainframe->redirect($redirect); } // Need to ensure that whatever id passed in is owned by the current browser $blogModel = EB::model('Blog'); $sid = $blogModel->isBlogSubscribedUser($blogId, $my->id, $my->email); if ($subscriptionId != $sid) { EB::info()->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error'); $mainframe->redirect($redirect); } // Proceed to unsubscribe $table = EB::table('Subscriptions'); $table->load($subscriptionId); if (!$table->delete()) { EB::info()->set(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_FAILED'), 'error'); $mainframe->redirect($redirect); } EB::info()->set(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_SUCCESS'), 'success'); $mainframe->redirect($redirect); }
public function load($cid) { static $instances = array(); if (!isset($instances[$cid])) { $this->_item = EB::post($cid); if (!$this->_item) { return $this->onLoadArticleError($cid); } $blogger = EB::user($this->_item->created_by); $this->_item->blogger = $blogger; $link = 'index.php?option=com_easyblog&view=entry&id=' . $this->getContentId(); // forcefully get item id if request is ajax $format = JRequest::getString('format', 'html'); if ($format === 'ajax') { $itemid = JRequest::getInt('pageItemId'); if (!empty($itemid)) { $link .= '&Itemid=' . $itemid; } } $link = EBR::_($link); $this->_item->permalink = $this->prepareLink($link); $instances[$cid] = $this->_item; } $this->_item = $instances[$cid]; return $this; }
/** * 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'); }
/** 1.5 **/ public function onSearch($text, $phrase = '', $ordering = '', $areas = null) { $plugin = JPluginHelper::getPlugin('search', 'easyblog'); $params = EB::registry($plugin->params); if (!plgSearchEasyblog::exists()) { return array(); } if (is_array($areas)) { if (!array_intersect($areas, array_keys(plgSearchEasyblog::onContentSearchAreas()))) { return array(); } } $text = trim($text); if ($text == '') { return array(); } $result = plgSearchEasyblog::getResult($text, $phrase, $ordering); if (!$result) { return array(); } // require_once( EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'router.php' ); foreach ($result as $row) { $row->section = plgSearchEasyblog::getCategory($row->category_id); $row->section = JText::sprintf('PLG_EASYBLOG_SEARCH_BLOGS_SECTION', $row->section); $row->href = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id); $blog = EB::table('Blog'); $blog->bind($row); if ($blog->getImage()) { $row->image = $blog->getImage('frontpage'); } } return $result; }
/** * Default feed display method * * @since 5.0 * @access public * @param string * @return */ public function display($tmpl = null) { // Ensure that rss is enabled if (!$this->config->get('main_rss')) { return JError::raiseError(404, JText::_('COM_EASYBLOG_FEEDS_DISABLED')); } $id = $this->input->get('id', '', 'cmd'); $category = EB::table('Category'); $category->load($id); // Private category shouldn't allow to access. $privacy = $category->checkPrivacy(); if (!$privacy->allowed) { return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_HERE')); } // Get the nested categories $category->childs = null; EB::buildNestedCategories($category->id, $category); $linkage = ''; EB::accessNestedCategories($category, $linkage, '0', '', 'link', ', '); $catIds = array(); $catIds[] = $category->id; EB::accessNestedCategoriesId($category, $catIds); $category->nestedLink = $linkage; $model = EB::model('Blog'); $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd'); $posts = $model->getBlogsBy('category', $catIds, $sort); $posts = EB::formatter('list', $posts); $this->doc->link = EBR::_('index.php?option=com_easyblog&view=categories&id=' . $id . '&layout=listings'); $this->doc->setTitle($this->escape($category->getTitle())); $this->doc->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_CATEGORY_DESC', $this->escape($category->getTitle()))); if (!$posts) { return; } $uri = JURI::getInstance(); $scheme = $uri->toString(array('scheme')); $scheme = str_replace('://', ':', $scheme); foreach ($posts as $post) { $image = ''; if ($post->hasImage()) { $image = '<img src="' . $post->getImage('medium', true, true) . '" width="250" align="left" />'; } $item = new JFeedItem(); $item->title = $this->escape($post->title); $item->link = $post->getPermalink(); $item->description = $image . $post->getIntro(); // replace the image source to proper format so that feed reader can view the image correctly. $item->description = str_replace('src="//', 'src="' . $scheme . '//', $item->description); $item->description = str_replace('href="//', 'href="' . $scheme . '//', $item->description); $item->date = $post->getCreationDate()->toSql(); $item->category = $post->getPrimaryCategory()->getTitle(); $item->author = $post->author->getName(); $item->authorEmail = $this->getRssEmail($post->author); $this->doc->addItem($item); } // exit; }
function display($tmpl = null) { if (!$this->config->get('main_rss')) { return; } $model = EB::model('Blog'); $data = $model->getFeaturedBlog(); $document = JFactory::getDocument(); $document->link = EBR::_('index.php?option=com_easyblog&view=featured'); $document->setTitle(JText::_('COM_EASYBLOG_FEEDS_FEATURED_TITLE')); $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_FEATURED_DESC', JURI::root())); if (empty($data)) { return; } $uri = JURI::getInstance(); $scheme = $uri->toString(array('scheme')); $scheme = str_replace('://', ':', $scheme); foreach ($data as $row) { $blog = EB::table('Blog'); $blog->load($row->id); $profile = EB::user($row->created_by); $created = EB::date($row->created); $row->created = $created->toSql(); if ($this->config->get('main_rss_content') == 'introtext') { $row->text = !empty($row->intro) ? $row->intro : $row->content; //read more for feed $row->text .= '<br /><a href=' . EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>'; } else { $row->text = $row->intro . $row->content; } $row->text = EB::videos()->strip($row->text); $row->text = EB::adsense()->stripAdsenseCode($row->text); $category = EB::table('Category'); // Get primary category $primaryCategory = $blog->getPrimaryCategory(); $category->load($primaryCategory->id); // Assign to feed item $title = $this->escape($row->title); $title = html_entity_decode($title); // load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id); $item->description = $row->text; // replace the image source to proper format so that feed reader can view the image correctly. $item->description = str_replace('src="//', 'src="' . $scheme . '//', $item->description); $item->description = str_replace('href="//', 'href="' . $scheme . '//', $item->description); $item->date = $row->created; $item->category = $category->getTitle(); $item->author = $profile->getName(); $item->authorEmail = $this->getRssEmail($profile); $document->addItem($item); } }
/** * Appends the necessary rss fragments on existing url * * @since 4.0 * @access public * @param string * @return */ public function getFeedURL($url, $atom = false, $type = 'site') { if ($this->config->get('main_feedburner') && $type == 'site' && $this->config->get('main_feedburner_url') != '') { return $this->config->get('main_feedburner_url'); } $join = EasyBlogRouter::isSefEnabled() ? '?' : '&'; // Append the necessary queries $url = EBR::_($url) . $join . 'format=feed'; $url .= $atom ? '&type=atom' : '&type=rss'; return $url; }
/** * Retrieves the profile link * * @since 5.0 * @access public * @param string * @return */ public function getLink() { // If profile user is not an author for whatever reason it is, we shouldn't display it as a link if (!$this->config->get('main_nonblogger_profile')) { $isAuthor = EB::isBlogger($this->profile->id); if (!$isAuthor) { return 'javascript:void(0);'; } } $default = EBR::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $this->profile->id); return $default; }
/** * Allows caller to unsubscribe a person given the id of the subscription * * @since 5.0 * @access public */ public function unsubscribe() { // Default redirection url $redirect = EBR::_('index.php?option=com_easyblog&view=subscription', false); // Default redirection link should link to the front page if the user isn't logged in if ($this->my->guest) { $redirect = EBR::_('index.php?option=com_easyblog', false); } $return = $this->getReturnURL(); if ($return) { $redirect = $return; } // Get the subscription id $id = $this->input->get('id', 0, 'int'); $subscription = EB::table('Subscriptions'); // Load up the subscription if id is provided if ($id) { $subscription->load($id); // Verify if the user really has access to unsubscribe for guests if (!$subscription->id) { return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION')); } // Ensure that the registered user is allowed to unsubscribe. if ($subscription->user_id && $this->my->id != $subscription->user_id && !EB::isSiteAdmin()) { return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION')); } } else { // Try to get the email and what not from the query $data = $this->input->get('data', '', 'raw'); $data = base64_decode($data); $registry = new JRegistry($data); $id = $registry->get('sid', ''); $subscription->load($id); // Verify if the user really has access to unsubscribe for guests if (!$subscription->id) { return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION')); } // Get the token from the url and ensure that the token matches $token = $registry->get('token', ''); if ($token != md5($subscription->id . $subscription->created)) { JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION')); } } // Try to delete the subscription $state = $subscription->delete(); // Ensure that the user really owns this item if (!$state) { $this->info->set($subscription->getError()); return $this->app->redirect($redirect); } $this->info->set('COM_EASYBLOG_UNSUBSCRIBED_SUCCESS', 'success'); return $this->app->redirect($redirect); }
/** * Allows visitor to approve a comment * * @since 5.0 * @access public */ public function moderate() { // Get the hash key $key = $this->input->get('key', '', 'default'); // Default redirection url $redirect = EBR::_('index.php?option=com_easyblog', false); if (!$key) { $this->info->set('COM_EASYBLOG_NOT_ALLOWED', 'error'); return $this->app->redirect($redirect); } // Get the hashkey from the site $hashkey = EB::table('Hashkeys'); $state = $hashkey->loadByKey($key); // If the key doesn't exist, it may no longer be a valid request if (!$state || !$hashkey->id) { $this->info->set('COM_EASYBLOG_NOT_ALLOWED', 'error'); return $this->app->redirect($redirect); } // Load the comment now $comment = EB::table('Comment'); $comment->load($hashkey->uid); // Get the task to perform $task = $this->getTask(); // Load up the post library $post = EB::post($comment->post_id); if ($task == 'approve') { $comment->published = EBLOG_COMMENT_PUBLISHED; // Save the comment now $comment->store(true); // Process the mails for comments now $comment->processEmails(false, $post); // Update the sent flag for the comment $comment->updateSent(); } if ($task == 'reject') { $comment->published = EBLOG_COMMENT_UNPUBLISHED; $comment->store(true); } // Delete the unused hashkey now. $hashkey->delete(); $message = 'COM_EASYBLOG_MODERATE_COMMENT_PUBLISHED_SUCCESS'; if ($task == 'reject') { $message = 'COM_EASYBLOG_MODERATE_COMMENT_UNPUBLISHED_SUCCESS'; } $this->info->set($message, 'success'); // Get the permalink to the post $permalink = $post->getPermalink(false); return $this->app->redirect($permalink); }
public function display($tmpl = null) { // If user is already logged in, just redirect them if (!$this->my->guest) { $this->info->set(JText::_('COM_EASYBLOG_YOU_ARE_ALREADY_LOGIN'), 'error'); return $this->app->redirect(EBR::_('index.php?option=com_easyblog')); } // Determines if there's any return url $return = $this->input->get('return', ''); if (empty($return)) { $return = base64_encode(EBR::_('index.php?option=com_easyblog', false)); } $this->set('return', $return); parent::display('login/default'); }
function display($tmpl = null) { if (!$this->config->get('main_rss')) { return; } $id = $this->input->get('id', '', 'cmd'); $team = EB::table('TeamBlog'); $team->load($id); // if ($team->access != EBLOG_TEAMBLOG_ACCESS_EVERYONE ) { // return; // } $sort = JRequest::getCmd('sort', $this->config->get('layout_postorder')); $model = EB::model('Blog'); $data = $model->getBlogsBy('teamblog', $id, $sort); // $model = EB::model('TeamBlogs'); // $posts = $model->getPosts($team->id); // $posts = EB::formatter('list', $posts); $document = JFactory::getDocument(); $document->link = EBR::_('index.php?option=com_easyblog&view=latest'); $document->setTitle(JText::sprintf('COM_EASYBLOG_FEEDS_TEAMBLOGS_TITLE', $team->title)); $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_TEAMBLOGS_DESC', $team->title)); if (empty($data)) { return; } $uri = JURI::getInstance(); $scheme = $uri->toString(array('scheme')); $scheme = str_replace('://', ':', $scheme); $data = EB::formatter('list', $data); foreach ($data as $post) { $image = ''; if ($post->hasImage()) { $image = '<img src="' . $post->getImage('medium', true, true) . '" width="250" align="left" />'; } $item = new JFeedItem(); $item->title = $this->escape($post->title); $item->link = $post->getPermalink(); $item->description = $image . $post->getIntro(); // replace the image source to proper format so that feed reader can view the image correctly. $item->description = str_replace('src="//', 'src="' . $scheme . '//', $item->description); $item->description = str_replace('href="//', 'href="' . $scheme . '//', $item->description); $item->date = $post->getCreationDate()->toSql(); $item->category = $post->getPrimaryCategory()->getTitle(); $item->author = $post->author->getName(); $item->authorEmail = $this->getRssEmail($profile); $this->doc->addItem($item); } }
function request() { $mainframe = JFactory::getApplication(); if (!EasyBlogHelper::isLoggedIn()) { $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error'); $this->setRedirect(EBR::_('index.php?option=com_easyblog', false)); return; } $redirect = JRequest::getVar('redirect', ''); $type = JRequest::getCmd('type'); if (!empty($redirect)) { $redirect = '&redirect=' . $redirect; } $userId = JRequest::getVar('id'); // Flickr integration does not require user id. if (empty($userId)) { $mainframe->enqueueMessage(JText::_('Error, User not found.'), 'error'); $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false); $this->setRedirect($redirect); return; } $call = JRequest::getWord('call'); $callUri = !empty($call) ? '&call=' . $call . '&id=' . $userId : '&id=' . $userId; $config = EasyBlogHelper::getConfig(); $key = $config->get('integrations_' . $type . '_api_key'); $secret = $config->get('integrations_' . $type . '_secret_key'); $callback = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&c=oauth&task=grant&type=' . $type . $redirect . $callUri; $consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback); $request = $consumer->getRequestToken(); if (empty($request->token) || empty($request->secret)) { $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_KEY_INVALID'), 'error'); $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false); $this->setRedirect($redirect); return; } $oauth = EB::table('Oauth'); $oauth->user_id = $userId; $oauth->type = $type; $oauth->created = EB::date()->toMySQL(); // Bind the request tokens $param = EB::registry(); $param->set('token', $request->token); $param->set('secret', $request->secret); $oauth->request_token = $param->toString(); $oauth->store(); $this->setRedirect($consumer->getAuthorizationURL($request->token, false, 'popup')); }
/** * 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'); }
public function display($tmpl = null) { // Checks if rss is enabled if (!$this->config->get('main_rss')) { return; } // Get the archives model $model = EB::model('Archive'); // Get a list of posts $posts = $model->getPosts(); // Format the posts $posts = EB::formatter('list', $posts); // Set the link for this feed $this->doc->link = EBR::_('index.php?option=com_easyblog&view=archive'); $this->doc->setTitle(JText::_('COM_EASYBLOG_ARCHIVED_POSTS')); $this->doc->setDescription(JText::_('COM_EASYBLOG_ARCHIVED_POSTS_DESC')); if (!$posts) { return; } $uri = JURI::getInstance(); $scheme = $uri->toString(array('scheme')); $scheme = str_replace('://', ':', $scheme); foreach ($posts as $post) { $image = ''; if ($post->hasImage()) { $image = '<img src=' . $post->getImage('medium', true, true) . '" alt="' . $post->title . '" />'; } $item = new JFeedItem(); $item->title = $post->title; $item->link = $post->getPermalink(); $item->description = $image . $post->getIntro(); // replace the image source to proper format so that feed reader can view the image correctly. $item->description = str_replace('src="//', 'src="' . $scheme . '//', $item->description); $item->description = str_replace('href="//', 'href="' . $scheme . '//', $item->description); $item->date = $post->getCreationDate()->format(); $item->category = $post->getPrimaryCategory()->getTitle(); $item->author = $post->author->getName(); $item->authorEmail = $this->getRssEmail($post->author); $this->doc->addItem($item); } }
function display($tmpl = null) { if (!$this->config->get('main_rss')) { return; } $id = $this->input->get('id', '', 'cmd'); JTable::addIncludePath(EBLOG_TABLES); $tag = EB::table('Tag'); $tag->load($id); $sort = 'latest'; $model = EB::model('Blog'); $data = $model->getTaggedBlogs($id); $document = JFactory::getDocument(); $document->link = EBR::_('index.php?option=com_easyblog&view=latest'); $document->setTitle(JText::sprintf('COM_EASYBLOG_FEEDS_TAGS_TITLE', htmlentities($tag->title))); $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_TAGS_DESC', htmlentities($tag->title))); if (empty($data)) { return; } $data = EB::formatter('list', $data); foreach ($data as $post) { $image = ''; if ($post->getImage('medium', true, true)) { $image = '<img src="' . $post->getImage('medium', true, true) . '" width="250" align="left" />'; } $item = new JFeedItem(); $item->title = $this->escape($post->title); $item->link = $post->getPermalink(); $item->description = $image . $post->getIntro(); $item->date = $post->getCreationDate()->toSql(); $item->category = $post->getPrimaryCategory()->getTitle(); $item->author = $post->author->getName(); $item->authorEmail = $this->getRssEmail($profile); $this->doc->addItem($item); } }
/** * Converts to sef links * * @since 4.0 * @access public * @param string * @return */ public static function _($link, $xhtml = true) { require_once dirname(__FILE__) . '/router.php'; return EBR::_($link, $xhtml); }
</title> <content> <form data-form-delete-post method="post" action="<?php echo JRoute::_('index.php'); ?> "> <p><?php echo JText::_('COM_EASYBLOG_DIALOG_COMPOSER_DELETE_POST_CONFIRMATION'); ?> </p> <input type="hidden" name="ids" value="<?php echo $uid; ?> " /> <?php echo $this->html('form.hidden', 'return', base64_encode(EBR::_('index.php?option=com_easyblog&view=composer&tmpl=component', false))); ?> <?php echo $this->html('form.action', 'posts.delete'); ?> </form> </content> <buttons> <button data-close-button type="button" class="btn btn-default btn-sm"><?php echo JText::_('COM_EASYBLOG_CANCEL_BUTTON'); ?> </button> <button data-delete-button type="button" class="btn btn-danger btn-sm"><?php echo JText::_('COM_EASYBLOG_DELETE_BUTTON'); ?> </button>
$monthSEF = strlen($m) < 2 ? '0' . $m : $m; ?> <?php if (!isset($postCounts->{$i}->{$m})) { ?> <div class="eb-mod-item mod-month empty-month"> <?php echo $currentDate; ?> </div> <?php } else { ?> <div class="eb-mod-item"> <a class="eb-mod-media-thumb" href="<?php echo EBR::_('index.php?option=com_easyblog&view=calendar&year=' . $i . '&month=' . $m); ?> " <?php if ($defaultYear == $i && $defaultMonth == $m) { echo 'style="font-weight:700;"'; } ?> > <?php echo $currentDate; ?> <span class="mod-post-count">(<?php echo $postCounts->{$i}->{$m}; ?> )</span> </a>
/** * Generate a canonical tag on the header of the page * * @since 4.0 * @access public * @param string * @return */ public function canonical($url) { $url = EBR::_($url, false, null, true); $this->doc->addHeadLink($this->escape($url), 'canonical'); }
/** * Given a revision id, update the post to use the revision * * @since 5.0 * @access public * @param string * @return */ public function useRevision() { try { $this->verifyAccess(); } catch (EasyBlogException $exception) { dump($exception->getMessage()); } $return = $this->input->get('return', '', 'default'); $uid = $this->input->get('uid', '', 'default'); if (!$return) { $return = EBR::_('index.php?option=com_easyblog&view=composer&tmpl=component&uid=' . $uid, false); } else { $return = base64_decode($return); } // Load up the post $uid = $this->input->get('uid'); $post = EB::post($uid); $post->published = EASYBLOG_POST_PUBLISHED; $post->useRevision(); return $this->app->redirect($return); }
<a class="btn btn-primary" href="javascript:void(0);" data-eb-composer-revisions-compare> <?php echo JText::_('COM_EASYBLOG_COMPOSER_COMPARE'); ?> </a> </div> <?php if ($revision->id != $post->revision->id || $revision->isFinalized() || !$revision->isCurrent($post)) { ?> <div class="btn-group btn-group-xs"> <?php if ($revision->id != $post->revision->id) { ?> <a class="btn btn-default" href="<?php echo EBR::_('index.php?option=com_easyblog&view=composer&uid=' . $post->id . '.' . $revision->id . '&tmpl=component'); ?> "> <?php echo JText::_('COM_EASYBLOG_COMPOSER_OPEN_REVISION'); ?> </a> <?php } ?> <?php if ($revision->isFinalized()) { ?> <a class="btn btn-default" href="javascript:void(0);" data-eb-composer-revisions-use>
/** * Retrieves the external url * * @since 5.0 * @access public * @param string * @return */ public static function getRoutedURL($url, $xhtml = false, $external = false, $isCanonical = false) { // If this is not an external link, just pass it to joomla's router if (!$external) { return EBR::_($url, $xhtml, null, false, $isCanonical); } $app = JFactory::getApplication(); $uri = JURI::getInstance(); $dashboard = false; // Check if the current menu view is pointing to the dashboard view if (!$app->isAdmin()) { $menu = JFactory::getApplication()->getMenu()->getActive(); if (isset($menu->link) && $menu->link) { $pos = strpos($menu->link, 'view=dashboard'); if ($pos !== false) { $dashboard = true; } } } // Address issues with JRoute as it will include the /administrator/ portion in the url if this link // is being generated from the back end. if ($app->isAdmin() && EBR::isSefEnabled()) { $oriURL = $url; // We need to render our own router file. require_once JPATH_ROOT . '/components/com_easyblog/router.php'; if (!EB::isJoomla30()) { // below is required for joomla 2.5 require_once JPATH_ROOT . '/includes/router.php'; require_once JPATH_ROOT . '/includes/application.php'; } // Here we are tricking Joomla to assume that we are on the front end now. JFactory::$application = JApplication::getInstance('site'); $router = new JRouterSite(array('mode' => JROUTER_MODE_SEF)); $url = str_replace('/administrator', '/', EBR::_($oriURL, $xhtml, null, $dashboard, $isCanonical)); $url = rtrim(JURI::root(), '/') . '/' . ltrim(str_replace('/administrator/', '/', $url), '/'); $container = explode('/', $url); $container = array_unique($container); $url = implode('/', $container); // Update the "application" back so that it knows it's in the administrator area. JFactory::$application = JApplication::getInstance('administrator'); return $url; } $url = EBR::_($url, $xhtml, null, $dashboard, $isCanonical); $url = str_replace('/administrator/', '/', $url); $url = ltrim($url, '/'); // var_dump($url); // We need to use $uri->toString() because JURI::root() may contain a subfolder which will be duplicated // since $url already has the subfolder. return $uri->toString(array('scheme', 'host', 'port')) . '/' . $url; }
public function parseQuery() { $mainframe = JFactory::getApplication(); $query = JRequest::getVar('query', ''); $query = rtrim($query, '.'); $mainframe->redirect(EBR::_('index.php?option=com_easyblog&view=search&query=' . $query, false)); $mainframe->close(); }
?> "> <?php $i = 1; ?> <div class="ezb-grids"> <?php foreach ($posts as $post) { ?> <div class="ezb-grid" style="width: <?php echo 100 / $params->get('columns'); ?> %"> <a class="ezb-card" href="<?php echo EBR::_('index.php?option=com_easyblog&view=entry&id=' . $post->id); ?> " title="<?php echo $post->title; ?> " style="background-image: url('<?php echo $post->media; ?> ');"> <span><?php echo $post->title; ?> </span> </a> </div>
* other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Unauthorized Access'); $buttonLabel = 'COM_EASYBLOG_COMPOSER_SAVE_TO_DASHBOARD'; $buttonURL = EBR::_('index.php?option=com_easyblog&view=dashboard&layout=entries'); if ($post->isPending()) { $buttonLabel = 'COM_EASYBLOG_COMPOSER_SAVE_TO_DASHBOARD_PENDING'; $buttonURL = EBR::_('index.php?option=com_easyblog&view=dashboard&layout=moderate'); } if ($this->app->isAdmin()) { $buttonLabel = 'COM_EASYBLOG_COMPOSER_SAVE_TO_BACKEND_POSTS'; $buttonURL = EBR::_('index.php?option=com_easyblog&view=blogs'); if ($post->isPending()) { $buttonLabel = 'COM_EASYBLOG_COMPOSER_SAVE_TO_BACKEND_POSTS_PENDING'; $buttonURL = EBR::_('index.php?option=com_easyblog&view=blogs&layout=pending'); } } ?> <div class="eb-composer-saving text-center"> <div class="col-cell"> <h2 data-eb-composer-saving-message><?php echo JText::_('COM_EASYBLOG_COMPOSER_SAVING_PLEASE_WAIT'); ?> </h2> <h2 data-eb-composer-saving-info-message></h2> <div class="hide" data-eb-composer-saving-redirect-message> <?php echo JText::_('COM_EASYBLOG_COMPOSER_SAVE_REDIRECTING_DASHBOARD_WAIT');
/** * Determines if this comment is a spam * * @since 4.0 * @access public * @param string * @return */ public function isSpam() { $config = EB::config(); if (!$config->get('comment_akismet')) { return false; } $data = array('author' => $this->name, 'email' => $this->email, 'website' => JURI::root(), 'body' => $this->comment, 'permalink' => EBR::_('index.php?option=com_easyblog&view=entry&id=' . $this->post_id)); if (EB::akismet()->isSpam($data)) { return true; } return false; }
* @package EasyBlog * @copyright Copyright (C) 2010 Stack Ideas Private Limited. All rights reserved. * @license GNU/GPL, see LICENSE.php * * EasyBlog is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); $url = rtrim(JURI::base(), '/'); ?> <h1><a href="<?php echo $url . EBR::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id); ?> "><?php echo $post->title; ?> </a></h1> <p class="meta-bottom"> <?php echo JText::_('COM_EASYBLOG_POSTED_ON'); ?> <?php echo $post->getCreationDate()->format($this->config->get('layout_shortdateformat', JText::_('DATE_FORMAT_LC1'))); ?> , <?php echo JText::sprintf('COM_EASYBLOG_POSTED_BY_AUTHOR', $post->author->getProfileLink(), $post->author->getName());