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


PHP Common::isGoalPluginEnabled方法代码示例

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


在下文中一共展示了Common::isGoalPluginEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getSitesInfo

 public function getSitesInfo($isWidgetized = false)
 {
     Piwik::checkUserHasSomeViewAccess();
     $date = Common::getRequestVar('date', 'today');
     $period = Common::getRequestVar('period', 'day');
     $view = new View("@MultiSites/getSitesInfo");
     $view->isWidgetized = $isWidgetized;
     $view->displayRevenueColumn = Common::isGoalPluginEnabled();
     $view->limit = Config::getInstance()->General['all_websites_website_per_page'];
     $view->show_sparklines = Config::getInstance()->General['show_multisites_sparklines'];
     $view->autoRefreshTodayReport = 0;
     // 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'];
     }
     $params = $this->getGraphParamsModified();
     $view->dateSparkline = $period == 'range' ? $date : $params['date'];
     $this->setGeneralVariablesView($view);
     return $view->render();
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:21,代码来源:Controller.php

示例3: getAllMetricsToKeep

 /**
  * Returns the names of metrics that should be kept when purging as they appear in
  * archive tables.
  */
 public static function getAllMetricsToKeep()
 {
     $metricsToKeep = self::getMetricsToKeep();
     // convert goal metric names to correct archive names
     if (Common::isGoalPluginEnabled()) {
         $goalMetricsToKeep = self::getGoalMetricsToKeep();
         $maxGoalId = self::getMaxGoalId();
         // for each goal metric, there's a different name for each goal, including the overview,
         // the order report & cart report
         foreach ($goalMetricsToKeep as $metric) {
             for ($i = 1; $i <= $maxGoalId; ++$i) {
                 $metricsToKeep[] = Archiver::getRecordName($metric, $i);
             }
             $metricsToKeep[] = Archiver::getRecordName($metric);
             $metricsToKeep[] = Archiver::getRecordName($metric, GoalManager::IDGOAL_ORDER);
             $metricsToKeep[] = Archiver::getRecordName($metric, GoalManager::IDGOAL_CART);
         }
     }
     return $metricsToKeep;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:24,代码来源:PrivacyManager.php

示例4: getApiMetrics

 /**
  * @ignore
  */
 public static function getApiMetrics($enhanced)
 {
     $metrics = self::$baseMetrics;
     if (Common::isActionsPluginEnabled()) {
         $metrics[self::NB_PAGEVIEWS_LABEL] = array(self::METRIC_TRANSLATION_KEY => 'General_ColumnPageviews', self::METRIC_EVOLUTION_COL_NAME_KEY => 'pageviews_evolution', self::METRIC_RECORD_NAME_KEY => self::NB_PAGEVIEWS_METRIC, self::METRIC_COL_NAME_KEY => self::NB_PAGEVIEWS_LABEL, self::METRIC_IS_ECOMMERCE_KEY => false);
     }
     if (Common::isGoalPluginEnabled()) {
         // goal revenue metric
         $metrics[self::GOAL_REVENUE_METRIC] = array(self::METRIC_TRANSLATION_KEY => 'General_ColumnRevenue', self::METRIC_EVOLUTION_COL_NAME_KEY => self::GOAL_REVENUE_METRIC . '_evolution', self::METRIC_RECORD_NAME_KEY => Archiver::getRecordName(self::GOAL_REVENUE_METRIC), self::METRIC_COL_NAME_KEY => self::GOAL_REVENUE_METRIC, self::METRIC_IS_ECOMMERCE_KEY => false);
         if ($enhanced) {
             // number of goal conversions metric
             $metrics[self::GOAL_CONVERSION_METRIC] = array(self::METRIC_TRANSLATION_KEY => 'Goals_ColumnConversions', self::METRIC_EVOLUTION_COL_NAME_KEY => self::GOAL_CONVERSION_METRIC . '_evolution', self::METRIC_RECORD_NAME_KEY => Archiver::getRecordName(self::GOAL_CONVERSION_METRIC), self::METRIC_COL_NAME_KEY => self::GOAL_CONVERSION_METRIC, self::METRIC_IS_ECOMMERCE_KEY => false);
             // number of orders
             $metrics[self::ECOMMERCE_ORDERS_METRIC] = array(self::METRIC_TRANSLATION_KEY => 'General_EcommerceOrders', self::METRIC_EVOLUTION_COL_NAME_KEY => self::ECOMMERCE_ORDERS_METRIC . '_evolution', self::METRIC_RECORD_NAME_KEY => Archiver::getRecordName(self::GOAL_CONVERSION_METRIC, 0), self::METRIC_COL_NAME_KEY => self::ECOMMERCE_ORDERS_METRIC, self::METRIC_IS_ECOMMERCE_KEY => true);
             // eCommerce revenue
             $metrics[self::ECOMMERCE_REVENUE_METRIC] = array(self::METRIC_TRANSLATION_KEY => 'General_ProductRevenue', self::METRIC_EVOLUTION_COL_NAME_KEY => self::ECOMMERCE_REVENUE_METRIC . '_evolution', self::METRIC_RECORD_NAME_KEY => Archiver::getRecordName(self::GOAL_REVENUE_METRIC, 0), self::METRIC_COL_NAME_KEY => self::ECOMMERCE_REVENUE_METRIC, self::METRIC_IS_ECOMMERCE_KEY => true);
         }
     }
     return $metrics;
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:23,代码来源:API.php

示例5: detectGoalId

 public function detectGoalId($idSite)
 {
     if (!Common::isGoalPluginEnabled()) {
         return false;
     }
     $goals = $this->getGoalDefinitions($idSite);
     if (!isset($goals[$this->idGoal])) {
         return false;
     }
     $goal = $goals[$this->idGoal];
     $url = $this->request->getParam('url');
     $goal['url'] = PageUrl::excludeQueryParametersFromUrl($url, $idSite);
     $this->convertedGoals[] = $goal;
     return true;
 }
开发者ID:huycao,项目名称:yodelivery,代码行数:15,代码来源:GoalManager.php

示例6: detectGoalId

 public function detectGoalId($idSite, Request $request)
 {
     if (!Common::isGoalPluginEnabled()) {
         return null;
     }
     $idGoal = $request->getParam('idgoal');
     $goals = $this->getGoalDefinitions($idSite);
     if (!isset($goals[$idGoal])) {
         return null;
     }
     $goal = $goals[$idGoal];
     $url = $request->getParam('url');
     $goal['url'] = PageUrl::excludeQueryParametersFromUrl($url, $idSite);
     return $goal;
 }
开发者ID:annaduraig,项目名称:piwik,代码行数:15,代码来源:GoalManager.php

示例7: 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

示例8: setMetricsTotalsMetadata

 /**
  * Sets the total visits, actions & revenue for a DataTable returned by
  * $this->buildDataTable.
  *
  * @param DataTable $dataTable
  * @param array $apiMetrics Metrics info.
  * @return array Array of three values: total visits, total actions, total revenue
  */
 private function setMetricsTotalsMetadata($dataTable, $apiMetrics)
 {
     if ($dataTable instanceof DataTable\Map) {
         foreach ($dataTable->getDataTables() as $table) {
             $this->setMetricsTotalsMetadata($table, $apiMetrics);
         }
     } else {
         $revenueMetric = '';
         if (Common::isGoalPluginEnabled()) {
             $revenueMetric = Archiver::getRecordName(self::GOAL_REVENUE_METRIC);
         }
         $totals = array();
         foreach ($apiMetrics as $label => $metricInfo) {
             $totalMetadataName = self::getTotalMetadataName($label);
             $totals[$totalMetadataName] = 0;
         }
         foreach ($dataTable->getRows() as $row) {
             foreach ($apiMetrics as $label => $metricInfo) {
                 $totalMetadataName = self::getTotalMetadataName($label);
                 $totals[$totalMetadataName] += $row->getColumn($metricInfo[self::METRIC_RECORD_NAME_KEY]);
             }
         }
         foreach ($totals as $name => $value) {
             $dataTable->setMetadata($name, $value);
         }
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:35,代码来源:API.php


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