本文整理汇总了PHP中Piwik\Common::unsanitizeInputValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::unsanitizeInputValues方法的具体用法?PHP Common::unsanitizeInputValues怎么用?PHP Common::unsanitizeInputValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Common
的用法示例。
在下文中一共展示了Common::unsanitizeInputValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCustomVariables
public function getCustomVariables($scope)
{
if ($scope == 'visit') {
$parameter = '_cvar';
} else {
$parameter = 'cvar';
}
$customVar = Common::unsanitizeInputValues(Common::getRequestVar($parameter, '', 'json', $this->params));
if (!is_array($customVar)) {
return array();
}
$customVariables = array();
foreach ($customVar as $id => $keyValue) {
$id = (int) $id;
if ($id < 1 || $id > Tracker::MAX_CUSTOM_VARIABLES || count($keyValue) != 2 || !is_string($keyValue[0]) && !is_numeric($keyValue[0])) {
Common::printDebug("Invalid custom variables detected (id={$id})");
continue;
}
if (strlen($keyValue[1]) == 0) {
$keyValue[1] = "";
}
// We keep in the URL when Custom Variable have empty names
// and values, as it means they can be deleted server side
$key = self::truncateCustomVariable($keyValue[0]);
$value = self::truncateCustomVariable($keyValue[1]);
$customVariables['custom_var_k' . $id] = $key;
$customVariables['custom_var_v' . $id] = $value;
}
return $customVariables;
}
示例2: getJavascriptTag
/**
* Returns the javascript tag for the given idSite.
* This tag must be included on every page to be tracked by Piwik
*
* @param int $idSite
* @param string $piwikUrl
* @param bool $mergeSubdomains
* @param bool $groupPageTitlesByDomain
* @param bool $mergeAliasUrls
* @param bool $visitorCustomVariables
* @param bool $pageCustomVariables
* @param bool $customCampaignNameQueryParam
* @param bool $customCampaignKeywordParam
* @param bool $doNotTrack
* @param bool $disableCookies
* @return string The Javascript tag ready to be included on the HTML pages
*/
public function getJavascriptTag($idSite, $piwikUrl = '', $mergeSubdomains = false, $groupPageTitlesByDomain = false, $mergeAliasUrls = false, $visitorCustomVariables = false, $pageCustomVariables = false, $customCampaignNameQueryParam = false, $customCampaignKeywordParam = false, $doNotTrack = false, $disableCookies = false)
{
Piwik::checkUserHasViewAccess($idSite);
if (empty($piwikUrl)) {
$piwikUrl = SettingsPiwik::getPiwikUrl();
}
// Revert the automatic encoding
// TODO remove that when https://github.com/piwik/piwik/issues/4231 is fixed
$piwikUrl = Common::unsanitizeInputValue($piwikUrl);
$visitorCustomVariables = Common::unsanitizeInputValues($visitorCustomVariables);
$pageCustomVariables = Common::unsanitizeInputValues($pageCustomVariables);
$customCampaignNameQueryParam = Common::unsanitizeInputValue($customCampaignNameQueryParam);
$customCampaignKeywordParam = Common::unsanitizeInputValue($customCampaignKeywordParam);
$generator = new TrackerCodeGenerator();
$code = $generator->generate($idSite, $piwikUrl, $mergeSubdomains, $groupPageTitlesByDomain, $mergeAliasUrls, $visitorCustomVariables, $pageCustomVariables, $customCampaignNameQueryParam, $customCampaignKeywordParam, $doNotTrack, $disableCookies);
$code = str_replace(array('<br>', '<br />', '<br/>'), '', $code);
return $code;
}
示例3: unsanitizeLabelParameter
public static function unsanitizeLabelParameter($label)
{
// this is needed because Proxy uses Common::getRequestVar which in turn
// uses Common::sanitizeInputValue. This causes the > that separates recursive labels
// to become > and we need to undo that here.
$label = Common::unsanitizeInputValues($label);
return $label;
}
示例4: getEcommerceItemsFromRequest
/**
* Returns Items read from the request string
* @return array|bool
*/
private function getEcommerceItemsFromRequest()
{
$items = $this->request->getParam('ec_items');
if (empty($items)) {
Common::printDebug("There are no Ecommerce items in the request");
// we still record an Ecommerce order without any item in it
return array();
}
if (!is_array($items)) {
Common::printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true));
return false;
}
$items = Common::unsanitizeInputValues($items);
$cleanedItems = $this->getCleanedEcommerceItems($items);
return $cleanedItems;
}