/** * 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; } }