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


PHP Piwik_Common::getArrayFromQueryString方法代码示例

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


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

示例1: getArrayFromCurrentQueryString

 static function getArrayFromCurrentQueryString()
 {
     $queryString = Piwik_Url::getCurrentQueryString();
     $queryString = htmlspecialchars($queryString);
     $urlValues = Piwik_Common::getArrayFromQueryString($queryString);
     return $urlValues;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:7,代码来源:Url.php

示例2: smarty_function_hiddenurl

/**
 * Smarty {hiddenurl} function plugin.
 * Writes an input Hidden field for every parameter in the URL.
 * Useful when using GET forms because we need to print the current parameters 
 * in hidden input so they are to the next URL after the form is submitted.
 *
 * 
 * Examples:
 * <pre>
 * {hiddenurl module="API"} with a URL 'index.php?action=test&module=CoreHome' will output
 *  <input type=hidden name=action value=test>
 *  <input type=hidden name=module value=API>
 * </pre>
 * 
 * Set a value to null if you want this value not to be passed in the submitted form.
 * 
 * @param	array
 * @param	Smarty
 * @return	string
 */
function smarty_function_hiddenurl($params, &$smarty)
{
    $queryStringModified = Piwik_Url::getCurrentQueryStringWithParametersModified($params);
    $urlValues = Piwik_Common::getArrayFromQueryString($queryStringModified);
    $out = '';
    foreach ($urlValues as $name => $value) {
        $out .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
    }
    return $out;
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:30,代码来源:function.hiddenurl.php

示例3: smarty_modifier_urlRewriteAdminView

/**
 * Rewrites the given URL so that it looks like an Admin URL.
 * 
 * @return string
 */
function smarty_modifier_urlRewriteAdminView($parameters)
{
    // replace module=X by moduleToLoad=X
    // replace action=Y by actionToLoad=Y
    if (!is_array($parameters)) {
        // if parameters is not an array, parse URL parameteres
        $parameters = Piwik_Common::getArrayFromQueryString(htmlspecialchars($parameters));
    }
    $parameters['moduleToLoad'] = $parameters['module'];
    unset($parameters['module']);
    if (isset($parameters['action'])) {
        $parameters['actionToLoad'] = $parameters['action'];
        unset($parameters['action']);
    } else {
        $parameters['actionToLoad'] = null;
    }
    $url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters);
    // add module=Home&action=showInContext
    $url = $url . '&module=AdminHome&action=showInContext';
    return $url;
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:26,代码来源:modifier.urlRewriteAdminView.php

示例4: getArrayFromCurrentQueryString

 /**
  * If current URL is "http://example.org/dir1/dir2/index.php?param1=value1&param2=value2"
  * will return 
  *  array
  *    'param1' => string 'value1'
  *    'param2' => string 'value2'
  * 
  * @return array
  */
 static function getArrayFromCurrentQueryString()
 {
     $queryString = self::getCurrentQueryString();
     $urlValues = Piwik_Common::getArrayFromQueryString($queryString);
     return $urlValues;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:15,代码来源:Url.php

示例5: test_getArrayFromQueryString

 function test_getArrayFromQueryString()
 {
     $expected = array('a' => false, 'b' => '', 'c' => '1', 'd' => array(false), 'e' => array(''), 'f' => array('a'), 'g' => array('b', 'c'));
     $string = 'a&b=&c=1&d[]&e[]=&f[]=a&g[]=b&g[]=c';
     $this->assertEqual(serialize(Piwik_Common::getArrayFromQueryString($string)), serialize($expected));
     $string = "?" . $string;
     $this->assertEqual(serialize(Piwik_Common::getArrayFromQueryString($string)), serialize($expected));
     $string = "";
     $this->assertEqual(serialize(Piwik_Common::getArrayFromQueryString($string)), serialize(array()));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:10,代码来源:Common.test.php

示例6: excludeQueryParametersFromUrl

	static public function excludeQueryParametersFromUrl($originalUrl, $idSite)
	{
		$website = Piwik_Common::getCacheWebsiteAttributes( $idSite );
		$originalUrl = Piwik_Common::unsanitizeInputValue($originalUrl);
		$originalUrl = self::cleanupString($originalUrl);
		$parsedUrl = @parse_url($originalUrl);
		if(empty($parsedUrl['query']))
		{
			return $originalUrl;
		}
		$campaignTrackingParameters = Piwik_Common::getCampaignParameters();
		
		$campaignTrackingParameters = array_merge(
				$campaignTrackingParameters[0], // campaign name parameters
				$campaignTrackingParameters[1] // campaign keyword parameters
		);	
				
		$excludedParameters = isset($website['excluded_parameters']) 
									? $website['excluded_parameters'] 
									: array();
									
		$parametersToExclude = array_merge( $excludedParameters, 
											self::$queryParametersToExclude,
											$campaignTrackingParameters);
											
		$parametersToExclude = array_map('strtolower', $parametersToExclude);
		$queryParameters = Piwik_Common::getArrayFromQueryString($parsedUrl['query']);
		
		$validQuery = '';
		$separator = '&';
		foreach($queryParameters as $name => $value)
		{
			if(!in_array(strtolower($name), $parametersToExclude))
			{
				if (is_array($value))
				{
					foreach ($value as $param)
					{
						if($param === false)
						{
							$validQuery .= $name.'[]'.$separator;
						}
						else
						{
							$validQuery .= $name.'[]='.$param.$separator;
						}
					}
				}
				else if($value === false)
				{
					$validQuery .= $name.$separator;
				}
				else
				{
					$validQuery .= $name.'='.$value.$separator;
				}
			}
		}
		$parsedUrl['query'] = substr($validQuery,0,-strlen($separator));
		$url = Piwik_Common::getParseUrlReverse($parsedUrl);
		printDebug('Excluding parameters "'.implode(',',$excludedParameters).'" from URL');
		if($originalUrl != $url)
		{
			printDebug(' Before was "'.$originalUrl.'"');
			printDebug(' After is "'.$url.'"');
		}
		return $url;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:68,代码来源:Action.php

示例7: define

define('PIWIK_INCLUDE_PATH', '..');
define('PIWIK_ENABLE_DISPATCH', false);
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";

Piwik_FrontController::getInstance()->init();
$widgets = Piwik_GetWidgetsList();
foreach($widgets as $category => $widgetsInCategory)
{
	echo '<h2>'.$category . '</h2>';
	foreach($widgetsInCategory as $widget)
	{
		echo '<h3>'.$widget['name'].'</h3>';
		$widgetUrl = Piwik_Common::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 = Piwik_Url::getQueryStringFromParameters($widgetUrl);
		
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:30,代码来源:iframeWidget_localhost.php

示例8: _testApiUrl

 protected function _testApiUrl($testName, $apiId, $requestUrl)
 {
     $isLiveMustDeleteDates = strpos($requestUrl, 'Live.getLastVisits') !== false;
     $request = new Piwik_API_Request($requestUrl);
     $dateTime = Piwik_Common::getRequestVar('date', '', 'string', Piwik_Common::getArrayFromQueryString($requestUrl));
     list($processedFilePath, $expectedFilePath) = $this->getProcessedAndExpectedPaths($testName, $apiId);
     // Cast as string is important. For example when calling
     // with format=original, objects or php arrays can be returned.
     // we also hide errors to prevent the 'headers already sent' in the ResponseBuilder (which sends Excel headers multiple times eg.)
     $response = (string) $request->process();
     if ($isLiveMustDeleteDates) {
         $response = $this->removeAllLiveDatesFromXml($response);
     }
     // normalize date markups and document ID in pdf files :
     // - /LastModified (D:20120820204023+00'00')
     // - /CreationDate (D:20120820202226+00'00')
     // - /ModDate (D:20120820202226+00'00')
     // - /M (D:20120820202226+00'00')
     // - /ID [ <0f5cc387dc28c0e13e682197f485fe65> <0f5cc387dc28c0e13e682197f485fe65> ]
     $response = preg_replace('/\\(D:[0-9]{14}/', '(D:19700101000000', $response);
     $response = preg_replace('/\\/ID \\[ <.*> ]/', '', $response);
     file_put_contents($processedFilePath, $response);
     $expected = $this->loadExpectedFile($expectedFilePath);
     if (empty($expected)) {
         return;
     }
     // @todo This should not vary between systems AFAIK... "idsubdatatable can differ"
     $expected = $this->removeXmlElement($expected, 'idsubdatatable', $testNotSmallAfter = false);
     $response = $this->removeXmlElement($response, 'idsubdatatable', $testNotSmallAfter = false);
     if ($isLiveMustDeleteDates) {
         $expected = $this->removeAllLiveDatesFromXml($expected);
     } elseif (strpos($dateTime, 'last') !== false || strpos($dateTime, 'today') !== false || strpos($dateTime, 'now') !== false) {
         if (strpos($requestUrl, 'API.getProcessedReport') !== false) {
             $expected = $this->removePrettyDateFromXml($expected);
             $response = $this->removePrettyDateFromXml($response);
         }
         // avoid build failure when running just before midnight, generating visits in the future
         $expected = $this->removeXmlElement($expected, 'sum_daily_nb_uniq_visitors');
         $response = $this->removeXmlElement($response, 'sum_daily_nb_uniq_visitors');
         $expected = $this->removeXmlElement($expected, 'nb_visits_converted');
         $response = $this->removeXmlElement($response, 'nb_visits_converted');
         if (strpos($requestUrl, 'date=') !== false) {
             $regex = "/date=[-0-9,%Ca-z]+/";
             // need to remove %2C which is encoded ,
             $expected = preg_replace($regex, 'date=', $expected);
             $response = preg_replace($regex, 'date=', $response);
         }
     }
     // if idSubtable is in request URL, make sure idSubtable values are not in any urls
     if (strpos($requestUrl, 'idSubtable=') !== false) {
         $regex = "/idSubtable=[0-9]+/";
         $expected = preg_replace($regex, 'idSubtable=', $expected);
         $response = preg_replace($regex, 'idSubtable=', $response);
     }
     // is there a better way to test for the current DB type in use?
     if (Zend_Registry::get('db') instanceof Piwik_Db_Adapter_Mysqli) {
         // Do not test for TRUNCATE(SUM()) returning .00 on mysqli since this is not working
         // http://bugs.php.net/bug.php?id=54508
         $expected = str_replace('.00</revenue>', '</revenue>', $expected);
         $response = str_replace('.00</revenue>', '</revenue>', $response);
         $expected = str_replace('.1</revenue>', '</revenue>', $expected);
         $expected = str_replace('.11</revenue>', '</revenue>', $expected);
         $response = str_replace('.11</revenue>', '</revenue>', $response);
         $response = str_replace('.1</revenue>', '</revenue>', $response);
     }
     try {
         if (strpos($requestUrl, 'format=xml') !== false) {
             $this->assertXmlStringEqualsXmlString($expected, $response, "Differences with expected in: {$processedFilePath}");
         } else {
             $this->assertEquals(strlen($expected), strlen($response), "Differences with expected in: {$processedFilePath}");
             $this->assertEquals($expected, $response, "Differences with expected in: {$processedFilePath}");
         }
         if (trim($response) == trim($expected)) {
             file_put_contents($processedFilePath, $response);
         }
     } catch (Exception $ex) {
         $this->comparisonFailures[] = $ex;
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:79,代码来源:IntegrationTestCase.php

示例9: testGetArrayFromQueryString

 /**
  * @group Core
  * @group Common
  * @group getArrayFromQueryString
  */
 public function testGetArrayFromQueryString()
 {
     $expected = array('a' => false, 'b' => '', 'c' => '1', 'd' => array(false), 'e' => array(''), 'f' => array('a'), 'g' => array('b', 'c'));
     $this->assertEquals(serialize($expected), serialize(Piwik_Common::getArrayFromQueryString('a&b=&c=1&d[]&e[]=&f[]=a&g[]=b&g[]=c')));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:10,代码来源:CommonTest.php

示例10: detectSiteSearchFromUrl

 protected function detectSiteSearchFromUrl($website, $parsedUrl)
 {
     $doRemoveSearchParametersFromUrl = false;
     $separator = '&';
     $count = $actionName = $categoryName = false;
     $keywordParameters = isset($website['sitesearch_keyword_parameters']) ? $website['sitesearch_keyword_parameters'] : array();
     $queryString = (!empty($parsedUrl['query']) ? $parsedUrl['query'] : '') . (!empty($parsedUrl['fragment']) ? $separator . $parsedUrl['fragment'] : '');
     $parameters = Piwik_Common::getArrayFromQueryString($queryString);
     self::reencodeParameters($parameters, $this->pageEncoding);
     // Detect Site Search
     foreach ($keywordParameters as $keywordParameter) {
         if (!empty($parameters[$keywordParameter])) {
             $actionName = $parameters[$keywordParameter];
             break;
         }
     }
     if (empty($actionName)) {
         return false;
     }
     $categoryParameters = isset($website['sitesearch_category_parameters']) ? $website['sitesearch_category_parameters'] : array();
     foreach ($categoryParameters as $categoryParameter) {
         if (!empty($parameters[$categoryParameter])) {
             $categoryName = $parameters[$categoryParameter];
             break;
         }
     }
     if (isset($parameters[self::PARAMETER_NAME_SEARCH_COUNT]) && $this->isValidSearchCount($parameters[self::PARAMETER_NAME_SEARCH_COUNT])) {
         $count = $parameters[self::PARAMETER_NAME_SEARCH_COUNT];
     }
     // Remove search kwd from URL
     if ($doRemoveSearchParametersFromUrl) {
         // @see excludeQueryParametersFromUrl()
         // Excluded the detected parameters from the URL
         $parametersToExclude = array($categoryParameter, $keywordParameter);
         $parsedUrl['query'] = self::getQueryStringWithExcludedParameters(Piwik_Common::getArrayFromQueryString($parsedUrl['query']), $parametersToExclude);
         $parsedUrl['fragment'] = self::getQueryStringWithExcludedParameters(Piwik_Common::getArrayFromQueryString($parsedUrl['fragment']), $parametersToExclude);
     }
     $url = Piwik_Common::getParseUrlReverse($parsedUrl);
     if (is_array($actionName)) {
         $actionName = reset($actionName);
     }
     $actionName = trim(urldecode($actionName));
     if (empty($actionName)) {
         return false;
     }
     if (is_array($categoryName)) {
         $categoryName = reset($categoryName);
     }
     $categoryName = trim(urldecode($categoryName));
     return array($url, $actionName, $categoryName, $count);
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:51,代码来源:Action.php


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