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


PHP SimplePie_Misc::fix_protocol方法代码示例

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


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

示例1: fix_protocol

 public static function fix_protocol($url, $http = 1)
 {
     $url = SimplePie_Misc::normalize_url($url);
     $parsed = SimplePie_Misc::parse_url($url);
     if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') {
         return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
     }
     if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) {
         return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
     }
     if ($http === 2 && $parsed['scheme'] !== '') {
         return "feed:{$url}";
     } elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') {
         return substr_replace($url, 'podcast', 0, 4);
     } elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') {
         return substr_replace($url, 'itpc', 0, 4);
     } else {
         return $url;
     }
 }
开发者ID:kadrim1,项目名称:metsayhistu,代码行数:20,代码来源:Misc.php

示例2: fix_protocol

 function fix_protocol($url, $http = 1)
 {
     $parsed = SimplePie_Misc::parse_url($url);
     if (!empty($parsed['scheme']) && strtolower($parsed['scheme']) != 'http' && strtolower($parsed['scheme']) != 'https') {
         return SimplePie_Misc::fix_protocol("{$parsed['authority']}{$parsed['path']}{$parsed['query']}{$parsed['fragment']}", $http);
     }
     if (!file_exists($url) && empty($parsed['scheme'])) {
         return SimplePie_Misc::fix_protocol("http://{$url}", $http);
     }
     if ($http == 2 && !empty($parsed['scheme'])) {
         return "feed:{$url}";
     } else {
         if ($http == 3 && strtolower($parsed['scheme']) == 'http') {
             return substr_replace($url, 'podcast', 0, 4);
         } else {
             return $url;
         }
     }
 }
开发者ID:jbogota,项目名称:blog-king,代码行数:19,代码来源:class-simplepie-rss.php

示例3: set_feed_url

 /**
  * This is the URL of the feed you want to parse.
  *
  * This allows you to enter the URL of the feed you want to parse, or the
  * website you want to try to use auto-discovery on. This takes priority
  * over any set raw data.
  *
  * You can set multiple feeds to mash together by passing an array instead
  * of a string for the $url. Remember that with each additional feed comes
  * additional processing and resources.
  *
  * @access public
  * @since 1.0 Preview Release
  * @param mixed $url This is the URL (or array of URLs) that you want to parse.
  * @see SimplePie::set_raw_data()
  */
 public function set_feed_url($url)
 {
     if (is_array($url)) {
         $this->multifeed_url = array();
         foreach ($url as $value) {
             $this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1);
         }
     } else {
         $this->feed_url = SimplePie_Misc::fix_protocol($url, 1);
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:27,代码来源:Core.php

示例4: fix_protocol

 function fix_protocol($url, $http = 1)
 {
     $url = SimplePie_Misc::normalize_url($url);
     $parsed = SimplePie_Misc::parse_url($url);
     if (!empty($parsed['scheme']) && !preg_match('/^http(s)?$/i', $parsed['scheme'])) {
         return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
     }
     if (!file_exists($url) && empty($parsed['scheme'])) {
         return SimplePie_Misc::fix_protocol("http://{$url}", $http);
     }
     if ($http == 2 && !empty($parsed['scheme'])) {
         return "feed:{$url}";
     } elseif ($http == 3 && strtolower($parsed['scheme']) == 'http') {
         return substr_replace($url, 'podcast', 0, 4);
     } elseif ($http == 4 && strtolower($parsed['scheme']) == 'http') {
         return substr_replace($url, 'itpc', 0, 4);
     } else {
         return $url;
     }
 }
开发者ID:searchfirst,项目名称:Lenore,代码行数:20,代码来源:simplepie.php


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