本文整理汇总了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;
}
示例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;
}
示例3: getHostFromUrl
public static function getHostFromUrl($url)
{
if (!UrlHelper::isLookLikeUrl($url)) {
$url = "http://" . $url;
}
return parse_url($url, PHP_URL_HOST);
}
示例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;
}