本文整理汇总了PHP中Piwik\Site::isSiteSearchEnabledFor方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::isSiteSearchEnabledFor方法的具体用法?PHP Site::isSiteSearchEnabledFor怎么用?PHP Site::isSiteSearchEnabledFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Site
的用法示例。
在下文中一共展示了Site::isSiteSearchEnabledFor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSparklinesAndNumbers
protected function setSparklinesAndNumbers($view)
{
$view->urlSparklineNbVisits = $this->getUrlSparkline('getEvolutionGraph', array('columns' => $view->displayUniqueVisitors ? array('nb_visits', 'nb_uniq_visitors') : array('nb_visits')));
$view->urlSparklineNbUsers = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_users')));
$view->urlSparklineNbPageviews = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_pageviews', 'nb_uniq_pageviews')));
$view->urlSparklineNbDownloads = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_downloads', 'nb_uniq_downloads')));
$view->urlSparklineNbOutlinks = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_outlinks', 'nb_uniq_outlinks')));
$view->urlSparklineAvgVisitDuration = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('avg_time_on_site')));
$view->urlSparklineMaxActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('max_actions')));
$view->urlSparklineActionsPerVisit = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions_per_visit')));
$view->urlSparklineBounceRate = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('bounce_rate')));
$view->urlSparklineAvgGenerationTime = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('avg_time_generation')));
$idSite = Common::getRequestVar('idSite');
$displaySiteSearch = Site::isSiteSearchEnabledFor($idSite);
if ($displaySiteSearch) {
$view->urlSparklineNbSearches = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_searches', 'nb_keywords')));
}
$view->displaySiteSearch = $displaySiteSearch;
$dataTableVisit = self::getVisitsSummary();
$dataRow = $dataTableVisit->getRowsCount() == 0 ? new Row() : $dataTableVisit->getFirstRow();
$view->nbUniqVisitors = (int) $dataRow->getColumn('nb_uniq_visitors');
$view->nbUsers = (int) $dataRow->getColumn('nb_users');
$nbVisits = (int) $dataRow->getColumn('nb_visits');
$view->nbVisits = $nbVisits;
$view->averageVisitDuration = $dataRow->getColumn('avg_time_on_site');
$nbBouncedVisits = $dataRow->getColumn('bounce_count');
$view->bounceRate = Piwik::getPercentageSafe($nbBouncedVisits, $nbVisits);
$view->maxActions = (int) $dataRow->getColumn('max_actions');
$view->nbActionsPerVisit = $dataRow->getColumn('nb_actions_per_visit');
if (Common::isActionsPluginEnabled()) {
$view->showActionsPluginReports = true;
$dataTableActions = APIActions::getInstance()->get($idSite, Common::getRequestVar('period'), Common::getRequestVar('date'), \Piwik\API\Request::getRawSegmentFromRequest());
$dataActionsRow = $dataTableActions->getRowsCount() == 0 ? new Row() : $dataTableActions->getFirstRow();
$view->nbPageviews = (int) $dataActionsRow->getColumn('nb_pageviews');
$view->nbUniquePageviews = (int) $dataActionsRow->getColumn('nb_uniq_pageviews');
$view->nbDownloads = (int) $dataActionsRow->getColumn('nb_downloads');
$view->nbUniqueDownloads = (int) $dataActionsRow->getColumn('nb_uniq_downloads');
$view->nbOutlinks = (int) $dataActionsRow->getColumn('nb_outlinks');
$view->nbUniqueOutlinks = (int) $dataActionsRow->getColumn('nb_uniq_outlinks');
$view->averageGenerationTime = $dataActionsRow->getColumn('avg_time_generation');
if ($displaySiteSearch) {
$view->nbSearches = (int) $dataActionsRow->getColumn('nb_searches');
$view->nbKeywords = (int) $dataActionsRow->getColumn('nb_keywords');
}
// backward compatibility:
// show actions if the finer metrics are not archived
$view->showOnlyActions = false;
if ($dataActionsRow->getColumn('nb_pageviews') + $dataActionsRow->getColumn('nb_downloads') + $dataActionsRow->getColumn('nb_outlinks') == 0 && $dataRow->getColumn('nb_actions') > 0) {
$view->showOnlyActions = true;
$view->nbActions = $dataRow->getColumn('nb_actions');
$view->urlSparklineNbActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions')));
}
}
}
示例2: isSiteSearchEnabled
public function isSiteSearchEnabled($idSites, $idSite)
{
$idSites = Site::getIdSitesFromIdSitesString($idSites, true);
if (!empty($idSite)) {
$idSites[] = $idSite;
}
if (empty($idSites)) {
return false;
}
foreach ($idSites as $idSite) {
if (!Site::isSiteSearchEnabledFor($idSite)) {
return false;
}
}
return true;
}
示例3: isSiteSearchEnabled
public function isSiteSearchEnabled()
{
$idSite = Common::getRequestVar('idSite', 0, 'int');
$idSites = Common::getRequestVar('idSites', '', 'string');
$idSites = Site::getIdSitesFromIdSitesString($idSites, true);
if (!empty($idSite)) {
$idSites[] = $idSite;
}
if (empty($idSites)) {
return false;
}
foreach ($idSites as $idSite) {
if (!Site::isSiteSearchEnabledFor($idSite)) {
return false;
}
}
return true;
}
示例4: getEvolutionGraph
public function getEvolutionGraph()
{
$columns = Common::getRequestVar('columns', false);
if (false !== $columns) {
$columns = Piwik::getArrayFromApiParameter($columns);
}
$documentation = $this->translator->translate('VisitsSummary_VisitsSummaryDocumentation') . '<br />' . $this->translator->translate('General_BrokenDownReportDocumentation') . '<br /><br />' . '<b>' . $this->translator->translate('General_ColumnNbVisits') . ':</b> ' . $this->translator->translate('General_ColumnNbVisitsDocumentation') . '<br />' . '<b>' . $this->translator->translate('General_ColumnNbUniqVisitors') . ':</b> ' . $this->translator->translate('General_ColumnNbUniqVisitorsDocumentation') . '<br />' . '<b>' . $this->translator->translate('General_ColumnNbActions') . ':</b> ' . $this->translator->translate('General_ColumnNbActionsDocumentation') . '<br />' . '<b>' . $this->translator->translate('General_ColumnNbUsers') . ':</b> ' . $this->translator->translate('General_ColumnNbUsersDocumentation') . ' (<a rel="noreferrer" target="_blank" href="http://piwik.org/docs/user-id/">User ID</a>)<br />' . '<b>' . $this->translator->translate('General_ColumnActionsPerVisit') . ':</b> ' . $this->translator->translate('General_ColumnActionsPerVisitDocumentation');
$selectableColumns = array('nb_visits', 'nb_uniq_visitors', 'nb_users', 'avg_time_on_site', 'bounce_rate', 'nb_actions_per_visit', 'max_actions', 'nb_visits_converted', 'nb_pageviews', 'nb_uniq_pageviews', 'nb_downloads', 'nb_uniq_downloads', 'nb_outlinks', 'nb_uniq_outlinks', 'avg_time_generation');
$idSite = Common::getRequestVar('idSite');
$displaySiteSearch = Site::isSiteSearchEnabledFor($idSite);
if ($displaySiteSearch) {
$selectableColumns[] = 'nb_searches';
$selectableColumns[] = 'nb_keywords';
}
// $callingAction may be specified to distinguish between
// "VisitsSummary_WidgetLastVisits" and "VisitsSummary_WidgetOverviewGraph"
$view = $this->getLastUnitGraphAcrossPlugins($this->pluginName, __FUNCTION__, $columns, $selectableColumns, $documentation);
if (empty($view->config->columns_to_display)) {
$view->config->columns_to_display = array('nb_visits');
}
return $this->renderView($view);
}
示例5: 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));
}
示例6: isSiteSearchEnabled
protected function isSiteSearchEnabled()
{
$idSite = Common::getRequestVar('idSite', 0, 'int');
if ($idSite == 0) {
return false;
}
return Site::isSiteSearchEnabledFor($idSite);
}
示例7: addSparklineColumns
private function addSparklineColumns(Sparklines $view)
{
$currentPeriod = Common::getRequestVar('period');
$currentIdSite = Common::getRequestVar('idSite');
$currentDate = Common::getRequestVar('date');
$displayUniqueVisitors = SettingsPiwik::isUniqueVisitorsEnabled($currentPeriod);
$isActionPluginEnabled = Common::isActionsPluginEnabled();
$view->config->addSparklineMetric($displayUniqueVisitors ? array('nb_visits', 'nb_uniq_visitors') : array('nb_visits'), 5);
if ($isActionPluginEnabled) {
$view->config->addSparklineMetric(array('nb_actions'), 10);
// either actions or pageviews will be displayed
$view->config->addSparklineMetric(array('nb_pageviews', 'nb_uniq_pageviews'), 20);
} else {
// make sure to still create a div on the right side for this, just leave it empty
$view->config->addPlaceholder(10);
}
$userId = new UserId();
if ($userId->isUsedInAtLeastOneSite(array($currentIdSite), $currentPeriod, $currentDate)) {
$view->config->addSparklineMetric(array('nb_users'), 30);
$view->config->addPlaceholder(31);
}
$view->config->addSparklineMetric(array('avg_time_on_site'), 40);
$idSite = Common::getRequestVar('idSite');
if ($isActionPluginEnabled && Site::isSiteSearchEnabledFor($idSite)) {
$view->config->addSparklineMetric(array('nb_searches', 'nb_keywords'), 50);
} else {
// make sure to still create a div on the right side for this, just leave it empty
$view->config->addPlaceholder(50);
}
$view->config->addSparklineMetric(array('bounce_rate'), 60);
if ($isActionPluginEnabled) {
$view->config->addSparklineMetric(array('nb_downloads', 'nb_uniq_downloads'), 70);
$view->config->addSparklineMetric(array('nb_actions_per_visit'), 71);
$view->config->addSparklineMetric(array('nb_outlinks', 'nb_uniq_outlinks'), 72);
$view->config->addSparklineMetric(array('avg_time_generation'), 73);
$view->config->addSparklineMetric(array('max_actions'), 74);
}
}