本文整理汇总了PHP中SimplePie_Misc类的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie_Misc类的具体用法?PHP SimplePie_Misc怎么用?PHP SimplePie_Misc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimplePie_Misc类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a new cache object
* @param string $location Location string (from SimplePie::$cache_location)
* @param string $name Unique ID for the cache
* @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
*/
public function __construct($location, $name, $type)
{
$this->options = array('host' => '127.0.0.1', 'port' => 11211, 'extras' => array('timeout' => 3600, 'prefix' => 'simplepie_'));
$this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
$this->name = $this->options['extras']['prefix'] . md5("{$name}:{$type}");
$this->cache = new Memcached();
$this->cache->addServer($this->options['host'], (int) $this->options['port']);
}
开发者ID:janeklb,项目名称:moodle,代码行数:14,代码来源:Memcached.php
示例2: test_from_file
/**
* @dataProvider firefoxtests
*/
public function test_from_file($data)
{
$locator = new SimplePie_Locator($data, 0, null, 'MockSimplePie_File', false);
$expected = SimplePie_Misc::get_element('link', $data->body);
$feed = $locator->find(SIMPLEPIE_LOCATOR_ALL, $all);
$this->assertFalse($locator->is_feed($data), 'HTML document not be a feed itself');
$this->assertInstanceOf('MockSimplePie_File', $feed);
$expected = array_map(array(get_class(), 'map_url_attrib'), $expected);
$success = array_filter($expected, array(get_class(), 'filter_success'));
$found = array_map(array(get_class(), 'map_url_file'), $all);
$this->assertEquals($success, $found);
}
开发者ID:hlubek,项目名称:Planetflow3-Package,代码行数:15,代码来源:LocatorTest.php
示例3: find
function find($uri = NULL)
{
$ret = array();
if (!is_null($this->data($uri))) {
if ($this->is_feed($uri)) {
$href = array($this->uri);
} else {
// Assume that we have HTML or XHTML (even if we don't, who's it gonna hurt?)
// Autodiscovery is the preferred method
$href = $this->_link_rel_feeds();
// ... but we'll also take the little orange buttons
$href = array_merge($href, $this->_a_href_feeds(TRUE));
// If all that failed, look harder
if (count($href) == 0) {
$href = $this->_a_href_feeds(FALSE);
}
// Our search may turn up duplicate URIs. We only need to do any given URI once.
// Props to Camilo <http://projects.radgeek.com/2008/12/14/feedwordpress-20081214/#comment-20090122160414>
$href = array_unique($href);
}
/* if */
// Try some clever URL little tricks before we go
$href = array_merge($href, $this->_url_manipulation_feeds());
$href = array_unique($href);
// Verify feeds and resolve relative URIs
foreach ($href as $u) {
$the_uri = SimplePie_Misc::absolutize_url($u, $this->uri);
if ($this->verify and ($u != $this->uri and $the_uri != $this->uri)) {
$feed = new FeedFinder($the_uri);
if ($feed->is_feed()) {
$ret[] = $the_uri;
}
unset($feed);
} else {
$ret[] = $the_uri;
}
}
/* foreach */
}
/* if */
return array_values($ret);
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:42,代码来源:feedfinder.class.php
示例4: extractFromPage
/**
* Tries to get a favicon from a page
* @param string $url the url to the page
* @return string the full url to the page
*/
protected function extractFromPage($url)
{
if (!$url) {
return null;
}
$file = $this->getFile($url);
if ($file->body !== '') {
$document = new \DOMDocument();
@$document->loadHTML($file->body);
if ($document) {
$xpath = new \DOMXpath($document);
$elements = $xpath->query("//link[contains(@rel, 'icon')]");
if ($elements->length > 0) {
$iconPath = $elements->item(0)->getAttribute('href');
$absPath = \SimplePie_Misc::absolutize_url($iconPath, $url);
return $absPath;
}
}
}
}
开发者ID:hroo772,项目名称:news,代码行数:25,代码来源:faviconfetcher.php
示例5: __construct
public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
{
if (class_exists('idna_convert')) {
$idn = new idna_convert();
$parsed = SimplePie_Misc::parse_url($url);
$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
}
$this->url = $url;
$this->useragent = $useragent;
if (preg_match('/^http(s)?:\\/\\//i', $url)) {
if (!is_array($headers)) {
$headers = array();
}
$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
$headers2 = array();
foreach ($headers as $key => $value) {
$headers2[] = "{$key}: {$value}";
}
//TODO: allow for HTTP headers
// curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
$response = self::$agent->get($url);
if ($response === false || !isset($response['status_code'])) {
$this->error = 'failed to fetch URL';
$this->success = false;
} else {
// The extra lines at the end are there to satisfy SimplePie's HTTP parser.
// The class expects a full HTTP message, whereas we're giving it only
// headers - the new lines indicate the start of the body.
$parser = new SimplePie_HTTP_Parser($response['headers'] . "\r\n\r\n");
if ($parser->parse()) {
$this->headers = $parser->headers;
//$this->body = $parser->body;
$this->body = $response['body'];
$this->status_code = $parser->status_code;
}
}
} else {
$this->error = 'invalid URL';
$this->success = false;
}
}
开发者ID:jaimejorge,项目名称:ftr-site-config-build,代码行数:41,代码来源:SimplePie_HumbleHttpAgent.php
示例6: __construct
/**
* Create a new cache object
*
* @param string $location Location string (from SimplePie::$cache_location)
* @param string $name Unique ID for the cache
* @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
*/
public function __construct($location, $name, $type)
{
$this->options = array('user' => null, 'pass' => null, 'host' => '127.0.0.1', 'port' => '3306', 'path' => '', 'extras' => array('prefix' => '', 'cache_purge_time' => 2592000));
$this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
// Path is prefixed with a "/"
$this->options['dbname'] = substr($this->options['path'], 1);
try {
$this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
} catch (PDOException $e) {
$this->mysql = null;
return;
}
$this->id = $name . $type;
if (!($query = $this->mysql->query('SHOW TABLES'))) {
$this->mysql = null;
return;
}
$db = array();
while ($row = $query->fetchColumn()) {
$db[] = $row;
}
if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db)) {
$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))');
if ($query === false) {
trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING);
$this->mysql = null;
return;
}
}
if (!in_array($this->options['extras']['prefix'] . 'items', $db)) {
$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))');
if ($query === false) {
trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING);
$this->mysql = null;
return;
}
}
}
开发者ID:janeklb,项目名称:moodle,代码行数:45,代码来源:MySQL.php
示例7: get_copyright
public function get_copyright()
{
if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) {
return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) {
return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) {
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) {
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) {
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
} else {
return null;
}
}
开发者ID:Thingee,项目名称:openstack-org,代码行数:16,代码来源:Core.php
示例8:
<?php
require_once "config.php";
require_once "lib/simplepie/simplepie.inc";
SimplePie_Misc::display_cached_file($_GET['i'], SIMPLEPIE_CACHE_DIR, 'spi');
开发者ID:buggithubs,项目名称:Tiny-Tiny-RSS,代码行数:5,代码来源:image.php
示例9: find
function find($uri = NULL, $params = array())
{
$params = wp_parse_args($params, array("authentication" => -1, "username" => NULL, "password" => NULL));
// Equivalents
if ($params['authentication'] == '-') {
$params['authentication'] = NULL;
$params['username'] = NULL;
$params['password'] = NULL;
}
// Set/reset
if ($params['authentication'] != -1) {
$this->credentials = array("authentication" => $params['authentication'], "username" => $params['username'], "password" => $params['password']);
}
$ret = array();
if (!is_null($this->data($uri))) {
if ($this->is_opml($uri)) {
$href = $this->_opml_rss_uris();
} else {
if ($this->is_feed($uri)) {
$href = array($this->uri);
} else {
// Assume that we have HTML or XHTML (even if we don't, who's
// it gonna hurt?) Autodiscovery is the preferred method.
$href = $this->_link_rel_feeds();
// ... but we'll also take the little orange buttons
if ($this->fallbacks > 0) {
$href = array_merge($href, $this->_a_href_feeds(TRUE));
}
// If all that failed, look harder
if ($this->fallbacks > 1) {
if (count($href) == 0) {
$href = $this->_a_href_feeds(FALSE);
}
}
// Our search may turn up duplicate URIs. We only need to do
// any given URI once. Props to Camilo <http://projects.radgeek.com/2008/12/14/feedwordpress-20081214/#comment-20090122160414>
$href = array_unique($href);
}
// Try some clever URL little tricks before we go
if ($this->fallbacks > 2) {
$href = array_merge($href, $this->_url_manipulation_feeds());
}
}
$href = array_unique($href);
// Verify feeds and resolve relative URIs
foreach ($href as $u) {
$the_uri = SimplePie_Misc::absolutize_url($u, $this->uri);
if ($this->verify and ($u != $this->uri and $the_uri != $this->uri)) {
$feed = new FeedFinder($the_uri, $this->credentials);
if ($feed->is_feed()) {
$ret[] = $the_uri;
}
unset($feed);
} else {
$ret[] = $the_uri;
}
}
}
if ($this->is_401($uri)) {
$ret = array_merge(array(new WP_Error('http_request_failed', '401 Not authorized', array("uri" => $this->uri, "status" => 401))), $ret);
}
return array_values($ret);
}
开发者ID:radgeek,项目名称:feedwordpress,代码行数:63,代码来源:feedfinder.class.php
示例10: get_enclosures
/**
* Grabs all available enclosures (podcasts, etc.)
*
* Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
*
* At this point, we're pretty much assuming that all enclosures for an item are the same content. Anything else is too complicated to properly support.
*
* @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
* @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists).
*/
public function get_enclosures()
{
if (!isset($this->data['enclosures'])) {
$this->data['enclosures'] = array();
// Elements
$captions_parent = null;
$categories_parent = null;
$copyrights_parent = null;
$credits_parent = null;
$description_parent = null;
$duration_parent = null;
$hashes_parent = null;
$keywords_parent = null;
$player_parent = null;
$ratings_parent = null;
$restrictions_parent = null;
$thumbnails_parent = null;
$title_parent = null;
// Let's do the channel and item-level ones first, and just re-use them if we need to.
$parent = $this->get_feed();
// CAPTIONS
if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) {
foreach ($captions as $caption) {
$caption_type = null;
$caption_lang = null;
$caption_startTime = null;
$caption_endTime = null;
$caption_text = null;
if (isset($caption['attribs']['']['type'])) {
$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['attribs']['']['lang'])) {
$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['attribs']['']['start'])) {
$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['attribs']['']['end'])) {
$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['data'])) {
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
$captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
}
} elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) {
foreach ($captions as $caption) {
$caption_type = null;
$caption_lang = null;
$caption_startTime = null;
$caption_endTime = null;
$caption_text = null;
if (isset($caption['attribs']['']['type'])) {
$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['attribs']['']['lang'])) {
$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['attribs']['']['start'])) {
$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['attribs']['']['end'])) {
$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($caption['data'])) {
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
$captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
}
}
if (is_array($captions_parent)) {
$captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent));
}
// CATEGORIES
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) {
$term = null;
$scheme = null;
$label = null;
if (isset($category['data'])) {
$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($category['attribs']['']['scheme'])) {
$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
} else {
$scheme = 'http://search.yahoo.com/mrss/category_schema';
}
if (isset($category['attribs']['']['label'])) {
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
}
$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
//.........这里部分代码省略.........
开发者ID:oxmcvusd,项目名称:full-text-rss-1,代码行数:101,代码来源:Item.php
示例11: __construct
public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
{
if (class_exists('idna_convert')) {
$idn = new idna_convert();
$parsed = SimplePie_Misc::parse_url($url);
$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
}
$this->url = $url;
$this->useragent = $useragent;
if (preg_match('/^http(s)?:\\/\\//i', $url)) {
if ($useragent === null) {
$useragent = ini_get('user_agent');
$this->useragent = $useragent;
}
if (!is_array($headers)) {
$headers = array();
}
if (!$force_fsockopen && function_exists('curl_exec')) {
$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
$fp = curl_init();
$headers2 = array();
foreach ($headers as $key => $value) {
$headers2[] = "{$key}: {$value}";
}
if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>=')) {
curl_setopt($fp, CURLOPT_ENCODING, '');
}
curl_setopt($fp, CURLOPT_URL, $url);
curl_setopt($fp, CURLOPT_HEADER, 1);
curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($fp, CURLOPT_REFERER, $url);
curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) {
curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
}
$this->headers = curl_exec($fp);
if (curl_errno($fp) === 23 || curl_errno($fp) === 61) {
curl_setopt($fp, CURLOPT_ENCODING, 'none');
$this->headers = curl_exec($fp);
}
if (curl_errno($fp)) {
$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
$this->success = false;
} else {
$info = curl_getinfo($fp);
curl_close($fp);
$this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
$this->headers = array_pop($this->headers);
$parser = new SimplePie_HTTP_Parser($this->headers);
if ($parser->parse()) {
$this->headers = $parser->headers;
$this->body = $parser->body;
$this->status_code = $parser->status_code;
if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) {
$this->redirects++;
$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
return $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
}
}
}
} else {
$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
$url_parts = parse_url($url);
$socket_host = $url_parts['host'];
if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') {
$socket_host = "ssl://{$url_parts['host']}";
$url_parts['port'] = 443;
}
if (!isset($url_parts['port'])) {
$url_parts['port'] = 80;
}
$fp = @fsockopen($socket_host, $url_parts['port'], $errno, $errstr, $timeout);
if (!$fp) {
$this->error = 'fsockopen error: ' . $errstr;
$this->success = false;
} else {
stream_set_timeout($fp, $timeout);
if (isset($url_parts['path'])) {
if (isset($url_parts['query'])) {
$get = "{$url_parts['path']}?{$url_parts['query']}";
} else {
$get = $url_parts['path'];
}
} else {
$get = '/';
}
$out = "GET {$get} HTTP/1.1\r\n";
$out .= "Host: {$url_parts['host']}\r\n";
$out .= "User-Agent: {$useragent}\r\n";
if (extension_loaded('zlib')) {
$out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
}
if (isset($url_parts['user']) && isset($url_parts['pass'])) {
$out .= "Authorization: Basic " . base64_encode("{$url_parts['user']}:{$url_parts['pass']}") . "\r\n";
}
foreach ($headers as $key => $value) {
//.........这里部分代码省略.........
开发者ID:kosir,项目名称:wp-pipes,代码行数:101,代码来源:File.php
示例12: replace_urls
function replace_urls($data, $tag, $attributes)
{
if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags)) {
$elements = SimplePie_Misc::get_element($tag, $data);
foreach ($elements as $element) {
if (is_array($attributes)) {
foreach ($attributes as $attribute) {
if (isset($element['attribs'][$attribute]['data'])) {
$element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base);
$new_element = SimplePie_Misc::element_implode($element);
$data = str_replace($element['full'], $new_element, $data);
$element['full'] = $new_element;
}
}
} elseif (isset($element['attribs'][$attributes]['data'])) {
$element['attribs'][$attributes]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attributes]['data'], $this->base);
$data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data);
}
}
}
return $data;
}
开发者ID:jojospaghettio,项目名称:wicketpixie,代码行数:22,代码来源:simplepie.php
示例13: define
* @package Lilina
* @version 1.0
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/** */
define('LILINA_PATH', dirname(__FILE__));
define('LILINA_INCPATH', LILINA_PATH . '/inc');
define('LILINA_PAGE', 'favicon');
// Hide errors
ini_set('display_errors', false);
require_once LILINA_INCPATH . '/contrib/simplepie.class.php';
if (!isset($_GET['i'])) {
die;
}
require_once LILINA_INCPATH . '/core/conf.php';
require_once LILINA_INCPATH . '/core/plugin-functions.php';
function faux_hash($input)
{
return $input;
}
if ($_GET['i'] != 'default' && file_exists(LILINA_CACHE_DIR . $_GET['i'] . '.spi')) {
SimplePie_Misc::display_cached_file($_GET['i'], LILINA_CONTENT_DIR . '/system/cache', 'spi', 'SimplePie_Cache', 'faux_hash');
} else {
require_once LILINA_INCPATH . '/core/class-templates.php';
Locale::load_default_textdomain();
header('Content-Type: image/png');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT');
// 7 days
echo file_get_contents(Templates::get_file('feed.png'));
die;
}
开发者ID:rmccue,项目名称:Lilina,代码行数:31,代码来源:lilina-favicon.php
示例14: result
function result()
{
if ($this->data['file']->url != 'http://diveintomark.org/tests/client/autodiscovery/') {
parent::result();
}
static $done = array();
$links = SimplePie_Misc::get_element('link', $this->data['file']->body);
foreach ($links as $link) {
if (!empty($link['attribs']['href']['data']) && !empty($link['attribs']['rel']['data'])) {
$rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->data['file']->url);
if (!in_array($href, $done) && in_array('next', $rel)) {
$done[] = $this->data['url'] = $href;
break;
}
}
}
if ($this->data['url']) {
$this->run();
}
}
开发者ID:patrickmj,项目名称:FeedImporter,代码行数:21,代码来源:functions.php
示例15: entity
/**
* Decode an entity
*
* @access private
*/
public function entity()
{
switch ($this->consume()) {
case "\t":
case "\n":
case "\v":
case "\v":
case "\f":
case " ":
case "<":
case "&":
case false:
break;
case "#":
switch ($this->consume()) {
case "x":
case "X":
$range = '0123456789ABCDEFabcdef';
$hex = true;
break;
default:
$range = '0123456789';
$hex = false;
$this->unconsume();
break;
}
if ($codepoint = $this->consume_range($range)) {
static $windows_1252_specials = array(0xd => "\n", 0x80 => "€", 0x81 => "�", 0x82 => "‚", 0x83 => "ƒ", 0x84 => "„", 0x85 => "…", 0x86 => "†", 0x87 => "‡", 0x88 => "ˆ", 0x89 => "‰", 0x8a => "Š", 0x8b => "‹", 0x8c => "Œ", 0x8d => "�", 0x8e => "Ž", 0x8f => "�", 0x90 => "�", 0x91 => "‘", 0x92 => "’", 0x93 => "“", 0x94 => "”", 0x95 => "•", 0x96 => "–", 0x97 => "—", 0x98 => "˜", 0x99 => "™", 0x9a => "š", 0x9b => "›", 0x9c => "œ", 0x9d => "�", 0x9e => "ž", 0x9f => "Ÿ");
if ($hex) {
$codepoint = hexdec($codepoint);
} else {
$codepoint = intval($codepoint);
}
if (isset($windows_1252_specials[$codepoint])) {
$replacement = $windows_1252_specials[$codepoint];
} else {
$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
}
if (!in_array($this->consume(), array(';', false), true)) {
$this->unconsume();
}
$consumed_length = strlen($this->consumed);
$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
$this->position += strlen($replacement) - $consumed_length;
}
break;
default:
static $entities = array('Aacute' => "Á", 'aacute' => "á", 'Aacute;' => "Á", 'aacute;' => "á", 'Acirc' => "Â", 'acirc' => "â", 'Acirc;' => "Â", 'acirc;' => "â", 'acute' => "´", 'acute;' => "´", 'AElig' => "Æ", 'aelig' => "æ", 'AElig;' => "Æ", 'aelig;' => "æ", 'Agrave' => "À", 'agrave' => "à", 'Agrave;' => "À", 'agrave;' => "à", 'alefsym;' => "ℵ", 'Alpha;' => "Α", 'alpha;' => "α", 'AMP' => "&", 'amp' => "&", 'AMP;' => "&", 'amp;' => "&", 'and;' => "∧", 'ang;' => "∠", 'apos;' => "'", 'Aring' => "Å", 'aring' => "å", 'Aring;' => "Å", 'aring;' => "å", 'asymp;' => "≈", 'Atilde' => "Ã", 'atilde' => "ã", 'Atilde;' => "Ã", 'atilde;' => "ã", 'Auml' => "Ä", 'auml' => "ä", 'Auml;' => "Ä", 'auml;' => "ä", 'bdquo;' => "„", 'Beta;' => "Β", 'beta;' => "β", 'brvbar' => "¦", 'brvbar;' => "¦", 'bull;' => "•", 'cap;' => "∩", 'Ccedil' => "Ç", 'ccedil' => "ç", 'Ccedil;' => "Ç", 'ccedil;' => "ç", 'cedil' => "¸", 'cedil;' => "¸", 'cent' => "¢", 'cent;' => "¢", 'Chi;' => "Χ", 'chi;' => "χ", 'circ;' => "ˆ", 'clubs;' => "♣", 'cong;' => "≅", 'COPY' => "©", 'copy' => "©", 'COPY;' => "©", 'copy;' => "©", 'crarr;' => "↵", 'cup;' => "∪", 'curren' => "¤", 'curren;' => "¤", 'Dagger;' => "‡", 'dagger;' => "†", 'dArr;' => "⇓", 'darr;' => "↓", 'deg' => "°", 'deg;' => "°", 'Delta;' => "Δ", 'delta;' => "δ", 'diams;' => "♦", 'divide' => "÷", 'divide;' => "÷", 'Eacute' => "É", 'eacute' => "é", 'Eacute;' => "É", 'eacute;' => "é", 'Ecirc' => "Ê", 'ecirc' => "ê", 'Ecirc;' => "Ê", 'ecirc;' => "ê", 'Egrave' => "È", 'egrave' => "è", 'Egrave;' => "È", 'egrave;' => "è", 'empty;' => "∅", 'emsp;' => " ", 'ensp;' => " ", 'Epsilon;' => "Ε", 'epsilon;' => "ε", 'equiv;' => "≡", 'Eta;' => "Η", 'eta;' => "η", 'ETH' => "Ð", 'eth' => "ð", 'ETH;' => "Ð", 'eth;' => "ð", 'Euml' => "Ë", 'euml' => "ë", 'Euml;' => "Ë", 'euml;' => "ë", 'euro;' => "€", 'exist;' => "∃", 'fnof;' => "ƒ", 'forall;' => "∀", 'frac12' => "½", 'frac12;' => "½", 'frac14' => "¼", 'frac14;' => "¼", 'frac34' => "¾", 'frac34;' => "¾", 'frasl;' => "⁄", 'Gamma;' => "Γ", 'gamma;' => "γ", 'ge;' => "≥", 'GT' => ">", 'gt' => ">", 'GT;' => ">", 'gt;' => ">", 'hArr;' => "⇔", 'harr;' => "↔", 'hearts;' => "♥", 'hellip;' => "…", 'Iacute' => "Í", 'iacute' => "í", 'Iacute;' => "Í", 'iacute;' => "í", 'Icirc' => "Î", 'icirc' => "î", 'Icirc;' => "Î", 'icirc;' => "î", 'iexcl' => "¡", 'iexcl;' => "¡", 'Igrave' => "Ì", 'igrave' => "ì", 'Igrave;' => "Ì", 'igrave;' => "ì", 'image;' => "ℑ", 'infin;' => "∞", 'int;' => "∫", 'Iota;' => "Ι", 'iota;' => "ι", 'iquest' => "¿", 'iquest;' => "¿", 'isin;' => "∈", 'Iuml' => "Ï", 'iuml' => "ï", 'Iuml;' => "Ï", 'iuml;' => "ï", 'Kappa;' => "Κ", 'kappa;' => "κ", 'Lambda;' => "Λ", 'lambda;' => "λ", 'lang;' => "〈", 'laquo' => "«", 'laquo;' => "«", 'lArr;' => "⇐", 'larr;' => "←", 'lceil;' => "⌈", 'ldquo;' => "“", 'le;' => "≤", 'lfloor;' => "⌊", 'lowast;' => "∗", 'loz;' => "◊", 'lrm;' => "", 'lsaquo;' => "‹", 'lsquo;' => "‘", 'LT' => "<", 'lt' => "<", 'LT;' => "<", 'lt;' => "<", 'macr' => "¯", 'macr;' => "¯", 'mdash;' => "—", 'micro' => "µ", 'micro;' => "µ", 'middot' => "·", 'middot;' => "·", 'minus;' => "−", 'Mu;' => "Μ", 'mu;' => "μ", 'nabla;' => "∇", 'nbsp' => " ", 'nbsp;' => " ", 'ndash;' => "–", 'ne;' => "≠", 'ni;' => "∋", 'not' => "¬", 'not;' => "¬", 'notin;' => "∉", 'nsub;' => "⊄", 'Ntilde' => "Ñ", 'ntilde' => "ñ", 'Ntilde;' => "Ñ", 'ntilde;' => "ñ", 'Nu;' => "Ν", 'nu;' => "ν", 'Oacute' => "Ó", 'oacute' => "ó", 'Oacute;' => "Ó", 'oacute;' => "ó", 'Ocirc' => "Ô", 'ocirc' => "ô", 'Ocirc;' => "Ô", 'ocirc;' => "ô", 'OElig;' => "Œ", 'oelig;' => "œ", 'Ograve' => "Ò", 'ograve' => "ò", 'Ograve;' => "Ò", 'ograve;' => "ò", 'oline;' => "‾", 'Omega;' => "Ω", 'omega;' => "ω", 'Omicron;' => "Ο", 'omicron;' => "ο", 'oplus;' => "⊕", 'or;' => "∨", 'ordf' => "ª", 'ordf;' => "ª", 'ordm' => "º", 'ordm;' => "º", 'Oslash' => "Ø", 'oslash' => "ø", 'Oslash;' => "Ø", 'oslash;' => "ø", 'Otilde' => "Õ", 'otilde' => "õ", 'Otilde;' => "Õ", 'otilde;' => "õ", 'otimes;' => "⊗", 'Ouml' => "Ö", 'ouml' => "ö", 'Ouml;' => "Ö", 'ouml;' => "ö", 'para' => "¶", 'para;' => "¶", 'part;' => "∂", 'permil;' => "‰", 'perp;' => "⊥", 'Phi;' => "Φ", 'phi;' => "φ", 'Pi;' => "Π", 'pi;' => "π", 'piv;' => "ϖ", 'plusmn' => "±", 'plusmn;' => "±", 'pound' => "£", 'pound;' => "£", 'Prime;' => "″", 'prime;' => "′", 'prod;' => "∏", 'prop;' => "∝", 'Psi;' => "Ψ", 'psi;' => "ψ", 'QUOT' => "\"", 'quot' => "\"", 'QUOT;' => "\"", 'quot;' => "\"", 'radic;' => "√", 'rang;' => "〉", 'raquo' => "»", 'raquo;' => "»", 'rArr;' => "⇒", 'rarr;' => "→", 'rceil;' => "⌉", 'rdquo;' => "”", 'real;' => "ℜ", 'REG' => "®", 'reg' => "®", 'REG;' => "®", 'reg;' => "®", 'rfloor;' => "⌋", 'Rho;' => "Ρ", 'rho;' => "ρ", 'rlm;' => "", 'rsaquo;' => "›", 'rsquo;' => "’", 'sbquo;' => "‚", 'Scaron;' => "Š", 'scaron;' => "š", 'sdot;' => "⋅", 'sect' => "§", 'sect;' => "§", 'shy' => "", 'shy;' => "", 'Sigma;' => "Σ", 'sigma;' => "σ", 'sigmaf;' => "ς", 'sim;' => "∼", 'spades;' => "♠", 'sub;' => "⊂", 'sube;' => "⊆", 'sum;' => "∑", 'sup;' => "⊃", 'sup1' => "¹", 'sup1;' => "¹", 'sup2' => "²", 'sup2;' => "²", 'sup3' => "³", 'sup3;' => "³", 'supe;' => "⊇", 'szlig' => "ß", 'szlig;' => "ß", 'Tau;' => "Τ", 'tau;' => "τ", 'there4;' => "∴", 'Theta;' => "Θ", 'theta;' => "θ", 'thetasym;' => "ϑ", 'thinsp;' => " ", 'THORN' => "Þ", 'thorn' => "þ", 'THORN;' => "Þ", 'thorn;' => "þ", 'tilde;' => "˜", 'times' => "×", 'times;' => "×", 'TRADE;' => "™", 'trade;' => "™", 'Uacute' => "Ú", 'uacute' => "ú", 'Uacute;' => "Ú", 'uacute;' => "ú", 'uArr;' => "⇑", 'uarr;' => "↑", 'Ucirc' => "Û", 'ucirc' => "û", 'Ucirc;' => "Û", 'ucirc;' => "û", 'Ugrave' => "Ù", 'ugrave' => "ù", 'Ugrave;' => "Ù", 'ugrave;' => "ù", 'uml' => "¨", 'uml;' => "¨", 'upsih;' => "ϒ", 'Upsilon;' => "Υ", 'upsilon;' => "υ", 'Uuml' => "Ü", 'uuml' => "ü", 'Uuml;' => "Ü", 'uuml;' => "ü", 'weierp;' => "℘", 'Xi;' => "Ξ", 'xi;' => "ξ", 'Yacute' => "Ý", 'yacute' => "ý", 'Yacute;' => "Ý", 'yacute;' => "ý", 'yen' => "¥", 'yen;' => "¥", 'yuml' => "ÿ", 'Yuml;' => "Ÿ", 'yuml;' => "ÿ", 'Zeta;' => "Ζ", 'zeta;' => "ζ", 'zwj;' => "", 'zwnj;' => "");
for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) {
$consumed = substr($this->consumed, 1);
if (isset($entities[$consumed])) {
$match = $consumed;
}
}
if ($match !== null) {
$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
}
break;
}
}
开发者ID:kadrim1,项目名称:metsayhistu,代码行数:66,代码来源:Entities.php
示例16: _loadRSS
/**
* Loads images from a MediaRSS or ATOM feed
*/
function _loadRSS($url)
{
require_once DOKU_INC . 'inc/FeedParser.php';
$feed = new FeedParser();
$feed->set_feed_url($url);
$feed->init();
$files
|
请发表评论