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


PHP Url::getQueryStringFromParameters方法代码示例

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


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

示例1: initChartObjectData

 /**
  * @param DataTable|DataTable\Map $dataTable
  * @param $visualization
  */
 protected function initChartObjectData($dataTable, $visualization)
 {
     // if the loaded datatable is a simple DataTable, it is most likely a plugin plotting some custom data
     // we don't expect plugin developers to return a well defined Set
     if ($dataTable instanceof DataTable) {
         parent::initChartObjectData($dataTable, $visualization);
         return;
     }
     // the X label is extracted from the 'period' object in the table's metadata
     $xLabels = array();
     foreach ($dataTable->getDataTables() as $metadataDataTable) {
         $xLabels[] = $metadataDataTable->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getLocalizedShortString();
         // eg. "Aug 2009"
     }
     $units = $this->getUnitsForColumnsToDisplay();
     // if rows to display are not specified, default to all rows (TODO: perhaps this should be done elsewhere?)
     $rowsToDisplay = $this->properties['rows_to_display'] ?: array_unique($dataTable->getColumn('label')) ?: array(false);
     // collect series data to show. each row-to-display/column-to-display permutation creates a series.
     $allSeriesData = array();
     $seriesUnits = array();
     foreach ($rowsToDisplay as $rowLabel) {
         foreach ($this->properties['columns_to_display'] as $columnName) {
             $seriesLabel = $this->getSeriesLabel($rowLabel, $columnName);
             $seriesData = $this->getSeriesData($rowLabel, $columnName, $dataTable);
             $allSeriesData[$seriesLabel] = $seriesData;
             $seriesUnits[$seriesLabel] = $units[$columnName];
         }
     }
     $visualization->dataTable = $dataTable;
     $visualization->properties = $this->properties;
     $visualization->setAxisXLabels($xLabels);
     $visualization->setAxisYValues($allSeriesData);
     $visualization->setAxisYUnits($seriesUnits);
     $dataTables = $dataTable->getDataTables();
     if ($this->isLinkEnabled()) {
         $idSite = Common::getRequestVar('idSite', null, 'int');
         $periodLabel = reset($dataTables)->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getLabel();
         $axisXOnClick = array();
         $queryStringAsHash = $this->getQueryStringAsHash();
         foreach ($dataTable->getDataTables() as $idDataTable => $metadataDataTable) {
             $dateInUrl = $metadataDataTable->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getDateStart();
             $parameters = array('idSite' => $idSite, 'period' => $periodLabel, 'date' => $dateInUrl->toString(), 'segment' => \Piwik\API\Request::getRawSegmentFromRequest());
             $hash = '';
             if (!empty($queryStringAsHash)) {
                 $hash = '#' . Url::getQueryStringFromParameters($queryStringAsHash + $parameters);
             }
             $link = 'index.php?' . Url::getQueryStringFromParameters(array('module' => 'CoreHome', 'action' => 'index') + $parameters) . $hash;
             $axisXOnClick[] = $link;
         }
         $visualization->setAxisXOnClick($axisXOnClick);
     }
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:56,代码来源:Evolution.php

示例2: getQueryFromUrl

 /**
  * Returns the query part from any valid url and adds additional parameters to the query part if needed.
  *
  * @param string $url    Any url eg `"http://example.com/piwik/?foo=bar"`
  * @param array $additionalParamsToAdd    If not empty the given parameters will be added to the query.
  *
  * @return string eg. `"foo=bar&foo2=bar2"`
  * @api
  */
 public static function getQueryFromUrl($url, array $additionalParamsToAdd = array())
 {
     $url = @parse_url($url);
     $query = '';
     if (!empty($url['query'])) {
         $query .= $url['query'];
     }
     if (!empty($additionalParamsToAdd)) {
         if (!empty($query)) {
             $query .= '&';
         }
         $query .= Url::getQueryStringFromParameters($additionalParamsToAdd);
     }
     return $query;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:24,代码来源:UrlHelper.php

示例3: getImageTrackingCode

 /**
  * Returns image link tracking code for a given site with specified options.
  *
  * @param int $idSite The ID to generate tracking code for.
  * @param string $piwikUrl The domain and URL path to the Piwik installation.
  * @param int $idGoal An ID for a goal to trigger a conversion for.
  * @param int $revenue The revenue of the goal conversion. Only used if $idGoal is supplied.
  * @return string The HTML tracking code.
  */
 public function getImageTrackingCode($idSite, $piwikUrl = '', $actionName = false, $idGoal = false, $revenue = false)
 {
     $urlParams = array('idsite' => $idSite, 'rec' => 1);
     if ($actionName !== false) {
         $urlParams['action_name'] = urlencode(Common::unsanitizeInputValue($actionName));
     }
     if ($idGoal !== false) {
         $urlParams['idGoal'] = $idGoal;
         if ($revenue !== false) {
             $urlParams['revenue'] = $revenue;
         }
     }
     /**
      * Triggered when generating image link tracking code server side. Plugins can use
      * this event to customise the image tracking code that is displayed to the
      * user.
      *
      * @param string &$piwikHost The domain and URL path to the Piwik installation, eg,
      *                           `'examplepiwik.com/path/to/piwik'`.
      * @param array &$urlParams The query parameters used in the <img> element's src
      *                          URL. See Piwik's image tracking docs for more info.
      */
     Piwik::postEvent('SitesManager.getImageTrackingCode', array(&$piwikUrl, &$urlParams));
     $piwikUrl = (ProxyHttp::isHttps() ? "https://" : "http://") . $piwikUrl . '/piwik.php';
     return "<!-- Piwik Image Tracker-->\n<img src=\"{$piwikUrl}?" . Url::getQueryStringFromParameters($urlParams) . "\" style=\"border:0\" alt=\"\" />\n<!-- End Piwik -->";
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:35,代码来源:API.php

示例4: testGetQueryStringFromParameters

 /**
  * @group Core
  *
  * @dataProvider getQueryParameters
  */
 public function testGetQueryStringFromParameters($params, $queryString)
 {
     $this->assertEquals($queryString, Url::getQueryStringFromParameters($params));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:UrlTest.php

示例5: checkEnoughUrlsAreTested

 protected function checkEnoughUrlsAreTested($requestUrls)
 {
     $countUrls = count($requestUrls);
     $approximateCountApiToCall = count($this->apiToCall);
     if (empty($requestUrls) || $approximateCountApiToCall > $countUrls) {
         $requestUrls = array_map(function ($params) {
             return is_string($params) ? $params : Url::getQueryStringFromParameters($params);
         }, $requestUrls);
         throw new Exception("Only generated {$countUrls} API calls to test but was expecting more for this test.\n" . "Want to test APIs: " . implode(", ", $this->apiToCall) . ")\n" . "But only generated these URLs: \n" . implode("\n", $requestUrls) . ")\n" . "Note: SystemTestCase is meant to test API methods where the method name starts with get* \n" . "If you want to test other API methods such as add* or update* or any other, please create an IntegrationTestCase instead (via `./console generate:test`)\n");
     }
 }
开发者ID:JoeHorn,项目名称:piwik,代码行数:11,代码来源:Collection.php

示例6: getReportMetadata

 /**
  * @param array $reports
  * @param array $info
  * @return mixed
  */
 public function getReportMetadata(&$reports, $info)
 {
     $idSites = $info['idSites'];
     // If only one website is selected, we add the Graph URL
     if (count($idSites) != 1) {
         return;
     }
     $idSite = reset($idSites);
     // in case API.getReportMetadata was not called with date/period we use sane defaults
     if (empty($info['period'])) {
         $info['period'] = 'day';
     }
     if (empty($info['date'])) {
         $info['date'] = 'today';
     }
     // need two sets of period & date, one for single period graphs, one for multiple periods graphs
     if (Period::isMultiplePeriod($info['date'], $info['period'])) {
         $periodForMultiplePeriodGraph = $info['period'];
         $dateForMultiplePeriodGraph = $info['date'];
         $periodForSinglePeriodGraph = 'range';
         $dateForSinglePeriodGraph = $info['date'];
     } else {
         $periodForSinglePeriodGraph = $info['period'];
         $dateForSinglePeriodGraph = $info['date'];
         $piwikSite = new Site($idSite);
         if ($periodForSinglePeriodGraph == 'range') {
             // for period=range, show the configured sub-periods
             $periodForMultiplePeriodGraph = Config::getInstance()->General['graphs_default_period_to_plot_when_period_range'];
             $dateForMultiplePeriodGraph = $dateForSinglePeriodGraph;
         } else {
             if ($info['period'] == 'day' || !Config::getInstance()->General['graphs_show_evolution_within_selected_period']) {
                 // for period=day, always show the last n days
                 // if graphs_show_evolution_within_selected_period=false, show the last n periods
                 $periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
                 $dateForMultiplePeriodGraph = Range::getRelativeToEndDate($periodForSinglePeriodGraph, 'last' . self::GRAPH_EVOLUTION_LAST_PERIODS, $dateForSinglePeriodGraph, $piwikSite);
             } else {
                 // if graphs_show_evolution_within_selected_period=true, show the days within the period
                 // (except if the period is day, see above)
                 $periodForMultiplePeriodGraph = 'day';
                 $period = PeriodFactory::build($info['period'], $info['date']);
                 $start = $period->getDateStart()->toString();
                 $end = $period->getDateEnd()->toString();
                 $dateForMultiplePeriodGraph = $start . ',' . $end;
             }
         }
     }
     $token_auth = Common::getRequestVar('token_auth', false);
     $segment = Request::getRawSegmentFromRequest();
     /** @var Scheduler $scheduler */
     $scheduler = StaticContainer::getContainer()->get('Piwik\\Scheduler\\Scheduler');
     $isRunningTask = $scheduler->isRunningTask();
     // add the idSubtable if it exists
     $idSubtable = Common::getRequestVar('idSubtable', false);
     $urlPrefix = "index.php?";
     foreach ($reports as &$report) {
         $reportModule = $report['module'];
         $reportAction = $report['action'];
         $reportUniqueId = $reportModule . '_' . $reportAction;
         $parameters = array();
         $parameters['module'] = 'API';
         $parameters['method'] = 'ImageGraph.get';
         $parameters['idSite'] = $idSite;
         $parameters['apiModule'] = $reportModule;
         $parameters['apiAction'] = $reportAction;
         if (!empty($token_auth)) {
             $parameters['token_auth'] = $token_auth;
         }
         // Forward custom Report parameters to the graph URL
         if (!empty($report['parameters'])) {
             $parameters = array_merge($parameters, $report['parameters']);
         }
         if (empty($report['dimension'])) {
             $parameters['period'] = $periodForMultiplePeriodGraph;
             $parameters['date'] = $dateForMultiplePeriodGraph;
         } else {
             $parameters['period'] = $periodForSinglePeriodGraph;
             $parameters['date'] = $dateForSinglePeriodGraph;
         }
         if ($idSubtable !== false) {
             $parameters['idSubtable'] = $idSubtable;
         }
         if (!empty($_GET['_restrictSitesToLogin']) && $isRunningTask) {
             $parameters['_restrictSitesToLogin'] = $_GET['_restrictSitesToLogin'];
         }
         if (!empty($segment)) {
             $parameters['segment'] = $segment;
         }
         $report['imageGraphUrl'] = $urlPrefix . Url::getQueryStringFromParameters($parameters);
         // thanks to API.getRowEvolution, reports with dimensions can now be plotted using an evolution graph
         // however, most reports with a fixed set of dimension values are excluded
         // this is done so Piwik Mobile and Scheduled Reports do not display them
         $reportWithDimensionsSupportsEvolution = empty($report['constantRowsCount']) || in_array($reportUniqueId, self::$CONSTANT_ROW_COUNT_REPORT_EXCEPTIONS);
         $reportSupportsEvolution = !in_array($reportUniqueId, self::$REPORTS_DISABLED_EVOLUTION_GRAPH);
         if ($reportSupportsEvolution && $reportWithDimensionsSupportsEvolution) {
             $parameters['period'] = $periodForMultiplePeriodGraph;
//.........这里部分代码省略.........
开发者ID:diosmosis,项目名称:piwik,代码行数:101,代码来源:ImageGraph.php

示例7: resetPasswordSuccess

 /**
  * The action used after a password is successfully reset. Displays the login
  * screen with an extra message. A separate action is used instead of returning
  * the HTML in confirmResetPassword so the resetToken won't be in the URL.
  */
 public function resetPasswordSuccess()
 {
     $urlToRedirect = Url::getCurrentUrlWithoutQueryString();
     $urlToRedirect .= '?' . Url::getQueryStringFromParameters(array('module' => 'GoogleAuthenticator', 'action' => 'passwordchanged'));
     Url::redirectToUrl($urlToRedirect);
 }
开发者ID:sgiehl,项目名称:piwik-plugin-GoogleAuthenticator,代码行数:11,代码来源:Controller.php

示例8: foreach

define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
FrontController::getInstance()->init();
$widgets = WidgetsList::get();
foreach ($widgets as $category => $widgetsInCategory) {
    echo '<h2>' . $category . '</h2>';
    foreach ($widgetsInCategory as $widget) {
        echo '<h3>' . $widget['name'] . '</h3>';
        $widgetUrl = UrlHelper::getArrayFromQueryString($url);
        $widgetUrl['moduleToWidgetize'] = $widget['parameters']['module'];
        $widgetUrl['actionToWidgetize'] = $widget['parameters']['action'];
        $parameters = $widget['parameters'];
        unset($parameters['module']);
        unset($parameters['action']);
        foreach ($parameters as $name => $value) {
            if (is_array($value)) {
                $value = current($value);
            }
            $widgetUrl[$name] = $value;
        }
        $widgetUrl = Url::getQueryStringFromParameters($widgetUrl);
        echo '<div id="widgetIframe"><iframe width="500" height="350"
			src="' . $widgetUrl . '" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>';
    }
}
?>
</body>
</html>
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:30,代码来源:iframeWidget_localhost.php

示例9: doRedirectToUrl

 /**
  * @param $moduleToRedirect
  * @param $actionToRedirect
  * @param $websiteId
  * @param $defaultPeriod
  * @param $defaultDate
  * @param $parameters
  * @throws Exception
  */
 private function doRedirectToUrl($moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters)
 {
     $menu = new Menu();
     $parameters = array_merge($menu->urlForDefaultUserParams($websiteId, $defaultPeriod, $defaultDate), $parameters);
     $queryParams = !empty($parameters) ? '&' . Url::getQueryStringFromParameters($parameters) : '';
     $url = "index.php?module=%s&action=%s";
     $url = sprintf($url, $moduleToRedirect, $actionToRedirect);
     $url = $url . $queryParams;
     Url::redirectToUrl($url);
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:19,代码来源:Controller.php

示例10: getProcessedReport

 public function getProcessedReport($idSite, $period, $date, $apiModule, $apiAction, $segment = false, $apiParameters = false, $idGoal = false, $language = false, $showTimer = true, $hideMetricsDoc = false, $idSubtable = false, $showRawMetrics = false, $formatMetrics = null)
 {
     $timer = new Timer();
     if (empty($apiParameters)) {
         $apiParameters = array();
     }
     if (!empty($idGoal) && empty($apiParameters['idGoal'])) {
         $apiParameters['idGoal'] = $idGoal;
     }
     // Is this report found in the Metadata available reports?
     $reportMetadata = $this->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language, $period, $date, $hideMetricsDoc, $showSubtableReports = true);
     if (empty($reportMetadata)) {
         throw new Exception("Requested report {$apiModule}.{$apiAction} for Website id={$idSite} not found in the list of available reports. \n");
     }
     $reportMetadata = reset($reportMetadata);
     // Generate Api call URL passing custom parameters
     $parameters = array_merge($apiParameters, array('method' => $apiModule . '.' . $apiAction, 'idSite' => $idSite, 'period' => $period, 'date' => $date, 'format' => 'original', 'serialize' => '0', 'language' => $language, 'idSubtable' => $idSubtable));
     if (!empty($segment)) {
         $parameters['segment'] = $segment;
     }
     if (!empty($reportMetadata['processedMetrics']) && !empty($reportMetadata['metrics']['nb_visits']) && @$reportMetadata['category'] != Piwik::translate('Goals_Ecommerce') && $apiModule !== 'MultiSites') {
         $deleteRowsWithNoVisits = empty($reportMetadata['constantRowsCount']) ? '1' : '0';
         $parameters['filter_add_columns_when_show_all_columns'] = $deleteRowsWithNoVisits;
     }
     $url = Url::getQueryStringFromParameters($parameters);
     $request = new Request($url);
     try {
         /** @var DataTable */
         $dataTable = $request->process();
     } catch (Exception $e) {
         throw new Exception("API returned an error: " . $e->getMessage() . " at " . basename($e->getFile()) . ":" . $e->getLine() . "\n");
     }
     list($newReport, $columns, $rowsMetadata, $totals) = $this->handleTableReport($idSite, $dataTable, $reportMetadata, $showRawMetrics, $formatMetrics);
     foreach ($columns as &$name) {
         $name = ucfirst($name);
     }
     $website = new Site($idSite);
     $period = Period\Factory::build($period, $date);
     $period = $period->getLocalizedLongString();
     $return = array('website' => $website->getName(), 'prettyDate' => $period, 'metadata' => $reportMetadata, 'columns' => $columns, 'reportData' => $newReport, 'reportMetadata' => $rowsMetadata, 'reportTotal' => $totals);
     if ($showTimer) {
         $return['timerMillis'] = $timer->getTimeMs(0);
     }
     return $return;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:45,代码来源:ProcessedReport.php

示例11: getReportMetadata

 /**
  * @param array $reports
  * @param array $info
  * @return mixed
  */
 public function getReportMetadata(&$reports, $info)
 {
     $idSites = $info['idSites'];
     // If only one website is selected, we add the Graph URL
     if (count($idSites) != 1) {
         return;
     }
     $idSite = reset($idSites);
     // in case API.getReportMetadata was not called with date/period we use sane defaults
     if (empty($info['period'])) {
         $info['period'] = 'day';
     }
     if (empty($info['date'])) {
         $info['date'] = 'today';
     }
     // need two sets of period & date, one for single period graphs, one for multiple periods graphs
     if (Period::isMultiplePeriod($info['date'], $info['period'])) {
         $periodForMultiplePeriodGraph = $info['period'];
         $dateForMultiplePeriodGraph = $info['date'];
         $periodForSinglePeriodGraph = 'range';
         $dateForSinglePeriodGraph = $info['date'];
     } else {
         $periodForSinglePeriodGraph = $info['period'];
         $dateForSinglePeriodGraph = $info['date'];
         $piwikSite = new Site($idSite);
         if ($periodForSinglePeriodGraph == 'range') {
             $periodForMultiplePeriodGraph = Config::getInstance()->General['graphs_default_period_to_plot_when_period_range'];
             $dateForMultiplePeriodGraph = $dateForSinglePeriodGraph;
         } else {
             $periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
             $dateForMultiplePeriodGraph = Range::getRelativeToEndDate($periodForSinglePeriodGraph, 'last' . self::GRAPH_EVOLUTION_LAST_PERIODS, $dateForSinglePeriodGraph, $piwikSite);
         }
     }
     $token_auth = Common::getRequestVar('token_auth', false);
     $urlPrefix = "index.php?";
     foreach ($reports as &$report) {
         $reportModule = $report['module'];
         $reportAction = $report['action'];
         $reportUniqueId = $reportModule . '_' . $reportAction;
         $parameters = array();
         $parameters['module'] = 'API';
         $parameters['method'] = 'ImageGraph.get';
         $parameters['idSite'] = $idSite;
         $parameters['apiModule'] = $reportModule;
         $parameters['apiAction'] = $reportAction;
         if (!empty($token_auth)) {
             $parameters['token_auth'] = $token_auth;
         }
         // Forward custom Report parameters to the graph URL
         if (!empty($report['parameters'])) {
             $parameters = array_merge($parameters, $report['parameters']);
         }
         if (empty($report['dimension'])) {
             $parameters['period'] = $periodForMultiplePeriodGraph;
             $parameters['date'] = $dateForMultiplePeriodGraph;
         } else {
             $parameters['period'] = $periodForSinglePeriodGraph;
             $parameters['date'] = $dateForSinglePeriodGraph;
         }
         // add the idSubtable if it exists
         $idSubtable = Common::getRequestVar('idSubtable', false);
         if ($idSubtable !== false) {
             $parameters['idSubtable'] = $idSubtable;
         }
         if (!empty($_GET['_restrictSitesToLogin']) && TaskScheduler::isTaskBeingExecuted()) {
             $parameters['_restrictSitesToLogin'] = $_GET['_restrictSitesToLogin'];
         }
         $report['imageGraphUrl'] = $urlPrefix . Url::getQueryStringFromParameters($parameters);
         // thanks to API.getRowEvolution, reports with dimensions can now be plotted using an evolution graph
         // however, most reports with a fixed set of dimension values are excluded
         // this is done so Piwik Mobile and Scheduled Reports do not display them
         $reportWithDimensionsSupportsEvolution = empty($report['constantRowsCount']) || in_array($reportUniqueId, self::$CONSTANT_ROW_COUNT_REPORT_EXCEPTIONS);
         $reportSupportsEvolution = !in_array($reportUniqueId, self::$REPORTS_DISABLED_EVOLUTION_GRAPH);
         if ($reportSupportsEvolution && $reportWithDimensionsSupportsEvolution) {
             $parameters['period'] = $periodForMultiplePeriodGraph;
             $parameters['date'] = $dateForMultiplePeriodGraph;
             $report['imageGraphEvolutionUrl'] = $urlPrefix . Url::getQueryStringFromParameters($parameters);
         }
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:85,代码来源:ImageGraph.php

示例12: getExampleUrl

 /**
  * Returns a string containing links to examples on how to call a given method on a given API
  * It will export links to XML, CSV, HTML, JSON, PHP, etc.
  * It will not export links for methods such as deleteSite or deleteUser
  *
  * @param string $class the class
  * @param string $methodName the method
  * @param array $parametersToSet parameters to set
  * @return string|bool when not possible
  */
 public function getExampleUrl($class, $methodName, $parametersToSet = array())
 {
     $knowExampleDefaultParametersValues = array('access' => 'view', 'userLogin' => 'test', 'passwordMd5ied' => 'passwordExample', 'email' => 'test@example.org', 'languageCode' => 'fr', 'url' => 'http://forum.piwik.org/', 'pageUrl' => 'http://forum.piwik.org/', 'apiModule' => 'UserCountry', 'apiAction' => 'getCountry', 'lastMinutes' => '30', 'abandonedCarts' => '0', 'segmentName' => 'pageTitle', 'ip' => '194.57.91.215', 'idSites' => '1,2', 'idAlert' => '1');
     foreach ($parametersToSet as $name => $value) {
         $knowExampleDefaultParametersValues[$name] = $value;
     }
     // no links for these method names
     $doNotPrintExampleForTheseMethods = array('deleteSite', 'addSite', 'updateSite', 'addSiteAliasUrls', 'deleteUser', 'addUser', 'updateUser', 'setUserAccess', 'addGoal', 'updateGoal', 'deleteGoal');
     if (in_array($methodName, $doNotPrintExampleForTheseMethods)) {
         return false;
     }
     // we try to give an URL example to call the API
     $aParameters = Proxy::getInstance()->getParametersList($class, $methodName);
     // Kindly force some known generic parameters to appear in the final list
     // the parameter 'format' can be set to all API methods (used in tests)
     // the parameter 'hideIdSubDatable' is used for integration tests only
     // the parameter 'serialize' sets php outputs human readable, used in integration tests and debug
     // the parameter 'language' sets the language for the response (eg. country names)
     // the parameter 'flat' reduces a hierarchical table to a single level by concatenating labels
     // the parameter 'include_aggregate_rows' can be set to include inner nodes in flat reports
     // the parameter 'translateColumnNames' can be set to translate metric names in csv/tsv exports
     $aParameters['format'] = false;
     $aParameters['hideIdSubDatable'] = false;
     $aParameters['serialize'] = false;
     $aParameters['language'] = false;
     $aParameters['translateColumnNames'] = false;
     $aParameters['label'] = false;
     $aParameters['flat'] = false;
     $aParameters['include_aggregate_rows'] = false;
     $aParameters['filter_limit'] = false;
     //@review without adding this, I can not set filter_limit in $otherRequestParameters integration tests
     $aParameters['filter_sort_column'] = false;
     //@review without adding this, I can not set filter_sort_column in $otherRequestParameters integration tests
     $aParameters['filter_truncate'] = false;
     $aParameters['hideColumns'] = false;
     $aParameters['showColumns'] = false;
     $aParameters['filter_pattern_recursive'] = false;
     $moduleName = Proxy::getInstance()->getModuleNameFromClassName($class);
     $aParameters = array_merge(array('module' => 'API', 'method' => $moduleName . '.' . $methodName), $aParameters);
     foreach ($aParameters as $nameVariable => &$defaultValue) {
         if (isset($knowExampleDefaultParametersValues[$nameVariable])) {
             $defaultValue = $knowExampleDefaultParametersValues[$nameVariable];
         } elseif ($defaultValue instanceof NoDefaultValue) {
             return false;
         }
     }
     return '?' . Url::getQueryStringFromParameters($aParameters);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:58,代码来源:DocumentationGenerator.php

示例13: redirectToPaypal

 /**
  * Redirects the user to a paypal so they can donate to Piwik.
  */
 public function redirectToPaypal()
 {
     $parameters = Request::getRequestArrayFromString($request = null);
     foreach ($parameters as $name => $param) {
         if ($name == 'idSite' || $name == 'module' || $name == 'action') {
             unset($parameters[$name]);
         }
     }
     $url = "https://www.paypal.com/cgi-bin/webscr?" . Url::getQueryStringFromParameters($parameters);
     Url::redirectToUrl($url);
     exit;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:15,代码来源:Controller.php

示例14: loadEvolutionReport

 protected function loadEvolutionReport($column = false)
 {
     list($apiModule, $apiAction) = explode('.', $this->apiMethod);
     // getQueryStringFromParameters expects sanitised query parameter values
     $parameters = array('method' => 'API.getRowEvolution', 'label' => $this->label, 'apiModule' => $apiModule, 'apiAction' => $apiAction, 'idSite' => $this->idSite, 'period' => $this->period, 'date' => $this->date, 'format' => 'original', 'serialize' => '0');
     if (!empty($this->segment)) {
         $parameters['segment'] = $this->segment;
     }
     if ($column !== false) {
         $parameters['column'] = $column;
     }
     $url = Url::getQueryStringFromParameters($parameters);
     $request = new Request($url);
     $report = $request->process();
     $this->extractEvolutionReport($report);
 }
开发者ID:drabberhorizon,项目名称:ActiveNative,代码行数:16,代码来源:RowEvolution.php

示例15: redirectToIndex

 /**
  * Helper method used to redirect the current HTTP request to another module/action.
  * 
  * This function will exit immediately after executing.
  *
  * @param string $moduleToRedirect The plugin to redirect to, eg. `"MultiSites"`.
  * @param string $actionToRedirect Action, eg. `"index"`.
  * @param int|null $websiteId The new idSite query parameter, eg, `1`.
  * @param string|null $defaultPeriod The new period query parameter, eg, `'day'`.
  * @param string|null $defaultDate The new date query parameter, eg, `'today'`.
  * @param array $parameters Other query parameters to append to the URL.
  * @api
  */
 public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array())
 {
     $userPreferences = new UserPreferences();
     if (empty($websiteId)) {
         $websiteId = $userPreferences->getDefaultWebsiteId();
     }
     if (empty($defaultDate)) {
         $defaultDate = $userPreferences->getDefaultDate();
     }
     if (empty($defaultPeriod)) {
         $defaultPeriod = $userPreferences->getDefaultPeriod();
     }
     $parametersString = '';
     if (!empty($parameters)) {
         $parametersString = '&' . Url::getQueryStringFromParameters($parameters);
     }
     if ($websiteId) {
         $url = "index.php?module=" . $moduleToRedirect . "&action=" . $actionToRedirect . "&idSite=" . $websiteId . "&period=" . $defaultPeriod . "&date=" . $defaultDate . $parametersString;
         Url::redirectToUrl($url);
         exit;
     }
     if (Piwik::hasUserSuperUserAccess()) {
         Piwik_ExitWithMessage("Error: no website was found in this Piwik installation.\n\t\t\t<br />Check the table '" . Common::prefixTable('site') . "' in your database, it should contain your Piwik websites.", false, true);
     }
     $currentLogin = Piwik::getCurrentUserLogin();
     if (!empty($currentLogin) && $currentLogin != 'anonymous') {
         $emails = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
         $errorMessage = sprintf(Piwik::translate('CoreHome_NoPrivilegesAskPiwikAdmin'), $currentLogin, "<br/><a href='mailto:" . $emails . "?subject=Access to Piwik for user {$currentLogin}'>", "</a>");
         $errorMessage .= "<br /><br />&nbsp;&nbsp;&nbsp;<b><a href='index.php?module=" . Registry::get('auth')->getName() . "&amp;action=logout'>&rsaquo; " . Piwik::translate('General_Logout') . "</a></b><br />";
         Piwik_ExitWithMessage($errorMessage, false, true);
     }
     echo FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false);
     exit;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:47,代码来源:Controller.php


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