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


PHP Site::isEcommerceEnabledFor方法代码示例

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


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

示例1: renderReport

 public function renderReport($processedReport)
 {
     $isGoalPluginEnabled = Common::isGoalPluginEnabled();
     $prettyDate = $processedReport['prettyDate'];
     $reportData = $processedReport['reportData'];
     $evolutionMetrics = array();
     $multiSitesAPIMetrics = API::getApiMetrics($enhanced = true);
     foreach ($multiSitesAPIMetrics as $metricSettings) {
         $evolutionMetrics[] = $metricSettings[API::METRIC_EVOLUTION_COL_NAME_KEY];
     }
     $floatRegex = self::FLOAT_REGEXP;
     // no decimal for all metrics to shorten SMS content (keeps the monetary sign for revenue metrics)
     $reportData->filter('ColumnCallbackReplace', array(array_merge(array_keys($multiSitesAPIMetrics), $evolutionMetrics), function ($value) use($floatRegex) {
         return preg_replace_callback($floatRegex, function ($matches) {
             return round($matches[0]);
         }, $value);
     }));
     // evolution metrics formatting :
     //  - remove monetary, percentage and white spaces to shorten SMS content
     //    (this is also needed to be able to test $value != 0 and see if there is an evolution at all in SMSReport.twig)
     //  - adds a plus sign
     $reportData->filter('ColumnCallbackReplace', array($evolutionMetrics, function ($value) use($floatRegex) {
         $matched = preg_match($floatRegex, $value, $matches);
         $formatted = $matched ? sprintf("%+d", $matches[0]) : $value;
         return \Piwik\NumberFormatter::getInstance()->formatPercentEvolution($formatted);
     }));
     $dataRows = $reportData->getRows();
     $reportMetadata = $processedReport['reportMetadata'];
     $reportRowsMetadata = $reportMetadata->getRows();
     $siteHasECommerce = array();
     foreach ($reportRowsMetadata as $rowMetadata) {
         $idSite = $rowMetadata->getColumn('idsite');
         $siteHasECommerce[$idSite] = Site::isEcommerceEnabledFor($idSite);
     }
     $view = new View('@MobileMessaging/SMSReport');
     $view->assign("isGoalPluginEnabled", $isGoalPluginEnabled);
     $view->assign("reportRows", $dataRows);
     $view->assign("reportRowsMetadata", $reportRowsMetadata);
     $view->assign("prettyDate", $prettyDate);
     $view->assign("siteHasECommerce", $siteHasECommerce);
     $view->assign("displaySiteName", $processedReport['metadata']['action'] == 'getAll');
     // segment
     $segment = $processedReport['segment'];
     $displaySegment = $segment != null;
     $view->assign("displaySegment", $displaySegment);
     if ($displaySegment) {
         $view->assign("segmentName", $segment['name']);
     }
     $this->rendering .= $view->render();
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:50,代码来源:Sms.php

示例2: compute

 public function compute(Row $row)
 {
     $columnName = $this->getWrappedName();
     $currentValue = $this->getMetric($row, $columnName);
     // if the site this is for doesn't support ecommerce & this is for the revenue_evolution column,
     // we don't add the new column
     if ($currentValue === false || !$this->isRevenueEvolution) {
         $idSite = $row->getMetadata('idsite');
         if (!$idSite || !Site::isEcommerceEnabledFor($idSite)) {
             $row->deleteColumn($columnName);
             return false;
         }
     }
     return parent::compute($row);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:15,代码来源:EcommerceOnlyEvolutionMetric.php

示例3: getDividend

 /**
  * Returns the difference between the column in the specific row and its
  * sister column in the past DataTable.
  *
  * @param Row $row
  * @return int|float
  */
 protected function getDividend($row)
 {
     $currentValue = $row->getColumn($this->columnValueToRead);
     // if the site this is for doesn't support ecommerce & this is for the revenue_evolution column,
     // we don't add the new column
     if ($currentValue === false && $this->isRevenueEvolution && !Site::isEcommerceEnabledFor($row->getColumn('label'))) {
         return false;
     }
     $pastRow = $this->getPastRowFromCurrent($row);
     if ($pastRow) {
         $pastValue = $pastRow->getColumn($this->columnValueToRead);
     } else {
         $pastValue = 0;
     }
     return $currentValue - $pastValue;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:23,代码来源:CalculateEvolutionFilter.php

示例4: 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));
 }
