本文整理汇总了PHP中Piwik\Tracker\PageUrl::processUrlFragment方法的典型用法代码示例。如果您正苦于以下问题:PHP PageUrl::processUrlFragment方法的具体用法?PHP PageUrl::processUrlFragment怎么用?PHP PageUrl::processUrlFragment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Tracker\PageUrl
的用法示例。
在下文中一共展示了PageUrl::processUrlFragment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanupHostAndHashTag
/**
* Will cleanup the hostname (some browser do not strolower the hostname),
* and deal ith the hash tag on incoming URLs based on website setting.
*
* @param $parsedUrl
* @param $idSite int|bool The site ID of the current visit. This parameter is
* only used by the tracker to see if we should remove
* the URL fragment for this site.
* @return array
*/
protected static function cleanupHostAndHashTag($parsedUrl, $idSite = false)
{
if (empty($parsedUrl)) {
return $parsedUrl;
}
if (!empty($parsedUrl['host'])) {
$parsedUrl['host'] = Common::mb_strtolower($parsedUrl['host'], 'UTF-8');
}
if (!empty($parsedUrl['fragment'])) {
$parsedUrl['fragment'] = PageUrl::processUrlFragment($parsedUrl['fragment'], $idSite);
}
return $parsedUrl;
}
示例2: parseNameFromPageUrl
private static function parseNameFromPageUrl($name, $type, $urlPrefix)
{
$urlRegexAfterDomain = '([^/]+)[/]?([^#]*)[#]?(.*)';
if ($urlPrefix === null) {
// match url with protocol (used for outlinks / downloads)
$urlRegex = '@^http[s]?://' . $urlRegexAfterDomain . '$@i';
} else {
// the name is a url that does not contain protocol and www anymore
// we know that normalization has been done on db level because $urlPrefix is set
$urlRegex = '@^' . $urlRegexAfterDomain . '$@i';
}
$matches = array();
preg_match($urlRegex, $name, $matches);
if (!count($matches)) {
return $name;
}
$urlHost = $matches[1];
$urlPath = $matches[2];
$urlFragment = $matches[3];
if (in_array($type, array(Action::TYPE_DOWNLOAD, Action::TYPE_OUTLINK))) {
$path = '/' . trim($urlPath);
if (!empty($urlFragment)) {
$path .= '#' . $urlFragment;
}
return array(trim($urlHost), $path);
}
$name = $urlPath;
if ($name === '' || substr($name, -1) == '/') {
$name .= self::$defaultActionName;
}
$urlFragment = PageUrl::processUrlFragment($urlFragment);
if (!empty($urlFragment)) {
$name .= '#' . $urlFragment;
}
return $name;
}