function display($tmpl = null) { $config = EasyBlogHelper::getConfig(); $jConfig = EasyBlogHelper::getJConfig(); if (!$config->get('main_rss')) { return; } $model = $this->getModel('Featured'); $data = $model->getFeaturedBlog(); $document = JFactory::getDocument(); $document->link = EasyBlogRouter::_('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)) { for ($i = 0; $i < count($data); $i++) { $row =& $data[$i]; $profile = EasyBlogHelper::getTable('Profile', 'Table'); $profile->load($row->created_by); $created = EasyBlogDateHelper::dateWithOffSet($row->created); $formatDate = true; if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { $langCode = EasyBlogStringHelper::getLangCode(); if ($langCode != 'en-GB' || $langCode != 'en-US') { $formatDate = false; } } // $row->created = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat(); $row->created = $created->toMySQL(); if ($config->get('main_rss_content') == 'introtext') { $row->text = !empty($row->intro) ? $row->intro : $row->content; //read more for feed $row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>'; } else { $row->text = $row->intro . $row->content; } $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text); $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text); $category = EasyBlogHelper::getTable('Category', 'Table'); $category->load($row->category_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 = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id); $item->description = $row->text; $item->date = $row->created; $item->category = $category->title; $item->author = $profile->getName(); if ($jConfig->get('feed_email') == 'author') { $item->authorEmail = $profile->user->email; } else { $item->authorEmail = $jConfig->get('mailfrom'); } $document->addItem($item); } } }
public function mapPost($row, $strip_tags = '', $text_length = 0, $skip = array()) { $config = EasyBlogHelper::getConfig(); $blog = EasyBlogHelper::getTable('Blog'); $blog->load($row->id); $profile = EasyBlogHelper::getTable('Profile', 'Table'); $profile->load($row->created_by); $created = EasyBlogDateHelper::dateWithOffSet($row->created); $formatDate = true; if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { $langCode = EasyBlogStringHelper::getLangCode(); if ($langCode != 'en-GB' || $langCode != 'en-US') { $formatDate = false; } } $blog->created = $created->toMySQL(); $blog->text = $row->intro . $row->content; $config->set('max_video_width', 320); $config->set('max_video_width', 180); $blog->text = EasyBlogHelper::getHelper('Videos')->processVideos($blog->text); $blog->text = EasyBlogGoogleAdsense::stripAdsenseCode($blog->text); $category = EasyBlogHelper::getTable('Category', 'Table'); $category->load($row->category_id); $item = new PostSimpleSchema(); $item->textplain = $blog->text; // @TODO : Take care of a case when strip tags and length are used together if ($strip_tags) { $item->textplain = strip_tags($blog->text, $strip_tags); } if ($text_length > 0) { $pos = JString::strpos(strip_tags($item->textplain), ' ', $text_length); $item->textplain = JString::substr(strip_tags($blog->text), 0, $pos); } $image_data = json_decode($blog->image); $item->postid = $blog->id; $item->title = $blog->title; $item->text = $blog->text; $item->textplain = $this->sanitize($item->textplain); $item->image = $blog->getImage(); $item->image->url = $image_data->url; $item->created_date = $blog->created; $item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime($blog->created); $item->author->name = $profile->nickname; $item->author->photo = JURI::root() . $profile->avatar; $item->category->categoryid = $category->id; $item->category->title = $category->title; $item->url = JURI::root() . trim(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id), '/'); // Tags $modelPT = EasyBlogHelper::getModel('PostTag'); $item->tags = $modelPT->getBlogTags($blog->id); foreach ($skip as $v) { unset($item->{$v}); } return $item; }
function display($tmpl = null) { $config = EasyBlogHelper::getConfig(); $jConfig = EasyBlogHelper::getJConfig(); if (!$config->get('main_rss')) { return; } $mainframe = JFactory::getApplication(); $menuParams = $mainframe->getParams(); $date = EasyBlogHelper::getDate(); $sort = 'latest'; $model = $this->getModel('Archive'); $year = $model->getArchiveMinMaxYear(); $defaultYear = $menuParams->get('es_archieve_year', empty($year['maxyear']) ? $date->toFormat('%Y') : $year['maxyear']); $defaultMonth = $menuParams->get('es_archieve_month', $date->toFormat('%m')); $archiveYear = JRequest::getVar('archiveyear', $defaultYear, 'REQUEST'); $archiveMonth = JRequest::getVar('archivemonth', $defaultMonth, 'REQUEST'); $data = EasyBlogHelper::formatBlog($model->getArchive($archiveYear, $archiveMonth)); $pagination = $model->getPagination(); $params = $mainframe->getParams('com_easyblog'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); $document = JFactory::getDocument(); $viewDate = EasyBlogHelper::getDate($archiveYear . '-' . $archiveMonth . '-01'); $document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=archive'); $document->setTitle(JText::sprintf('COM_EASYBLOG_FEEDS_ARCHIVE_TITLE', $viewDate->toFormat('%B %Y'))); $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_ARCHIVE_DESC', $viewDate->toFormat('%B %Y'))); if (!empty($data)) { for ($i = 0; $i < count($data); $i++) { $row =& $data[$i]; $blog = EasyBlogHelper::getTable('Blog'); $blog->load($row->id); $profile = EasyBlogHelper::getTable('Profile', 'Table'); $profile->load($row->created_by); $created = EasyBlogDateHelper::dateWithOffSet($row->created); $formatDate = true; if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { $langCode = EasyBlogStringHelper::getLangCode(); if ($langCode != 'en-GB' || $langCode != 'en-US') { $formatDate = false; } } //$row->created = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat(); $row->created = $created->toMySQL(); if ($config->get('main_rss_content') == 'introtext') { $row->text = !empty($row->intro) ? $row->intro : $row->content; $row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>'; } else { $row->text = $row->intro . $row->content; } $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text); $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text); $image = ''; if ($blog->getImage()) { $image = '<img src="' . $blog->getImage()->getSource('frontpage') . '" />'; } $category = EasyBlogHelper::getTable('Category', 'Table'); $category->load($row->category_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 = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id); $item->description = $image . $row->text; $item->date = $row->created; $item->category = $category->title; $item->author = $profile->getName(); if ($jConfig->get('feed_email') == 'author') { $item->authorEmail = $profile->user->email; } else { $item->authorEmail = $jConfig->get('mailfrom'); } $document->addItem($item); } } }
function display($tmpl = null) { $config = EasyBlogHelper::getConfig(); $jConfig = EasyBlogHelper::getJConfig(); if (!$config->get('main_rss')) { return; } $id = JRequest::getInt('id', 0); $blogger = EasyBlogHelper::getTable('Profile', 'Table'); $blogger->load($id); $model = $this->getModel('Blog'); $data = $model->getBlogsBy('blogger', $blogger->id); $document = JFactory::getDocument(); $document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&id=' . $id . '&layout=listings'); $document->setTitle(JText::sprintf('COM_EASYBLOG_FEEDS_BLOGGER_TITLE', $blogger->getName())); $document->setDescription(strip_tags($blogger->description)); if (!empty($data)) { $modelPT = $this->getModel('PostTag'); for ($i = 0; $i < count($data); $i++) { $row =& $data[$i]; $blog = EasyBlogHelper::getTable('Blog'); $blog->load($row->id); $profile = EasyBlogHelper::getTable('Profile', 'Table'); $user = JFactory::getUser($row->created_by); $profile->load($user->id); $created = EasyBlogHelper::getDate($row->created); $formatDate = true; if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { $langCode = EasyBlogStringHelper::getLangCode(); if ($langCode != 'en-GB' || $langCode != 'en-US') { $formatDate = false; } } //$row->created = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat(); $row->created = $created->toMySQL(); if ($config->get('main_rss_content') == 'introtext') { $row->text = !empty($row->intro) ? $row->intro : $row->content; $row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>'; } else { $row->text = $row->intro . $row->content; } $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text); $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text); $image = ''; if ($blog->getImage()) { $image = '<img src="' . $blog->getImage()->getSource('frontpage') . '" />'; } $category = EasyBlogHelper::getTable('Category', 'Table'); $category->load($row->category_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 = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id); $item->description = $image . $row->text; $item->date = $row->created; $item->category = $category->title; $item->author = $profile->getName(); if ($jConfig->get('feed_email') == 'author') { $item->authorEmail = $profile->user->email; } else { $item->authorEmail = $jConfig->get('mailfrom'); } $document->addItem($item); } } }
function display($tmpl = null) { $config = EasyBlogHelper::getConfig(); $jConfig = EasyBlogHelper::getJConfig(); if (!$config->get('main_rss')) { return; } require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'date.php'; require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'helper.php'; require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'string.php'; require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'adsense.php'; $sort = JRequest::getCmd('sort', $config->get('layout_postorder')); $model = $this->getModel('Blog'); $data = $model->getBlogsBy('', '', $sort, 0, EBLOG_FILTER_PUBLISHED, null, true); $document = JFactory::getDocument(); $document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=latest'); $document->setTitle(JText::_('COM_EASYBLOG_FEEDS_LATEST_TITLE')); $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_LATEST_DESC', JURI::root())); if (!empty($data)) { $modelPT = $this->getModel('PostTag'); for ($i = 0; $i < count($data); $i++) { $row =& $data[$i]; $blog = EasyBlogHelper::getTable('Blog'); $blog->load($row->id); $user = JFactory::getUser($row->created_by); $profile = EasyBlogHelper::getTable('Profile', 'Table'); $profile->load($user->id); $created = EasyBlogDateHelper::dateWithOffSet($row->created); $formatDate = true; if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { $langCode = EasyBlogStringHelper::getLangCode(); if ($langCode != 'en-GB' || $langCode != 'en-US') { $formatDate = false; } } //$row->created = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat(); $row->created = $created->toMySQL(); if ($config->get('main_rss_content') == 'introtext') { $row->text = !empty($row->intro) ? $row->intro : $row->content; $row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>' . JText::_('COM_EASYBLOG_READ_MORE') . '</a>'; } else { $row->text = $row->intro . $row->content; //add read more in feed } $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text); $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text); $category = EasyBlogHelper::getTable('Category', 'Table'); $category->load($row->category_id); // Assign to feed item $title = $this->escape($row->title); $title = html_entity_decode($title); $image = ''; if ($blog->getImage()) { $image = '<img src="' . $blog->getImage()->getSource('frontpage') . '" />'; } // load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id); $item->description = $image . $row->text; $item->date = $row->created; $item->category = $category->title; $item->author = $profile->getName(); if ($jConfig->get('feed_email') != 'none') { if ($jConfig->get('feed_email') == 'author') { $item->authorEmail = $user->email; } else { $item->authorEmail = $jConfig->get('mailfrom'); } } $document->addItem($item); } } }
function display($tmpl = null) { $config = EasyBlogHelper::getConfig(); $jConfig = EasyBlogHelper::getJConfig(); if (!$config->get('main_rss')) { return; } $id = JRequest::getCmd('id', '0'); $category = EasyBlogHelper::getTable('Category', 'Table'); $category->load($id); // private category shouldn't allow to access. $privacy = $category->checkPrivacy(); if (!$privacy->allowed) { return; } if ($category->id == 0) { $category->title = JText::_('COM_EASYBLOG_UNCATEGORIZED'); } //get the nested categories $category->childs = null; EasyBlogHelper::buildNestedCategories($category->id, $category); $linkage = ''; EasyBlogHelper::accessNestedCategories($category, $linkage, '0', '', 'link', ', '); $catIds = array(); $catIds[] = $category->id; EasyBlogHelper::accessNestedCategoriesId($category, $catIds); $category->nestedLink = $linkage; $model = $this->getModel('Blog'); $sort = JRequest::getCmd('sort', $config->get('layout_postorder')); $data = $model->getBlogsBy('category', $catIds, $sort); $document = JFactory::getDocument(); $document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=categories&id=' . $id . '&layout=listings'); $document->setTitle($this->escape($category->title)); $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_CATEGORY_DESC', $this->escape($category->title))); if (empty($data)) { return; } for ($i = 0; $i < count($data); $i++) { $row =& $data[$i]; $blog = EasyBlogHelper::getTable('Blog'); $blog->load($row->id); $user = JFactory::getUser($row->created_by); $profile = EasyBlogHelper::getTable('Profile', 'Table'); $profile->load($user->id); $created = EasyBlogHelper::getDate($row->created); $formatDate = true; if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { $langCode = EasyBlogStringHelper::getLangCode(); if ($langCode != 'en-GB' || $langCode != 'en-US') { $formatDate = false; } } //$row->created = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat(); $row->created = $created->toMySQL(); if ($config->get('main_rss_content') == 'introtext') { $row->text = !empty($row->intro) ? $row->intro : $row->content; } else { $row->text = $row->intro . $row->content; } $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text); $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text); $image = ''; if ($blog->getImage()) { $image = '<img src="' . $blog->getImage()->getSource('frontpage') . '" />'; } // load individual item creator class $item = new JFeedItem(); $item->title = html_entity_decode($this->escape($row->title)); $item->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id); $item->description = $image . $row->text; $item->date = $row->created; $item->category = $category->title; $item->author = $profile->getName(); if ($jConfig->get('feed_email') == 'author') { $item->authorEmail = $profile->user->email; } else { $item->authorEmail = $jConfig->get('mailfrom'); } $document->addItem($item); } }