本文整理匯總了PHP中Piwik\Url::isHostInUrls方法的典型用法代碼示例。如果您正苦於以下問題:PHP Url::isHostInUrls方法的具體用法?PHP Url::isHostInUrls怎麽用?PHP Url::isHostInUrls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\Url
的用法示例。
在下文中一共展示了Url::isHostInUrls方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testIsHostInUrlsl
/**
* @group Core
*
* @dataProvider getIsHostInUrls
*/
public function testIsHostInUrlsl($isHost, $host, $urls)
{
$this->assertEquals($isHost, Url::isHostInUrls($host, $urls));
}
示例2: shouldPerformRedirectToUrl
public function shouldPerformRedirectToUrl()
{
if (!$this->hasRedirectUrl()) {
return false;
}
if (!$this->hasRequests()) {
return false;
}
$redirectUrl = $this->getRedirectUrl();
$host = Url::getHostFromUrl($redirectUrl);
if (empty($host)) {
return false;
}
$urls = new SiteUrls();
$siteUrls = $urls->getAllCachedSiteUrls();
$siteIds = $this->getAllSiteIdsWithinRequest();
foreach ($siteIds as $siteId) {
if (empty($siteUrls[$siteId])) {
$siteUrls[$siteId] = array();
}
if (Url::isHostInUrls($host, $siteUrls[$siteId])) {
return $redirectUrl;
}
}
return false;
}
示例3: performRedirectToUrlIfSet
private function performRedirectToUrlIfSet()
{
if (!$this->hasRedirectUrl()) {
return;
}
if (empty($this->requests)) {
return;
}
$redirectUrl = $this->getRedirectUrl();
$host = Url::getHostFromUrl($redirectUrl);
if (empty($host)) {
return;
}
$siteIds = array();
foreach ($this->requests as $request) {
$siteIds[] = (int) $request['idsite'];
}
$siteIds = array_unique($siteIds);
$model = new Model();
foreach ($siteIds as $siteId) {
$siteUrls = $model->getSiteUrlsFromId($siteId);
if (Url::isHostInUrls($host, $siteUrls)) {
Url::redirectToUrl($redirectUrl);
}
}
}
示例4: performRedirectToUrlIfSet
private function performRedirectToUrlIfSet()
{
if (!$this->hasRedirectUrl()) {
return;
}
if (empty($this->requests)) {
return;
}
$redirectUrl = $this->getRedirectUrl();
$host = Url::getHostFromUrl($redirectUrl);
if (empty($host)) {
return;
}
$urls = new SiteUrls();
$siteUrls = $urls->getAllCachedSiteUrls();
$siteIds = $this->getAllSiteIdsWithinRequest();
foreach ($siteIds as $siteId) {
if (empty($siteUrls[$siteId])) {
continue;
}
if (Url::isHostInUrls($host, $siteUrls[$siteId])) {
Url::redirectToUrl($redirectUrl);
}
}
}