本文整理匯總了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;
}