本文整理匯總了PHP中Piwik\Tracker\PageUrl::shouldRemoveURLFragmentFor方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageUrl::shouldRemoveURLFragmentFor方法的具體用法?PHP PageUrl::shouldRemoveURLFragmentFor怎麽用?PHP PageUrl::shouldRemoveURLFragmentFor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\Tracker\PageUrl
的用法示例。
在下文中一共展示了PageUrl::shouldRemoveURLFragmentFor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processUrlFragment
/**
* Cleans and/or removes the URL fragment of a URL.
*
* @param $urlFragment string The URL fragment to process.
* @param $idSite int|bool If not false, this function will check if URL fragments
* should be removed for the site w/ this ID and if so,
* the returned processed fragment will be empty.
*
* @return string The processed URL fragment.
*/
public static function processUrlFragment($urlFragment, $idSite = false)
{
// if we should discard the url fragment for this site, return an empty string as
// the processed url fragment
if ($idSite !== false && PageUrl::shouldRemoveURLFragmentFor($idSite)) {
return '';
} else {
// Remove trailing Hash tag in ?query#hash#
if (substr($urlFragment, -1) == '#') {
$urlFragment = substr($urlFragment, 0, strlen($urlFragment) - 1);
}
return $urlFragment;
}
}