当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik_Site::getSearchCategoryParameters方法代码示例

本文整理汇总了PHP中Piwik_Site::getSearchCategoryParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Site::getSearchCategoryParameters方法的具体用法?PHP Piwik_Site::getSearchCategoryParameters怎么用?PHP Piwik_Site::getSearchCategoryParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik_Site的用法示例。


在下文中一共展示了Piwik_Site::getSearchCategoryParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetDefaultTimezoneAndCurrencyAndExcludedQueryParametersAndExcludedIps

 /**
  * 
  * @group Plugins
  * @group SitesManager
  */
 public function testSetDefaultTimezoneAndCurrencyAndExcludedQueryParametersAndExcludedIps()
 {
     // test that they return default values
     $defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
     $this->assertEquals('UTC', $defaultTimezone);
     $defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
     $this->assertEquals('USD', $defaultCurrency);
     $excludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
     $this->assertEquals('', $excludedIps);
     $excludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
     $this->assertEquals('', $excludedQueryParameters);
     // test that when not specified, defaults are set as expected
     $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1", array('http://example.org'));
     $site = new Piwik_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';
     Piwik_SitesManager_API::getInstance()->setDefaultTimezone($newDefaultTimezone);
     $defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
     $this->assertEquals($newDefaultTimezone, $defaultTimezone);
     // set the default currency and get it
     $newDefaultCurrency = 'EUR';
     Piwik_SitesManager_API::getInstance()->setDefaultCurrency($newDefaultCurrency);
     $defaultCurrency = Piwik_SitesManager_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';
     Piwik_SitesManager_API::getInstance()->setGlobalExcludedIps($newGlobalExcludedIps);
     $globalExcludedIps = Piwik_SitesManager_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';
     Piwik_SitesManager_API::getInstance()->setGlobalExcludedQueryParameters($newGlobalExcludedQueryParameters);
     $globalExcludedQueryParameters = Piwik_SitesManager_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 = Piwik_SitesManager_API::getInstance()->addSite("site1", array('http://example.org'), $ecommerce = 0, $siteSearch = 0, $searchKeywordParameters = 'test1,test2', $searchCategoryParameters = 'test2,test1', '', '', $newDefaultTimezone);
     $site = new Piwik_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(Piwik_Site::isSiteSearchEnabledFor($idsite));
     $this->assertFalse($site->isEcommerceEnabled());
     $this->assertFalse(Piwik_Site::isEcommerceEnabledFor($idsite));
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:62,代码来源:SitesManagerTest.php


注:本文中的Piwik_Site::getSearchCategoryParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。