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


PHP Common::getRequestVar方法代码示例

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


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

示例1: configureSegments

 protected function configureSegments()
 {
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     if (empty($idSite)) {
         return array();
     }
     $configuration = StaticContainer::get('Piwik\\Plugins\\CustomDimensions\\Dao\\Configuration');
     $dimensions = $configuration->getCustomDimensionsForSite($idSite);
     foreach ($dimensions as $dimension) {
         if (!$dimension['active']) {
             continue;
         }
         $segment = new Segment();
         $segment->setSegment(CustomDimensionsRequestProcessor::buildCustomDimensionTrackingApiName($dimension));
         $segment->setType(Segment::TYPE_DIMENSION);
         $segment->setName($dimension['name']);
         $columnName = LogTable::buildCustomDimensionColumnName($dimension);
         if ($dimension['scope'] === CustomDimensions::SCOPE_ACTION) {
             $segment->setSqlSegment('log_link_visit_action. ' . $columnName);
             $segment->setCategory('General_Actions');
             $segment->setSuggestedValuesCallback(function ($idSite, $maxValuesToReturn) use($dimension) {
                 $autoSuggest = new AutoSuggest();
                 return $autoSuggest->getMostUsedActionDimensionValues($dimension, $idSite, $maxValuesToReturn);
             });
         } elseif ($dimension['scope'] === CustomDimensions::SCOPE_VISIT) {
             $segment->setSqlSegment('log_visit. ' . $columnName);
             $segment->setCategory('General_Visit');
         } else {
             continue;
         }
         $this->addSegment($segment);
     }
 }
开发者ID:piwik,项目名称:plugin-CustomDimensions,代码行数:33,代码来源:CustomDimension.php

示例2: render

 /**
  * @see ViewDataTable::main()
  * @return mixed
  */
 public function render()
 {
     // If period=range, we force the sparkline to draw daily data points
     $period = Common::getRequestVar('period');
     if ($period == 'range') {
         $_GET['period'] = 'day';
     }
     $this->loadDataTableFromAPI();
     // then revert the hack for potentially subsequent getRequestVar
     $_GET['period'] = $period;
     $values = $this->getValuesFromDataTable($this->dataTable);
     if (empty($values)) {
         $values = array_fill(0, 30, 0);
     }
     $graph = new \Piwik\Visualization\Sparkline();
     $graph->setValues($values);
     $height = Common::getRequestVar('height', 0, 'int');
     if (!empty($height)) {
         $graph->setHeight($height);
     }
     $width = Common::getRequestVar('width', 0, 'int');
     if (!empty($width)) {
         $graph->setWidth($width);
     }
     $graph->main();
     return $graph->render();
 }
开发者ID:piwik,项目名称:piwik,代码行数:31,代码来源:Sparkline.php

