本文整理匯總了PHP中Piwik\Tracker\PageUrl::reencodeParametersArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageUrl::reencodeParametersArray方法的具體用法?PHP PageUrl::reencodeParametersArray怎麽用?PHP PageUrl::reencodeParametersArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\Tracker\PageUrl
的用法示例。
在下文中一共展示了PageUrl::reencodeParametersArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reencodeParameters
/**
* Checks if query parameters are of a non-UTF-8 encoding and converts the values
* from the specified encoding to UTF-8.
* This method is used to workaround browser/webapp bugs (see #3450). When
* browsers fail to encode query parameters in UTF-8, the tracker will send the
* charset of the page viewed and we can sometimes work around invalid data
* being stored.
*
* @param array $queryParameters Name/value mapping of query parameters.
* @param bool|string $encoding of the HTML page the URL is for. Used to workaround
* browser bugs & mis-coded webapps. See #3450.
*
* @return array
*/
public static function reencodeParameters(&$queryParameters, $encoding = false)
{
if (function_exists('mb_check_encoding')) {
// if query params are encoded w/ non-utf8 characters (due to browser bug or whatever),
// encode to UTF-8.
if (strtolower($encoding) != 'utf-8' && $encoding != false) {
Common::printDebug("Encoding page URL query parameters to {$encoding}.");
$queryParameters = PageUrl::reencodeParametersArray($queryParameters, $encoding);
}
} else {
Common::printDebug("Page charset supplied in tracking request, but mbstring extension is not available.");
}
return $queryParameters;
}
示例2: reencodeParameters
/**
* Checks if query parameters are of a non-UTF-8 encoding and converts the values
* from the specified encoding to UTF-8.
* This method is used to workaround browser/webapp bugs (see #3450). When
* browsers fail to encode query parameters in UTF-8, the tracker will send the
* charset of the page viewed and we can sometimes work around invalid data
* being stored.
*
* @param array $queryParameters Name/value mapping of query parameters.
* @param bool|string $encoding of the HTML page the URL is for. Used to workaround
* browser bugs & mis-coded webapps. See #3450.
*
* @return array
*/
public static function reencodeParameters(&$queryParameters, $encoding = false)
{
// if query params are encoded w/ non-utf8 characters (due to browser bug or whatever),
// encode to UTF-8.
if (false !== $encoding && 'utf-8' != strtolower($encoding) && function_exists('mb_check_encoding')) {
$queryParameters = PageUrl::reencodeParametersArray($queryParameters, $encoding);
}
return $queryParameters;
}