当前位置: 首页>>代码示例>>PHP>>正文


PHP SimplePie_Misc::output_javascript方法代码示例

本文整理汇总了PHP中SimplePie_Misc::output_javascript方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie_Misc::output_javascript方法的具体用法?PHP SimplePie_Misc::output_javascript怎么用?PHP SimplePie_Misc::output_javascript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimplePie_Misc的用法示例。


在下文中一共展示了SimplePie_Misc::output_javascript方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     if (function_exists('version_compare') && version_compare(PHP_VERSION, '5.0', '<') || !extension_loaded('xml') || !extension_loaded('pcre')) {
         return false;
     } elseif (!extension_loaded('xmlreader')) {
         static $xml_is_sane = null;
         if ($xml_is_sane === null) {
             $parser_check = xml_parser_create();
             xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
             xml_parser_free($parser_check);
             $xml_is_sane = isset($values[0]['value']);
         }
         if (!$xml_is_sane) {
             return false;
         }
     }
     if (isset($_GET[$this->javascript])) {
         SimplePie_Misc::output_javascript();
         exit;
     }
     $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class);
     $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen);
     if ($this->feed_url !== null || $this->raw_data !== null) {
         $this->error = null;
         $this->data = array();
         $this->multifeed_objects = array();
         $cache = false;
         if ($this->feed_url !== null) {
             $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url);
             if ($this->cache && $parsed_feed_url['scheme'] !== '') {
                 $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
             }
             if ($cache && !$this->xml_dump) {
                 $this->data = $cache->load();
                 if (!empty($this->data)) {
                     if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) {
                         $cache->unlink();
                         $this->data = array();
                     } elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) {
                         $cache = false;
                         $this->data = array();
                     } elseif (isset($this->data['feed_url'])) {
                         if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) {
                             if ($this->data['feed_url'] === $this->data['url']) {
                                 $cache->unlink();
                                 $this->data = array();
                             } else {
                                 $this->set_feed_url($this->data['feed_url']);
                                 return $this->init();
                             }
                         }
                     } elseif ($cache->mtime() + $this->cache_duration < time()) {
                         if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) {
                             $headers = array('Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1');
                             if (isset($this->data['headers']['last-modified'])) {
                                 $headers['if-modified-since'] = $this->data['headers']['last-modified'];
                             }
                             if (isset($this->data['headers']['etag'])) {
                                 $headers['if-none-match'] = $this->data['headers']['etag'];
                             }
                             $file = new $this->file_class($this->feed_url, $this->timeout / 10, 5, $headers, $this->useragent, $this->force_fsockopen);
                             if ($file->success) {
                                 if ($file->status_code === 304) {
                                     $cache->touch();
                                     return true;
                                 } else {
                                     $headers = $file->headers;
                                 }
                             } else {
                                 unset($file);
                             }
                         }
                     } else {
                         return true;
                     }
                 } else {
                     $cache->unlink();
                     $this->data = array();
                 }
             }
             if (!isset($file)) {
                 if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url) {
                     $file =& $this->file;
                 } else {
                     $headers = array('Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1');
                     $file = new $this->file_class($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen);
                 }
             }
             if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) {
                 $this->error = $file->error;
                 if (!empty($this->data)) {
                     return true;
                 } else {
                     return false;
                 }
             }
             if (!$this->force_feed) {
                 $locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
                 if (!$locate->is_feed($file)) {
                     unset($file);
//.........这里部分代码省略.........
开发者ID:JocelynDelalande,项目名称:Lilina,代码行数:101,代码来源:simplepie.class.php

示例2: init

 public function init()
 {
     // Check absolute bare minimum requirements.
     if (function_exists('version_compare') && version_compare(PHP_VERSION, '5.0', '<') || !extension_loaded('xml') || !extension_loaded('pcre')) {
         return false;
     } elseif (!extension_loaded('xmlreader')) {
         static $xml_is_sane = null;
         if ($xml_is_sane === null) {
             $parser_check = xml_parser_create();
             xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
             xml_parser_free($parser_check);
             $xml_is_sane = isset($values[0]['value']);
         }
         if (!$xml_is_sane) {
             return false;
         }
     }
     if (isset($_GET[$this->javascript])) {
         SimplePie_Misc::output_javascript();
         exit;
     }
     // Pass whatever was set with config options over to the sanitizer.
     $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class);
     $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen);
     if ($this->feed_url !== null || $this->raw_data !== null) {
         $this->error = null;
         $this->data = array();
         $this->multifeed_objects = array();
         $cache = false;
         if ($this->feed_url !== null) {
             $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url);
             // Decide whether to enable caching
             if ($this->cache && $parsed_feed_url['scheme'] !== '') {
                 $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
             }
             // If it's enabled and we don't want an XML dump, use the cache
             if ($cache && !$this->xml_dump) {
                 // Load the Cache
                 $this->data = $cache->load();
                 if (!empty($this->data)) {
                     // If the cache is for an outdated build of SimplePie
                     if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) {
                         $cache->unlink();
                         $this->data = array();
                     } elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) {
                         $cache = false;
                         $this->data = array();
                     } elseif (isset($this->data['feed_url'])) {
                         // If the autodiscovery cache is still valid use it.
                         if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) {
                             // Do not need to do feed autodiscovery yet.
                             if ($this->data['feed_url'] === $this->data['url']) {
                                 $cache->unlink();
                                 $this->data = array();
                             } else {
                                 $this->set_feed_url($this->data['feed_url']);
                                 return $this->init();
                             }
                         }
                     } elseif ($cache->mtime() + $this->cache_duration < time()) {
                         // If we have last-modified and/or etag set
                         if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) {
                             $headers = array();
                             if (isset($this->data['headers']['last-modified'])) {
                                 $headers['if-modified-since'] = $this->data['headers']['last-modified'];
                             }
                             if (isset($this->data['headers']['etag'])) {
                                 $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"';
                             }
                             $file = new $this->file_class($this->feed_url, $this->timeout / 10, 5, $headers, $this->useragent, $this->force_fsockopen);
                             if ($file->success) {
                                 if ($file->status_code === 304) {
                                     $cache->touch();
                                     return true;
                                 } else {
                                     $headers = $file->headers;
                                 }
                             } else {
                                 unset($file);
                             }
                         }
                     } else {
                         return true;
                     }
                 } else {
                     $cache->unlink();
                     $this->data = array();
                 }
             }
             // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
             if (!isset($file)) {
                 if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url) {
                     $file =& $this->file;
                 } else {
                     $file = new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen);
                 }
             }
             // If the file connection has an error, set SimplePie::error to that and quit
             if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) {
                 $this->error = $file->error;
//.........这里部分代码省略.........
开发者ID:karlstolley,项目名称:twitter-workshop-cw2010,代码行数:101,代码来源:simplepie.class.php

示例3: explode

<?php

// Start counting time for the page load
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
// Include SimplePie
// Located in the parent directory
include_once '../SimplePieAutoloader.php';
include_once '../idn/idna_convert.class.php';
// Create a new instance of the SimplePie object
$feed = new SimplePie();
//$feed->force_fsockopen(true);
if (isset($_GET['js'])) {
    SimplePie_Misc::output_javascript();
    die;
}
// Make sure that page is getting passed a URL
if (isset($_GET['feed']) && $_GET['feed'] !== '') {
    // Strip slashes if magic quotes is enabled (which automatically escapes certain characters)
    if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
        $_GET['feed'] = stripslashes($_GET['feed']);
    }
    // Use the URL that was passed to the page in SimplePie
    $feed->set_feed_url($_GET['feed']);
}
// Allow us to change the input encoding from the URL string if we want to. (optional)
if (!empty($_GET['input'])) {
    $feed->set_input_encoding($_GET['input']);
}
// Allow us to choose to not re-order the items by date. (optional)
if (!empty($_GET['orderbydate']) && $_GET['orderbydate'] == 'false') {
开发者ID:SerdarSanri,项目名称:rssparser,代码行数:31,代码来源:index.php


注:本文中的SimplePie_Misc::output_javascript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。