Beispiel #1
0
	public function feed() {

		// get request vars
		$category_id = (int) $this->app->request->getInt('category_id', $this->params->get('category'));

		// get params
		$all_categories	= $this->application->getCategoryTree(true);

		// raise warning when category can not be accessed
		if (!isset($all_categories[$category_id])) {
			$this->app->error->raiseWarning(500, JText::_('Unable to access category'));
			return;
		}

		$category 		= $all_categories[$category_id];
		$params 	 	= $category_id ? $category->getParams('site') : $this->application->getParams('frontpage');
		$show_feed_link = $params->get('config.show_feed_link', 0);
		$feed_title     = $params->get('config.feed_title', '');

		// raise error when feed is link is disabled
		if (empty($show_feed_link)) {
			$this->app->error->raiseError(500, JText::_('Unable to access feed'));
			return;
		}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		JPluginHelper::importPlugin('content','osecontent');
		
		if(class_exists('plgContentOsecontent'))
		{
			$category =  plgContentOsecontent::checkZooCat($category);
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		// get feed items from category
		$categories = $category->getChildren(true);
		$categories[$category->id] = $category;

		$feed_limit = $this->joomla->getCfg('feed_limit');

		$feed_items = $this->app->table->item->getByCategory($this->application->id, array_keys($categories), true, null, 'created DESC', 0, $feed_limit);

		// set title
		if ($feed_title) {
			$this->app->document->setTitle($this->_buildPageTitle(html_entity_decode($this->getView()->escape($feed_title))));
		}

		// set feed link
		$this->app->document->link =  $this->app->link(array('task' => 'category'));

		// set renderer
		$renderer = $this->app->renderer->create('item')->addPath(array($this->app->path->path('component.site:'), $this->application->getTemplate()->getPath()));

		foreach ($feed_items as $feed_item) {

			// create feed item
			$item         	   = new JFeedItem();
			$item->title  	   = html_entity_decode($this->getView()->escape($feed_item->name));
			$item->link   	   = $this->app->route->item($feed_item);
			$item->date 	   = $feed_item->created;
			$item->author	   = $feed_item->getAuthor();
			$item->description = $this->_relToAbs($renderer->render('item.feed', array('item' => $feed_item)));

			// add to feed document
			$this->app->document->addItem($item);
		}

	}