示例3: hasReportBeenPurged

 /**
  * Returns true if it is likely that the data for this report has been purged and if the
  * user should be told about that.
  *
  * In order for this function to return true, the following must also be true:
  * - The data table for this report must either be empty or not have been fetched.
  * - The period of this report is not a multiple period.
  * - The date of this report must be older than the delete_reports_older_than config option.
  * @param  DataTableInterface $dataTable
  * @return bool
  */
 public static function hasReportBeenPurged($dataTable)
 {
     $strPeriod = Common::getRequestVar('period', false);
     $strDate = Common::getRequestVar('date', false);
     if (false !== $strPeriod && false !== $strDate && (is_null($dataTable) || !empty($dataTable) && $dataTable->getRowsCount() == 0)) {
         // if range, only look at the first date
         if ($strPeriod == 'range') {
             $idSite = Common::getRequestVar('idSite', '');
             if (intval($idSite) != 0) {
                 $site = new Site($idSite);
                 $timezone = $site->getTimezone();
             } else {
                 $timezone = 'UTC';
             }
             $period = new Range('range', $strDate, $timezone);
             $reportDate = $period->getDateStart();
         } elseif (Period::isMultiplePeriod($strDate, $strPeriod)) {
             // if a multiple period, this function is irrelevant
             return false;
         } else {
             // otherwise, use the date as given
             $reportDate = Date::factory($strDate);
         }
         $reportYear = $reportDate->toString('Y');
         $reportMonth = $reportDate->toString('m');
         if (static::shouldReportBePurged($reportYear, $reportMonth)) {
             return true;
         }
     }
     return false;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:42,代码来源:PrivacyManager.php

示例4: addOptOutStyles

 /**
  * @throws \Exception
  */
 public function addOptOutStyles()
 {
     /** @var \Piwik\Plugins\CoreAdminHome\OptOutManager $manager */
     $manager = StaticContainer::get('Piwik\\Plugins\\CoreAdminHome\\OptOutManager');
     // See Issue #33
     $siteId = Common::getRequestVar('idsite', 0, 'integer');
     // Is still available for BC
     if (!$siteId) {
         $siteId = Common::getRequestVar('idSite', 0, 'integer');
     }
     // Try to find siteId in Session
     if (!$siteId) {
         return;
     }
     $site = API::getInstance()->getSiteDataId($siteId);
     if (!$site) {
         return;
     }
     $manager->addQueryParameter('idsite', $siteId);
     // Add CSS file if set
     if (!empty($site['custom_css_file'])) {
         $manager->addStylesheet($site['custom_css_file'], false);
     }
     // Add CSS Inline Styles if set
     if (!empty($site['custom_css'])) {
         $manager->addStylesheet($site['custom_css'], true);
     }
 }
开发者ID:peterbo,项目名称:PiwikCustomOptOut,代码行数:31,代码来源:CustomOptOut.php

示例5: index

 public function index()
 {
     Piwik::checkUserHasSuperUserAccess();
     $limit = Common::getRequestVar('limit', 100, 'int');
     // Render the Twig template templates/index.twig and assign the view variable answerToLife to the view.
     return $this->renderTemplate('index', array('limit' => $limit));
 }
开发者ID:piwik,项目名称:plugin-LogViewer,代码行数:7,代码来源:Controller.php

示例6: beforeRender

 /**
  * Configure visualization.
  */
 public function beforeRender()
 {
     $this->config->datatable_js_type = 'VisitorLog';
     $this->config->enable_sort = false;
     $this->config->show_search = false;
     $this->config->show_exclude_low_population = false;
     $this->config->show_offset_information = false;
     $this->config->show_all_views_icons = false;
     $this->config->show_table_all_columns = false;
     $this->config->show_export_as_rss_feed = false;
     $this->config->documentation = Piwik::translate('Live_VisitorLogDocumentation', array('<br />', '<br />'));
     $filterEcommerce = Common::getRequestVar('filterEcommerce', 0, 'int');
     $this->config->custom_parameters = array('totalRows' => 10000000, 'filterEcommerce' => $filterEcommerce, 'pageUrlNotDefined' => Piwik::translate('General_NotDefined', Piwik::translate('Actions_ColumnPageURL')), 'smallWidth' => 1 == Common::getRequestVar('small', 0, 'int'));
     $this->config->footer_icons = array(array('class' => 'tableAllColumnsSwitch', 'buttons' => array(array('id' => static::ID, 'title' => Piwik::translate('Live_LinkVisitorLog'), 'icon' => 'plugins/Zeitgeist/images/table.png'))));
     // determine if each row has ecommerce activity or not
     if ($filterEcommerce) {
         $this->dataTable->filter('ColumnCallbackAddMetadata', array('actionDetails', 'hasEcommerce', function ($actionDetails) use($filterEcommerce) {
             foreach ($actionDetails as $action) {
                 $isEcommerceOrder = $action['type'] == 'ecommerceOrder' && $filterEcommerce == \Piwik\Plugins\Goals\Controller::ECOMMERCE_LOG_SHOW_ORDERS;
                 $isAbandonedCart = $action['type'] == 'ecommerceAbandonedCart' && $filterEcommerce == \Piwik\Plugins\Goals\Controller::ECOMMERCE_LOG_SHOW_ABANDONED_CARTS;
                 if ($isAbandonedCart || $isEcommerceOrder) {
                     return true;
                 }
             }
             return false;
         }));
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:31,代码来源:VisitorLog.php

示例7: dispatch

 public function dispatch()
 {
     $module = Common::getRequestVar('module', '', 'string');
     $action = Common::getRequestVar('action', '', 'string');
     if ($module == 'CoreUpdater' || $module == 'Proxy' || $module == 'Installation' || $module == 'LanguagesManager' && $action == 'saveLanguage') {
         return;
     }
     $updater = new PiwikCoreUpdater();
     $updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
     if (!empty($updates)) {
         Filesystem::deleteAllCacheOnUpdate();
     }
     if ($updater->getComponentUpdates() !== null) {
         if (FrontController::shouldRethrowException()) {
             throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
         } elseif ($module === 'API') {
             $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST));
             $response = new ResponseBuilder($outputFormat);
             $e = new Exception('Database Upgrade Required. Your Piwik database is out-of-date, and must be upgraded before you can continue.');
             echo $response->getResponseException($e);
             Common::sendResponseCode(503);
             exit;
         } else {
             Piwik::redirectToModule('CoreUpdater');
         }
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:27,代码来源:CoreUpdater.php

示例8: renderTable

 /**
  * Computes the output for the given data table
  *
  * @param DataTable $table
  * @return string
  * @throws Exception
  */
 protected function renderTable($table)
 {
     if (!$table instanceof DataTable\Map || $table->getKeyName() != 'date') {
         throw new Exception("RSS feeds can be generated for one specific website &idSite=X." . "\nPlease specify only one idSite or consider using &format=XML instead.");
     }
     $idSite = Common::getRequestVar('idSite', 1, 'int');
     $period = Common::getRequestVar('period');
     $piwikUrl = SettingsPiwik::getPiwikUrl() . "?module=CoreHome&action=index&idSite=" . $idSite . "&period=" . $period;
     $out = "";
     $moreRecentFirst = array_reverse($table->getDataTables(), true);
     foreach ($moreRecentFirst as $date => $subtable) {
         /** @var DataTable $subtable */
         $timestamp = $subtable->getMetadata(Archive\DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getDateStart()->getTimestamp();
         $site = $subtable->getMetadata(Archive\DataTableFactory::TABLE_METADATA_SITE_INDEX);
         $pudDate = date('r', $timestamp);
         $dateInSiteTimezone = Date::factory($timestamp);
         if ($site) {
             $dateInSiteTimezone = $dateInSiteTimezone->setTimezone($site->getTimezone());
         }
         $dateInSiteTimezone = $dateInSiteTimezone->toString('Y-m-d');
         $thisPiwikUrl = Common::sanitizeInputValue($piwikUrl . "&date={$dateInSiteTimezone}");
         $siteName = $site ? $site->getName() : '';
         $title = $siteName . " on " . $date;
         $out .= "\t<item>\n\t\t<pubDate>{$pudDate}</pubDate>\n\t\t<guid>{$thisPiwikUrl}</guid>\n\t\t<link>{$thisPiwikUrl}</link>\n\t\t<title>{$title}</title>\n\t\t<author>http://piwik.org</author>\n\t\t<description>";
         $out .= Common::sanitizeInputValue($this->renderDataTable($subtable));
         $out .= "</description>\n\t</item>\n";
     }
     $header = $this->getRssHeader();
     $footer = $this->getRssFooter();
     return $header . $out . $footer;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:38,代码来源:Rss.php

示例9: getReportGraph

 /**
  * Generates a graphic report based on the given parameters
  * @param  string $type             
  * @param  string $apiMethod        
  * @param  string $controllerMethod 
  * @param  array  $selectable       
  * @param  array  $to_display       
  * @return View                   
  */
 private function getReportGraph($type, $apiMethod, $controllerMethod, $selectable = array(), $to_display = array())
 {
     $view = ViewDataTableFactory::build($type, $apiMethod, $controllerMethod, $forceDefault = true);
     $view->config->show_goals = false;
     if (empty($selectable)) {
         if (Common::getRequestVar('period', false) == 'day') {
             $selectable = array('nb_visits', 'nb_uniq_visitors', 'nb_actions');
         } else {
             $selectable = array('nb_visits', 'nb_actions');
         }
     }
     if (empty($to_display)) {
         $to_display = Common::getRequestVar('columns', false);
         if (false !== $to_display) {
             $to_display = Piwik::getArrayFromApiParameter($columns);
         }
     }
     if (false !== $to_display) {
         $to_display = !is_array($to_display) ? array($to_display) : $to_display;
     } else {
         $to_display = $selectable;
     }
     $view->config->selectable_columns = $selectable;
     $view->config->columns_to_display = $to_display;
     $view->config->show_footer_icons = false;
     return $this->renderView($view);
 }
开发者ID:adevait,项目名称:CampaignDetailed,代码行数:36,代码来源:Controller.php

示例10: getCustomDimensionsInScope

 private function getCustomDimensionsInScope($scope, Request $request)
 {
     $dimensions = self::getCachedCustomDimensions($request);
     $params = $request->getParams();
     $values = array();
     foreach ($dimensions as $dimension) {
         if ($dimension['scope'] !== $scope) {
             continue;
         }
         $field = self::buildCustomDimensionTrackingApiName($dimension);
         $dbField = Dao\LogTable::buildCustomDimensionColumnName($dimension);
         $value = Common::getRequestVar($field, '', 'string', $params);
         if ($value !== '') {
             $values[$dbField] = $value;
             continue;
         }
         $extractions = $dimension['extractions'];
         if (is_array($extractions)) {
             foreach ($extractions as $extraction) {
                 if (!array_key_exists('dimension', $extraction) || !array_key_exists('pattern', $extraction) || empty($extraction['pattern'])) {
                     continue;
                 }
                 $extraction = new Extraction($extraction['dimension'], $extraction['pattern']);
                 $extraction->setCaseSensitive($dimension['case_sensitive']);
                 $value = $extraction->extract($request);
                 if (!isset($value) || '' === $value) {
                     continue;
                 }
                 $values[$dbField] = $value;
                 break;
             }
         }
     }
     return $values;
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:35,代码来源:CustomDimensionsRequestProcessor.php

示例11: setShowGoalsColumnsProperties

 private function setShowGoalsColumnsProperties()
 {
     // set view properties based on goal requested
     $idSite = Common::getRequestVar('idSite', null, 'int');
     $idGoal = Common::getRequestVar('idGoal', AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW, 'string');
     $goalsToProcess = null;
     if (Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER == $idGoal) {
         $this->setPropertiesForEcommerceView();
         $goalsToProcess = array($idGoal);
     } else {
         if (AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE == $idGoal) {
             $this->setPropertiesForGoals($idSite, 'all');
             $goalsToProcess = $this->getAllGoalIds($idSite);
         } else {
             if (AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW == $idGoal) {
                 $this->setPropertiesForGoalsOverview($idSite);
                 $goalsToProcess = $this->getAllGoalIds($idSite);
             } else {
                 $this->setPropertiesForGoals($idSite, array($idGoal));
                 $goalsToProcess = array($idGoal);
             }
         }
     }
     // add goals columns
     $this->config->filters[] = array('AddColumnsProcessedMetricsGoal', array($enable = true, $idGoal, $goalsToProcess), $priority = true);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:26,代码来源:Goals.php

示例12: render

 /**
  * @see ViewDataTable::main()
  * @return mixed
  */
 public function render()
 {
     $view = new View('@CoreVisualizations/_dataTableViz_sparklines.twig');
     $columnsList = array();
     if ($this->config->hasSparklineMetrics()) {
         foreach ($this->config->getSparklineMetrics() as $cols) {
             $columns = $cols['columns'];
             if (!is_array($columns)) {
                 $columns = array($columns);
             }
             $columnsList = array_merge($columns, $columnsList);
         }
     }
     $view->allMetricsDocumentation = Metrics::getDefaultMetricsDocumentation();
     $this->requestConfig->request_parameters_to_modify['columns'] = $columnsList;
     $this->requestConfig->request_parameters_to_modify['format_metrics'] = '1';
     if (!empty($this->requestConfig->apiMethodToRequestDataTable)) {
         $this->fetchConfiguredSparklines();
     }
     $view->sparklines = $this->config->getSortedSparklines();
     $view->isWidget = Common::getRequestVar('widget', 0, 'int');
     $view->titleAttributes = $this->config->title_attributes;
     $view->footerMessage = $this->config->show_footer_message;
     $view->areSparklinesLinkable = $this->config->areSparklinesLinkable();
     $view->title = '';
     if ($this->config->show_title) {
         $view->title = $this->config->title;
     }
     return $view->render();
 }
开发者ID:piwik,项目名称:piwik,代码行数:34,代码来源:Sparklines.php

示例13: configureView

 public function configureView(ViewDataTable $view)
 {
     $idSubtable = Common::getRequestVar('idSubtable', false);
     $labelColumnTitle = $this->name;
     switch ($idSubtable) {
         case Common::REFERRER_TYPE_SEARCH_ENGINE:
             $labelColumnTitle = Piwik::translate('Referrers_ColumnSearchEngine');
             break;
         case Common::REFERRER_TYPE_WEBSITE:
             $labelColumnTitle = Piwik::translate('Referrers_ColumnWebsite');
             break;
         case Common::REFERRER_TYPE_CAMPAIGN:
             $labelColumnTitle = Piwik::translate('Referrers_ColumnCampaign');
             break;
         default:
             break;
     }
     $view->config->show_search = false;
     $view->config->show_offset_information = false;
     $view->config->show_pagination_control = false;
     $view->config->show_limit_control = false;
     $view->config->show_exclude_low_population = false;
     $view->config->addTranslation('label', $labelColumnTitle);
     $view->requestConfig->filter_limit = 10;
     if ($view->isViewDataTableId(HtmlTable::ID)) {
         $view->config->disable_subtable_when_show_goals = true;
     }
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:28,代码来源:GetReferrerType.php

示例14: __construct

 /**
  * Constructor.
  */
 public function __construct($idSite = false)
 {
     parent::__construct();
     $this->jsClass = "SegmentSelectorControl";
     $this->cssIdentifier = "segmentEditorPanel";
     $this->cssClass = "piwikTopControl";
     $this->idSite = $idSite ?: Common::getRequestVar('idSite', false, 'int');
     $this->selectedSegment = Common::getRequestVar('segment', false, 'string');
     $segments = APIMetadata::getInstance()->getSegmentsMetadata($this->idSite);
     $segmentsByCategory = $customVariablesSegments = array();
     foreach ($segments as $segment) {
         if ($segment['category'] == Piwik::translate('General_Visit') && ($segment['type'] == 'metric' && $segment['segment'] != 'visitIp')) {
             $metricsLabel = Piwik::translate('General_Metrics');
             $metricsLabel[0] = strtolower($metricsLabel[0]);
             $segment['category'] .= ' (' . $metricsLabel . ')';
         }
         $segmentsByCategory[$segment['category']][] = $segment;
     }
     uksort($segmentsByCategory, array($this, 'sortSegmentCategories'));
     $this->createRealTimeSegmentsIsEnabled = Config::getInstance()->General['enable_create_realtime_segments'];
     $this->segmentsByCategory = $segmentsByCategory;
     $this->nameOfCurrentSegment = '';
     $this->isSegmentNotAppliedBecauseBrowserArchivingIsDisabled = 0;
     $this->availableSegments = API::getInstance()->getAll($this->idSite);
     foreach ($this->availableSegments as &$savedSegment) {
         $savedSegment['name'] = Common::sanitizeInputValue($savedSegment['name']);
         if (!empty($this->selectedSegment) && $this->selectedSegment == $savedSegment['definition']) {
             $this->nameOfCurrentSegment = $savedSegment['name'];
             $this->isSegmentNotAppliedBecauseBrowserArchivingIsDisabled = $this->wouldApplySegment($savedSegment) ? 0 : 1;
         }
     }
     $this->authorizedToCreateSegments = SegmentEditorAPI::getInstance()->isUserCanAddNewSegment($this->idSite);
     $this->isUserAnonymous = Piwik::isUserIsAnonymous();
     $this->segmentTranslations = $this->getTranslations();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:38,代码来源:SegmentSelectorControl.php

示例15: __construct

 /**
  * The constructor
  * Initialize some local variables from the request
  * @param int $idSite
  * @param Date $date ($this->date from controller)
  * @param null|string $graphType
  * @throws Exception
  */
 public function __construct($idSite, $date, $graphType = 'graphEvolution')
 {
     $this->apiMethod = Common::getRequestVar('apiMethod', '', 'string');
     if (empty($this->apiMethod)) {
         throw new Exception("Parameter apiMethod not set.");
     }
     $this->label = DataTablePostProcessor::getLabelFromRequest($_GET);
     if (!is_array($this->label)) {
         throw new Exception("Expected label to be an array, got instead: " . $this->label);
     }
     $this->label = $this->label[0];
     if ($this->label === '') {
         throw new Exception("Parameter label not set.");
     }
     $this->period = Common::getRequestVar('period', '', 'string');
     PeriodFactory::checkPeriodIsEnabled($this->period);
     $this->idSite = $idSite;
     $this->graphType = $graphType;
     if ($this->period != 'range') {
         // handle day, week, month and year: display last X periods
         $end = $date->toString();
         list($this->date, $lastN) = EvolutionViz::getDateRangeAndLastN($this->period, $end);
     }
     $this->segment = \Piwik\API\Request::getRawSegmentFromRequest();
     $this->loadEvolutionReport();
 }
开发者ID:drabberhorizon,项目名称:ActiveNative,代码行数:34,代码来源:RowEvolution.php


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