__construct() public method

To use SimplePie, create the SimplePie object with no parameters. You can then set configuration options using the provided methods. After setting them, you must initialise the feed using $feed->init(). At that point the object's methods and properties will be available to you. Previously, it was possible to pass in the feed URL along with cache options directly into the constructor. This has been removed as of 1.3 as it caused a lot of confusion.
Since: 1.0 Preview Release
public __construct ( )
示例#1
0
 /**
  * Setup SimplePie
  * @param array $config Array with config values. Use simplepie function names
  */
 public function __construct($config = array())
 {
     parent::__construct();
     if (!empty($config)) {
         $this->initialize($config);
     }
 }
示例#2
0
    /**
     * Constructor - creates an instance of the SimplePie class
     * with Moodle defaults.
     *
     * @param string $feedurl optional URL of the feed
     */
    function __construct($feedurl = null) {

        // Use the Moodle class for http requests
        $this->file_class = 'moodle_simplepie_file';

        $cachedir = moodle_simplepie::get_cache_directory();
        check_dir_exists($cachedir);

        parent::__construct();
        // Match moodle encoding
        $this->set_output_encoding('UTF-8');

        // default to a short timeout as most operations will be interactive
        $this->set_timeout(2);

        // 1 hour default cache
        $this->set_cache_location($cachedir);
        $this->set_cache_duration(3600);

        // init the feed url if passed in constructor
        if ($feedurl !== null) {
            $this->set_feed_url($feedurl);
            $this->init();
        }
    }
 function __construct($site_ID)
 {
     switch (SIMPLEPIE_VERSION) {
         case '1.2.1':
             parent::SimplePie();
             break;
         case '1.3':
             parent::__construct();
             break;
         default:
             parent::__construct();
             break;
     }
     parent::__construct();
     $this->set_feed_url(get_post_meta($site_ID, 'syn_feed_url', true));
     $this->default_post_type = get_post_meta($site_ID, 'syn_default_post_type', true);
     $this->default_post_status = get_post_meta($site_ID, 'syn_default_post_status', true);
     $this->default_comment_status = get_post_meta($site_ID, 'syn_default_comment_status', true);
     $this->default_ping_status = get_post_meta($site_ID, 'syn_default_ping_status', true);
     $this->default_cat_status = get_post_meta($site_ID, 'syn_default_cat_status', true);
     add_action('syn_post_pull_new_post', array(__CLASS__, 'save_meta'), 10, 5);
     add_action('syn_post_pull_new_post', array(__CLASS__, 'save_tax'), 10, 5);
     add_action('syn_post_pull_edit_post', array(__CLASS__, 'update_meta'), 10, 5);
     add_action('syn_post_pull_edit_post', array(__CLASS__, 'update_tax'), 10, 5);
 }
 function rex_rssReader($feed_url = null, $cache_location = null, $cache_duration = null)
 {
     global $REX;
     if ($cache_location == null) {
         $cache_location = $REX['GENERATED_PATH'] . '/files/';
     }
     parent::__construct();
     $this->set_feed_url($feed_url);
     $this->set_cache_location($cache_location);
     $this->set_cache_duration($cache_duration);
     $this->init();
 }
 function __construct($feed_url = null)
 {
     global $CFG;
     // Use the Moodle class for http requests
     $this->file_class = 'moodle_simplepie_file';
     // Use sensible cache directory
     $cachedir = $CFG->dataroot . '/cache/simplepie/';
     if (!file_exists($cachedir)) {
         mkdir($cachedir, 0777, true);
     }
     parent::__construct($feed_url, $cachedir);
     parent::set_output_encoding('UTF-8');
 }
示例#6
0
 public function __construct($name, $feed, $website, $isDown)
 {
     $this->name = $name;
     $this->feed = $feed;
     $this->website = $website;
     $this->isDown = $isDown;
     parent::__construct();
     $this->set_item_class('PlanetItem');
     $this->set_cache_location(__DIR__ . '/../../cache');
     $this->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
     $this->set_feed_url($this->getFeed());
     $this->set_timeout(5);
     $this->set_stupidly_fast(true);
 }
示例#7
0
 /**
  * The icms_feeds_Simplerss class contains feed level data and options
  *
  * There are two ways that you can create a new icms_feeds_Simplerss object. The first
  * is by passing a feed URL as a parameter to the icms_feeds_Simplerss constructor
  * (as well as optionally setting the cache expiry - The cache location is automatically set
  * as ICMS_CACHE_PATH). This will initialise the whole feed with all of the default settings, and you
  * can begin accessing methods and properties immediately.
  *
  * The second way is to create the icms_feeds_Simplerss object with no parameters
  * at all. This will enable you to set configuration options. After setting
  * them, you must initialise the feed using $feed->init(). At that point the
  * object's methods and properties will be available to you.
  *
  * @access public
  * @param str $feed_url This is the URL you want to parse.
  * @param int $cache_duration This is the number of seconds that you want to store the cache file for.
  */
 public function __construct($feed_url = NULL, $cache_duration = NULL)
 {
     /* SimplePie 1.3+ does not accept arguments in the constructor */
     parent::__construct();
     $this->set_cache_location(ICMS_CACHE_PATH);
     if ($cache_duration !== NULL) {
         $this->set_cache_duration($cache_duration);
     }
     // Only init the script if we're passed a feed URL
     if ($feed_url !== NULL) {
         $this->set_feed_url($feed_url);
         $this->init();
     }
 }
示例#8
0
 /**
  * Class constructor.
  *
  * @param string  $feed_url       The URL to the feed (optional).
  * @param integer $cache_duration The duration (in seconds) that the feed contents will be retained in cache.
  */
 public function __construct($feed_url = null, $cache_duration = null, $cache_dir = null)
 {
     parent::__construct();
     if (isset($cache_dir)) {
         $this->set_cache_location($cache_dir);
     } else {
         $this->set_cache_location(CacheUtil::getLocalDir('feeds'));
     }
     if (isset($cache_duration)) {
         $this->set_cache_duration($cache_duration);
     }
     if (isset($feed_url)) {
         $this->set_feed_url($feed_url);
     }
 }
示例#9
0
 /**
  * Constructor - creates an instance of the SimplePie class
  * with Moodle defaults.
  *
  * @param string $feedurl optional URL of the feed
  * @param int $timeout how many seconds requests should wait for server response
  */
 public function __construct($feedurl = null, $timeout = 2)
 {
     $cachedir = moodle_simplepie::get_cache_directory();
     check_dir_exists($cachedir);
     parent::__construct();
     // Use the Moodle class for http requests
     $this->set_file_class('moodle_simplepie_file');
     // Use html purifier for text cleaning.
     $this->set_sanitize_class('moodle_simplepie_sanitize');
     $this->sanitize = new moodle_simplepie_sanitize();
     // Match moodle encoding
     $this->set_output_encoding('UTF-8');
     // default to a short timeout as most operations will be interactive
     $this->set_timeout($timeout);
     // 1 hour default cache
     $this->set_cache_location($cachedir);
     $this->set_cache_duration(3600);
     // init the feed url if passed in constructor
     if ($feedurl !== null) {
         $this->set_feed_url($feedurl);
         $this->init();
     }
 }
示例#10
0
文件: RSS.php 项目: shinichi81/peas3
 public function __construct()
 {
     parent::__construct();
 }
示例#11
0
 /**
  * Constructor. Set some defaults
  */
 function __construct()
 {
     parent::__construct();
     $this->enable_cache(false);
     $this->set_file_class('FeedParser_File');
 }