本文整理汇总了PHP中SimplePie::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::__construct方法的具体用法?PHP SimplePie::__construct怎么用?PHP SimplePie::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie
的用法示例。
在下文中一共展示了SimplePie::__construct方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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:
/**
* 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();
}
}
示例3: switch
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);
}
示例4:
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();
}
示例5: mkdir
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: __construct
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: __construct
/**
* 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: __construct
/**
* 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: __construct
/**
* 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: __construct
public function __construct()
{
parent::__construct();
}
示例11:
/**
* Constructor. Set some defaults
*/
function __construct()
{
parent::__construct();
$this->enable_cache(false);
$this->set_file_class('FeedParser_File');
}