Method | Description | |
---|---|---|
getArrayFromQueryString ( string $urlQuery ) : array | Returns a URL query string as an array. | |
getHostFromUrl ( $url ) | ||
getLossyUrl ( string $url ) : string | Reduce URL to more minimal form. 2 letter country codes are replaced by '{}', while other parts are simply removed. | |
getParameterFromQueryString ( string $urlQuery, string $parameter ) : string | null | Returns the value of a single query parameter from the supplied query string. | |
getParseUrlReverse ( array $parsed ) : false | string | Returns a URL created from the result of the parse_url function. | |
getPathAndQueryFromUrl ( string $url ) : string | Returns the path and query string of a URL. | |
getQueryFromUrl ( string $url, array $additionalParamsToAdd = [] ) : string | Returns the query part from any valid url and adds additional parameters to the query part if needed. | |
getQueryStringWithExcludedParameters ( $queryParameters, $parametersToExclude ) : string | Converts an array of query parameter name/value mappings into a query string. | |
isLookLikeUrl ( string $url ) : boolean | Returns true if the string passed may be a URL ie. it starts with protocol://. |
Method | Description | |
---|---|---|
in_array_matches_regex ( $test, $patterns ) : true | Checks if a string matches/is equal to one of the patterns/strings. |
public static getArrayFromQueryString ( string $urlQuery ) : array | ||
$urlQuery | string | The query string, eg, `'?param1=value1¶m2=value2'`. |
return | array | eg, `array('param1' => 'value1', 'param2' => 'value2')` |
public static getLossyUrl ( string $url ) : string | ||
$url | string | |
return | string |
public static getParseUrlReverse ( array $parsed ) : false | string | ||
$parsed | array | 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. |
public static getPathAndQueryFromUrl ( string $url ) : string | ||
$url | string | The URL. |
return | string | eg, `/test/index.php?module=CoreHome` if `$url` is `http://piwik.org/test/index.php?module=CoreHome`. |
public static getQueryStringWithExcludedParameters ( $queryParameters, $parametersToExclude ) : string | ||
$queryParameters | Array of query parameters, eg, `array('site' => '0', 'date' => '2012-01-01')`. | |
$parametersToExclude | Array of query parameter names that shouldn't be in the result query string, eg, `array('date', 'period')`. | |
return | string | A query string, eg, `"?site=0"`. |
protected static in_array_matches_regex ( $test, $patterns ) : true | ||
$test | String to test. | |
$patterns | Array of strings or regexs. | |
return | true | if $test matches or is equal to one of the regex/string in $patterns, false otherwise. |
public static isLookLikeUrl ( string $url ) : boolean | ||
$url | string | |
return | boolean |