开发者ID:ahdinosaur,项目名称:analytics.dinosaur.is,代码行数:57,代码来源:ApiTest.php

示例5: getGoals

 private function getGoals($idSite)
 {
     // get all goals to display info for
     $allGoals = array();
     // add the ecommerce goal if ecommerce is enabled for the site
     if (Site::isEcommerceEnabledFor($idSite)) {
         $ecommerceGoal = array('idgoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER, 'name' => Piwik::translate('Goals_EcommerceOrder'), 'quoted_name' => false);
         $allGoals[$ecommerceGoal['idgoal']] = $ecommerceGoal;
     }
     // add the site's goals (and escape all goal names)
     $siteGoals = APIGoals::getInstance()->getGoals($idSite);
     foreach ($siteGoals as &$goal) {
         $goal['name'] = Common::sanitizeInputValue($goal['name']);
         $goal['quoted_name'] = '"' . $goal['name'] . '"';
         $allGoals[$goal['idgoal']] = $goal;
     }
     return $allGoals;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:18,代码来源:Goals.php

示例6: removeEcommerceRelatedMetricsOnNonEcommercePiwikSites

 private function removeEcommerceRelatedMetricsOnNonEcommercePiwikSites($dataTable, $apiECommerceMetrics)
 {
     // $dataTableRows instanceOf Row[]
     $dataTableRows = $dataTable->getRows();
     foreach ($dataTableRows as $dataTableRow) {
         $siteId = $dataTableRow->getColumn('label');
         if (!Site::isEcommerceEnabledFor($siteId)) {
             foreach ($apiECommerceMetrics as $metricSettings) {
                 $dataTableRow->deleteColumn($metricSettings[self::METRIC_RECORD_NAME_KEY]);
                 $dataTableRow->deleteColumn($metricSettings[self::METRIC_EVOLUTION_COL_NAME_KEY]);
             }
         }
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:14,代码来源:API.php

示例7: getVisitorProfile

 /**
  * Returns an array describing a visitor using her last visits (uses a maximum of 100).
  *
  * @param int $idSite Site ID
  * @param bool|false|string $visitorId The ID of the visitor whose profile to retrieve.
  * @param bool|false|string $segment
  * @param bool $checkForLatLong If true, hasLatLong will appear in the output and be true if
  *                              one of the first 100 visits has a latitude/longitude.
  * @return array
  */
 public function getVisitorProfile($idSite, $visitorId = false, $segment = false, $checkForLatLong = false)
 {
     Piwik::checkUserHasViewAccess($idSite);
     if ($visitorId === false) {
         $visitorId = $this->getMostRecentVisitorId($idSite, $segment);
     }
     $newSegment = ($segment === false ? '' : $segment . ';') . 'visitorId==' . $visitorId;
     $visits = $this->loadLastVisitorDetailsFromDatabase($idSite, $period = false, $date = false, $newSegment, $numVisitorsToFetch = self::VISITOR_PROFILE_MAX_VISITS_TO_AGGREGATE, $overrideVisitorId = false, $minTimestamp = false);
     $this->addFilterToCleanVisitors($visits, $idSite, $flat = false, $doNotFetchActions = false, $filterNow = true);
     if ($visits->getRowsCount() == 0) {
         return array();
     }
     $isEcommerceEnabled = Site::isEcommerceEnabledFor($idSite);
     $result = array();
     $result['totalVisits'] = 0;
     $result['totalVisitDuration'] = 0;
     $result['totalActions'] = 0;
     $result['totalSearches'] = 0;
     $result['totalPageViews'] = 0;
     $result['totalGoalConversions'] = 0;
     $result['totalConversionsByGoal'] = array();
     if ($isEcommerceEnabled) {
         $result['totalEcommerceConversions'] = 0;
         $result['totalEcommerceRevenue'] = 0;
         $result['totalEcommerceItems'] = 0;
         $result['totalAbandonedCarts'] = 0;
         $result['totalAbandonedCartsRevenue'] = 0;
         $result['totalAbandonedCartsItems'] = 0;
     }
     $countries = array();
     $continents = array();
     $cities = array();
     $siteSearchKeywords = array();
     $pageGenerationTimeTotal = 0;
     // aggregate all requested visits info for total_* info
     foreach ($visits->getRows() as $visit) {
         ++$result['totalVisits'];
         $result['totalVisitDuration'] += $visit->getColumn('visitDuration');
         $result['totalActions'] += $visit->getColumn('actions');
         $result['totalGoalConversions'] += $visit->getColumn('goalConversions');
         // individual goal conversions are stored in action details
         foreach ($visit->getColumn('actionDetails') as $action) {
             if ($action['type'] == 'goal') {
                 // handle goal conversion
                 $idGoal = $action['goalId'];
                 $idGoalKey = 'idgoal=' . $idGoal;
                 if (!isset($result['totalConversionsByGoal'][$idGoalKey])) {
                     $result['totalConversionsByGoal'][$idGoalKey] = 0;
                 }
                 ++$result['totalConversionsByGoal'][$idGoalKey];
                 if (!empty($action['revenue'])) {
                     if (!isset($result['totalRevenueByGoal'][$idGoalKey])) {
                         $result['totalRevenueByGoal'][$idGoalKey] = 0;
                     }
                     $result['totalRevenueByGoal'][$idGoalKey] += $action['revenue'];
                 }
             } else {
                 if ($action['type'] == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER && $isEcommerceEnabled) {
                     ++$result['totalEcommerceConversions'];
                     $result['totalEcommerceRevenue'] += $action['revenue'];
                     $result['totalEcommerceItems'] += $action['items'];
                 } else {
                     if ($action['type'] == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART && $isEcommerceEnabled) {
                         ++$result['totalAbandonedCarts'];
                         $result['totalAbandonedCartsRevenue'] += $action['revenue'];
                         $result['totalAbandonedCartsItems'] += $action['items'];
                     }
                 }
             }
             if (isset($action['siteSearchKeyword'])) {
                 $keyword = $action['siteSearchKeyword'];
                 if (!isset($siteSearchKeywords[$keyword])) {
                     $siteSearchKeywords[$keyword] = 0;
                     ++$result['totalSearches'];
                 }
                 ++$siteSearchKeywords[$keyword];
             }
             if (isset($action['generationTime'])) {
                 $pageGenerationTimeTotal += $action['generationTime'];
                 ++$result['totalPageViews'];
             }
         }
         $countryCode = $visit->getColumn('countryCode');
         if (!isset($countries[$countryCode])) {
             $countries[$countryCode] = 0;
         }
         ++$countries[$countryCode];
         $continentCode = $visit->getColumn('continentCode');
         if (!isset($continents[$continentCode])) {
             $continents[$continentCode] = 0;
//.........这里部分代码省略.........
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:101,代码来源:API.php

示例8: __construct

 public function __construct($idSite)
 {
     $this->idSite = $idSite;
     $this->isEcommerceEnabled = Site::isEcommerceEnabledFor($this->idSite);
 }
开发者ID:hongquan,项目名称:piwik,代码行数:5,代码来源:VisitorProfile.php

示例9: getSitesInfo

 public function getSitesInfo($isWidgetized = false)
 {
     Piwik::checkUserHasSomeViewAccess();
     $displayRevenueColumn = Common::isGoalPluginEnabled();
     $date = Common::getRequestVar('date', 'today');
     $period = Common::getRequestVar('period', 'day');
     $siteIds = APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess();
     list($minDate, $maxDate) = Site::getMinMaxDateAcrossWebsites($siteIds);
     // overwrites the default Date set in the parent controller
     // Instead of the default current website's local date,
     // we set "today" or "yesterday" based on the default Piwik timezone
     $piwikDefaultTimezone = APISitesManager::getInstance()->getDefaultTimezone();
     if ($period != 'range') {
         $date = $this->getDateParameterInTimezone($date, $piwikDefaultTimezone);
         $this->setDate($date);
         $date = $date->toString();
     }
     $dataTable = APIMultiSites::getInstance()->getAll($period, $date, $segment = false);
     // put data into a form the template will understand better
     $digestableData = array();
     foreach ($siteIds as $idSite) {
         $isEcommerceEnabled = Site::isEcommerceEnabledFor($idSite);
         $digestableData[$idSite] = array('idsite' => $idSite, 'main_url' => Site::getMainUrlFor($idSite), 'name' => Site::getNameFor($idSite), 'visits' => 0, 'pageviews' => 0);
         if ($period != 'range') {
             $digestableData[$idSite]['visits_evolution'] = 0;
             $digestableData[$idSite]['pageviews_evolution'] = 0;
         }
         if ($displayRevenueColumn) {
             $revenueDefault = $isEcommerceEnabled ? 0 : "'-'";
             if ($period != 'range') {
                 $digestableData[$idSite]['revenue_evolution'] = $revenueDefault;
             }
         }
     }
     foreach ($dataTable->getRows() as $row) {
         $idsite = (int) $row->getMetadata('idsite');
         $site =& $digestableData[$idsite];
         $site['visits'] = (int) $row->getColumn('nb_visits');
         $site['pageviews'] = (int) $row->getColumn('nb_pageviews');
         if ($displayRevenueColumn) {
             if ($row->getColumn('revenue') !== false) {
                 $site['revenue'] = $row->getColumn('revenue');
             }
         }
         if ($period != 'range') {
             $site['visits_evolution'] = $row->getColumn('visits_evolution');
             $site['pageviews_evolution'] = $row->getColumn('pageviews_evolution');
             if ($displayRevenueColumn) {
                 $site['revenue_evolution'] = $row->getColumn('revenue_evolution');
             }
         }
     }
     $this->applyPrettyMoney($digestableData);
     $view = new View("@MultiSites/getSitesInfo");
     $view->isWidgetized = $isWidgetized;
     $view->sitesData = array_values($digestableData);
     $view->evolutionBy = $this->evolutionBy;
     $view->period = $period;
     $view->page = $this->page;
     $view->limit = $this->limit;
     $view->orderBy = $this->orderBy;
     $view->order = $this->order;
     $view->totalVisits = $dataTable->getMetadata('total_nb_visits');
     $view->totalRevenue = $dataTable->getMetadata('total_revenue');
     $view->displayRevenueColumn = $displayRevenueColumn;
     $view->totalPageviews = $dataTable->getMetadata('total_nb_pageviews');
     $view->pastTotalVisits = $dataTable->getMetadata('last_period_total_nb_visits');
     $view->totalVisitsEvolution = $dataTable->getMetadata('total_visits_evolution');
     if ($view->totalVisitsEvolution > 0) {
         $view->totalVisitsEvolution = '+' . $view->totalVisitsEvolution;
     }
     if ($period != 'range') {
         $lastPeriod = Period::factory($period, $dataTable->getMetadata('last_period_date'));
         $view->pastPeriodPretty = self::getCalendarPrettyDate($lastPeriod);
     }
     $params = $this->getGraphParamsModified();
     $view->dateSparkline = $period == 'range' ? $date : $params['date'];
     $view->autoRefreshTodayReport = false;
     // if the current date is today, or yesterday,
     // in case the website is set to UTC-12), or today in UTC+14, we refresh the page every 5min
     if (in_array($date, array('today', date('Y-m-d'), 'yesterday', Date::factory('yesterday')->toString('Y-m-d'), Date::factory('now', 'UTC+14')->toString('Y-m-d')))) {
         $view->autoRefreshTodayReport = Config::getInstance()->General['multisites_refresh_after_seconds'];
     }
     $this->setGeneralVariablesView($view);
     $this->setMinDateView($minDate, $view);
     $this->setMaxDateView($maxDate, $view);
     $view->show_sparklines = Config::getInstance()->General['show_multisites_sparklines'];
     return $view->render();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:89,代码来源:Controller.php


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