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


PHP SimplePie_Misc::parse_mime方法代码示例

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


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

示例1: autodiscovery

 function autodiscovery()
 {
     $links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
     $done = array();
     foreach ($links as $link) {
         if ($this->checked_feeds == $this->max_checked_feeds) {
             break;
         }
         if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) {
             $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
             if ($this->base_location < $link['offset']) {
                 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
             } else {
                 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
             }
             if (!in_array($href, $done) && in_array('feed', $rel) || in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) {
                 $this->checked_feeds++;
                 $feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
                 if ($this->is_feed($feed)) {
                     return $feed;
                 }
             }
             $done[] = $href;
         }
     }
     return null;
 }
开发者ID:jojospaghettio,项目名称:wicketpixie,代码行数:27,代码来源:simplepie.php

示例2: autodiscovery

 public function autodiscovery()
 {
     $links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
     $done = array();
     $feeds = array();
     foreach ($links as $link) {
         if ($this->checked_feeds === $this->max_checked_feeds) {
             break;
         }
         if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) {
             $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
             if ($this->base_location < $link['offset']) {
                 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
             } else {
                 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
             }
             if (!in_array($href, $done) && in_array('feed', $rel) || in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml')) && !isset($feeds[$href])) {
                 $this->checked_feeds++;
                 $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');
                 $feed = new $this->file_class($href, $this->timeout, 5, $headers, $this->useragent);
                 if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) {
                     $feeds[$href] = $feed;
                 }
             }
             $done[] = $href;
         }
     }
     if (!empty($feeds)) {
         return array_values($feeds);
     } else {
         return null;
     }
 }
开发者ID:himanshu12k,项目名称:ce-www,代码行数:33,代码来源:SimplePie.compiled.php


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