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


PHP UrlHelper::isLookLikeUrl方法代码示例

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


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

示例1: getReferrerInformation

 protected function getReferrerInformation()
 {
     // default values for the referer_* fields
     $referrerUrl = Common::unsanitizeInputValue($this->referrerUrl);
     if (!empty($referrerUrl) && !UrlHelper::isLookLikeUrl($referrerUrl)) {
         $referrerUrl = '';
     }
     $currentUrl = PageUrl::cleanupUrl($this->currentUrl);
     echo "a";
     print_r($referrerUrl);
     exit;
     $this->referrerUrl = $referrerUrl;
     $this->referrerUrlParse = @parse_url($this->referrerUrl);
     $this->currentUrlParse = @parse_url($currentUrl);
     $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
     $this->nameReferrerAnalyzed = '';
     $this->keywordReferrerAnalyzed = '';
     $this->referrerHost = '';
     if (isset($this->referrerUrlParse['host'])) {
         $this->referrerHost = $this->referrerUrlParse['host'];
     }
     $referrerDetected = $this->detectReferrerCampaign();
     if (!$referrerDetected) {
         if ($this->detectReferrerDirectEntry() || $this->detectReferrerSearchEngine()) {
             $referrerDetected = true;
         }
     }
     if (!$referrerDetected && !empty($this->referrerHost)) {
         $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_WEBSITE;
         $this->nameReferrerAnalyzed = Common::mb_strtolower($this->referrerHost);
         $urlsByHost = $this->getCachedUrlsByHostAndIdSite();
         $directEntry = new SiteUrls();
         $path = $directEntry->getPathMatchingUrl($this->referrerUrlParse, $urlsByHost);
         if (!empty($path) && $path !== '/') {
             $this->nameReferrerAnalyzed .= rtrim($path, '/');
         }
     }
     $referrerInformation = array('referer_type' => $this->typeReferrerAnalyzed, 'referer_name' => $this->nameReferrerAnalyzed, 'referer_keyword' => $this->keywordReferrerAnalyzed, 'referer_url' => $this->referrerUrl, 'current_url' => $this->currentUrl);
     return $referrerInformation;
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:40,代码来源:Referrers.php

示例2: getUrlIfLookValid

 public static function getUrlIfLookValid($url)
 {
     $url = PageUrl::cleanupString($url);
     if (!UrlHelper::isLookLikeUrl($url)) {
         //WARNING: URL looks invalid and is discarded
         return false;
     }
     return $url;
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:9,代码来源:PageUrl.php

示例3: getHostFromUrl

 public static function getHostFromUrl($url)
 {
     if (!UrlHelper::isLookLikeUrl($url)) {
         $url = "http://" . $url;
     }
     return parse_url($url, PHP_URL_HOST);
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:7,代码来源:UrlHelper.php

示例4: getTrustedHostsFromConfig

 public static function getTrustedHostsFromConfig()
 {
     $hosts = self::getHostsFromConfig('General', 'trusted_hosts');
     // Case user wrote in the config, http://example.com/test instead of example.com
     foreach ($hosts as &$host) {
         if (UrlHelper::isLookLikeUrl($host)) {
             $host = parse_url($host, PHP_URL_HOST);
         }
     }
     return $hosts;
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:11,代码来源:Url.php


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