本文整理汇总了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);
}
}
}