本文整理匯總了PHP中Piwik\Site::getSearchKeywordParameters方法的典型用法代碼示例。如果您正苦於以下問題:PHP Site::getSearchKeywordParameters方法的具體用法?PHP Site::getSearchKeywordParameters怎麽用?PHP Site::getSearchKeywordParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\Site
的用法示例。
在下文中一共展示了Site::getSearchKeywordParameters方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSetDefaultTimezoneAndCurrencyAndExcludedQueryParametersAndExcludedIps
public function testSetDefaultTimezoneAndCurrencyAndExcludedQueryParametersAndExcludedIps()
{
// test that they return default values
$defaultTimezone = API::getInstance()->getDefaultTimezone();
$this->assertEquals('UTC', $defaultTimezone);
$defaultCurrency = API::getInstance()->getDefaultCurrency();
$this->assertEquals('USD', $defaultCurrency);
$excludedIps = API::getInstance()->getExcludedIpsGlobal();
$this->assertEquals('', $excludedIps);
$excludedQueryParameters = API::getInstance()->getExcludedQueryParametersGlobal();
$this->assertEquals('', $excludedQueryParameters);
// test that when not specified, defaults are set as expected
$idsite = API::getInstance()->addSite("site1", array('http://example.org'));
$site = new Site($idsite);
$this->assertEquals('UTC', $site->getTimezone());
$this->assertEquals('USD', $site->getCurrency());
$this->assertEquals('', $site->getExcludedQueryParameters());
$this->assertEquals('', $site->getExcludedIps());
$this->assertEquals(false, $site->isEcommerceEnabled());
// set the global timezone and get it
$newDefaultTimezone = 'UTC+5.5';
API::getInstance()->setDefaultTimezone($newDefaultTimezone);
$defaultTimezone = API::getInstance()->getDefaultTimezone();
$this->assertEquals($newDefaultTimezone, $defaultTimezone);
// set the default currency and get it
$newDefaultCurrency = 'EUR';
API::getInstance()->setDefaultCurrency($newDefaultCurrency);
$defaultCurrency = API::getInstance()->getDefaultCurrency();
$this->assertEquals($newDefaultCurrency, $defaultCurrency);
// set the global IPs to exclude and get it
$newGlobalExcludedIps = '1.1.1.*,1.1.*.*,150.1.1.1';
API::getInstance()->setGlobalExcludedIps($newGlobalExcludedIps);
$globalExcludedIps = API::getInstance()->getExcludedIpsGlobal();
$this->assertEquals($newGlobalExcludedIps, $globalExcludedIps);
// set the global URL query params to exclude and get it
$newGlobalExcludedQueryParameters = 'PHPSESSID,blabla, TesT';
// removed the space
$expectedGlobalExcludedQueryParameters = 'PHPSESSID,blabla,TesT';
API::getInstance()->setGlobalExcludedQueryParameters($newGlobalExcludedQueryParameters);
$globalExcludedQueryParameters = API::getInstance()->getExcludedQueryParametersGlobal();
$this->assertEquals($expectedGlobalExcludedQueryParameters, $globalExcludedQueryParameters);
// create a website and check that default currency and default timezone are set
// however, excluded IPs and excluded query Params are not returned
$idsite = API::getInstance()->addSite("site1", array('http://example.org'), $ecommerce = 0, $siteSearch = 0, $searchKeywordParameters = 'test1,test2', $searchCategoryParameters = 'test2,test1', '', '', $newDefaultTimezone);
$site = new Site($idsite);
$this->assertEquals($newDefaultTimezone, $site->getTimezone());
$this->assertEquals(date('Y-m-d'), $site->getCreationDate()->toString());
$this->assertEquals($newDefaultCurrency, $site->getCurrency());
$this->assertEquals('', $site->getExcludedIps());
$this->assertEquals('', $site->getExcludedQueryParameters());
$this->assertEquals('test1,test2', $site->getSearchKeywordParameters());
$this->assertEquals('test2,test1', $site->getSearchCategoryParameters());
$this->assertFalse($site->isSiteSearchEnabled());
$this->assertFalse(Site::isSiteSearchEnabledFor($idsite));
$this->assertFalse($site->isEcommerceEnabled());
$this->assertFalse(Site::isEcommerceEnabledFor($idsite));
}