Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
factory.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Legacy
4  * @subpackage Simplepie
5  *
6  * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
7  * @license GNU General Public License version 2 or later; see LICENSE
8  */
9 
10 defined('JPATH_PLATFORM') or die;
11 
12 jimport('simplepie.simplepie');
13 
14 /**
15  * Class to maintain a pathway.
16  *
17  * The user's navigated path within the application.
18  *
19  * @package Joomla.Legacy
20  * @subpackage Simplepie
21  * @since 12.2
22  * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use JFeed or supply your own methods
23  */
25 {
26  /**
27  * Get a parsed XML Feed Source
28  *
29  * @param string $url Url for feed source.
30  * @param integer $cache_time Time to cache feed for (using internal cache mechanism).
31  *
32  * @return mixed SimplePie parsed object on success, false on failure.
33  *
34  * @since 12.2
35  * @deprecated 4.0 Use JFeedFactory($url) instead.
36  *
37  * @note In 3.2 will be proxied to JFeedFactory()
38  */
39  public static function getFeedParser($url, $cache_time = 0)
40  {
41  JLog::add(__METHOD__ . ' is deprecated. Use JFeedFactory() or supply Simple Pie instead.', JLog::WARNING, 'deprecated');
42 
43  $cache = JFactory::getCache('feed_parser', 'callback');
44 
45  if ($cache_time > 0)
46  {
47  $cache->setLifeTime($cache_time);
48  }
49 
50  $simplepie = new SimplePie(null, null, 0);
51 
52  $simplepie->enable_cache(false);
53  $simplepie->set_feed_url($url);
54  $simplepie->force_feed(true);
55 
56  $contents = $cache->get(array($simplepie, 'init'), null, false, false);
57 
58  if ($contents)
59  {
60  return $simplepie;
61  }
62 
63  JLog::add(JText::_('JLIB_UTIL_ERROR_LOADING_FEED_DATA'), JLog::WARNING, 'jerror');
64 
65  return false;
66  }
67 }