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


PHP SimplePie_Misc::display_file方法代码示例

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


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

示例1: init

    function init()
    {
        if (!(function_exists('version_compare') && (version_compare(phpversion(), '4.3.2', '>=') && version_compare(phpversion(), '5', '<') || version_compare(phpversion(), '5.0.3', '>='))) || !extension_loaded('xml') || !extension_loaded('pcre')) {
            return false;
        }
        if ($this->sanitize->bypass_image_hotlink && !empty($_GET[$this->sanitize->bypass_image_hotlink])) {
            if (get_magic_quotes_gpc()) {
                $_GET[$this->sanitize->bypass_image_hotlink] = stripslashes($_GET[$this->sanitize->bypass_image_hotlink]);
            }
            SimplePie_Misc::display_file($_GET[$this->sanitize->bypass_image_hotlink], 10, $this->useragent);
        }
        if (isset($_GET['js'])) {
            $embed = <<<EOT
function embed_odeo(link) {
\tdocument.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
}

function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
\tif (placeholder != '') {
\t\tdocument.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
\t}
\telse {
\t\tdocument.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
\t}
}

function embed_flash(bgcolor, width, height, link, loop, type) {
\tdocument.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
}

function embed_wmedia(width, height, link) {
\tdocument.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
}
EOT;
            if (function_exists('ob_gzhandler')) {
                ob_start('ob_gzhandler');
            }
            header('Content-type: text/javascript; charset: UTF-8');
            header('Cache-Control: must-revalidate');
            header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');
            echo $embed;
            exit;
        }
        if (!empty($this->rss_url) || !empty($this->raw_data)) {
            $this->data = array();
            $cache = false;
            if (!empty($this->rss_url)) {
                // Decide whether to enable caching
                if ($this->enable_cache && preg_match('/^http(s)?:\\/\\//i', $this->rss_url)) {
                    $cache = new $this->cache_class($this->cache_location, call_user_func($this->cache_name_type, $this->rss_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 we've hit a collision just rerun it with caching disabled
                        if (isset($this->data['url']) && $this->data['url'] != $this->rss_url) {
                            $cache = false;
                        } else {
                            if (!empty($this->data['feed_url'])) {
                                if ($this->data['feed_url'] == $this->data['url']) {
                                    $cache->unlink();
                                } else {
                                    $this->feed_url($this->data['feed_url']);
                                    return $this->init();
                                }
                            } else {
                                if ($cache->mtime() + $this->max_minutes * 60 < time()) {
                                    // If we have last-modified and/or etag set
                                    if (!empty($this->data['last-modified']) || !empty($this->data['etag'])) {
                                        $headers = array();
                                        if (!empty($this->data['last-modified'])) {
                                            $headers['if-modified-since'] = $this->data['last-modified'];
                                        }
                                        if (!empty($this->data['etag'])) {
                                            $headers['if-none-match'] = $this->data['etag'];
                                        }
                                        $file = new $this->file_class($this->rss_url, $this->timeout / 10, 5, $headers, $this->useragent, $this->force_fsockopen);
                                        if ($file->success) {
                                            $headers = $file->headers();
                                            if ($headers['status']['code'] == 304) {
                                                $cache->touch();
                                                return true;
                                            }
                                        } else {
                                            unset($file);
                                        }
                                    } else {
                                        $cache->unlink();
                                    }
                                } else {
                                    return true;
                                }
                            }
                        }
                    } else {
                        $cache->unlink();
                    }
                }
//.........这里部分代码省略.........
开发者ID:jbogota,项目名称:blog-king,代码行数:101,代码来源:class-simplepie-rss.php


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