Skip to content
Extraits de code Groupes Projets
Valider d25f87b1 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Refs #4200, documented core/UrlHelper.php and core/Version.php.

parent 21923598
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -11,21 +11,23 @@ ...@@ -11,21 +11,23 @@
namespace Piwik; namespace Piwik;
/** /**
* Class UrlHelper * Contains less commonly needed URL helper methods.
*
* @package Piwik * @package Piwik
*
* @api
*/ */
class UrlHelper class UrlHelper
{ {
/** /**
* Returns a Query string, * Converts an array of query parameter name/value mappings into a query string.
* Given an array of input parameters, and an array of parameter names to exclude * Parameters that are in `$parametersToExclude` will not appear in the result
* query string.
* *
* @static * @static
* @param $queryParameters * @param $queryParameters Array of query parameters, eg, `array('site' => '0', 'date' => '2012-01-01')`.
* @param $parametersToExclude * @param $parametersToExclude Array of query parameter names that shouldn't be
* @return string * in the result query string, eg, `array('date', 'period')`.
* @return string A query string, eg, `"?site=0"`.
* @api
*/ */
public static function getQueryStringWithExcludedParameters($queryParameters, $parametersToExclude) public static function getQueryStringWithExcludedParameters($queryParameters, $parametersToExclude)
{ {
...@@ -108,10 +110,14 @@ class UrlHelper ...@@ -108,10 +110,14 @@ class UrlHelper
} }
/** /**
* Builds a URL from the result of parse_url function * Returns a URL created from the result of the [parse_url](http://php.net/manual/en/function.parse-url.php)
* function.
*
* Copied from the PHP comments at http://php.net/parse_url * Copied from the PHP comments at http://php.net/parse_url
* @param array $parsed *
* @return bool|string * @param array $parsed Result of [parse_url](http://php.net/manual/en/function.parse-url.php).
* @return false|string The URL or `false` if `$parsed` isn't an array.
* @api
*/ */
public static function getParseUrlReverse($parsed) public static function getParseUrlReverse($parsed)
{ {
...@@ -136,10 +142,11 @@ class UrlHelper ...@@ -136,10 +142,11 @@ class UrlHelper
} }
/** /**
* Returns an URL query string in an array format * Returns a URL query string as an array.
* *
* @param string $urlQuery * @param string $urlQuery The query string.
* @return array array( param1=> value1, param2=>value2) * @return array eg, `array('param1' => 'value1', 'param2' => 'value2')`
* @api
*/ */
public static function getArrayFromQueryString($urlQuery) public static function getArrayFromQueryString($urlQuery)
{ {
...@@ -195,11 +202,12 @@ class UrlHelper ...@@ -195,11 +202,12 @@ class UrlHelper
} }
/** /**
* Returns the value of a GET parameter $parameter in an URL query $urlQuery * Returns the value of a single query parameter from the supplied query string.
* *
* @param string $urlQuery result of parse_url()['query'] and htmlentitied (& is &) eg. module=test&action=toto or ?page=test * @param string $urlQuery The query string.
* @param string $parameter * @param string $parameter The query parameter name to return.
* @return string|bool Parameter value if found (can be the empty string!), null if not found * @return string|null Parameter value if found (can be the empty string!), null if not found.
* @api
*/ */
public static function getParameterFromQueryString($urlQuery, $parameter) public static function getParameterFromQueryString($urlQuery, $parameter)
{ {
...@@ -211,11 +219,11 @@ class UrlHelper ...@@ -211,11 +219,11 @@ class UrlHelper
} }
/** /**
* Returns the path and query part from a URL. * Returns the path and query string of a URL.
* Eg. http://piwik.org/test/index.php?module=CoreHome will return /test/index.php?module=CoreHome
* *
* @param string $url either http://piwik.org/test or / * @param string $url
* @return string * @return string eg, `/test/index.php?module=CoreHome` if `$url` is `http://piwik.org/test/index.php?module=CoreHome`.
* @api
*/ */
public static function getPathAndQueryFromUrl($url) public static function getPathAndQueryFromUrl($url)
{ {
......
...@@ -21,7 +21,7 @@ namespace Piwik; ...@@ -21,7 +21,7 @@ namespace Piwik;
final class Version final class Version
{ {
/** /**
* Current Piwik version * The current Piwik version.
* @var string * @var string
*/ */
const VERSION = '2.0-b1'; const VERSION = '2.0-b1';
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter