Skip to content

Instantly share code, notes, and snippets.

@dshafik
Created June 7, 2012 08:11
Show Gist options
  • Save dshafik/2887343 to your computer and use it in GitHub Desktop.
Save dshafik/2887343 to your computer and use it in GitHub Desktop.
xh-gui urlSimilartor
<?php
function _urlSimilartor($url)
{
//This is an example
$url = preg_replace("/[0-9]+/", "XXX", $url);
$qs = parse_url($url, PHP_URL_QUERY);
if ($qs) {
$parts = array();
parse_str($qs, $parts);
$normalized = array_combine(array_keys($parts), array_pad(array(), sizeof($parts), "XXX"));
$replace = http_build_query($normalized);
$url = str_replace($qs, $replace, $url);
}
// For domain-specific configuration, you can use Apache setEnv xhprof_urlSimilartor_include [some_php_file]
if($similartorinclude = getenv('xhprof_urlSimilartor_include')) {
require_once($similartorinclude);
}
$url = preg_replace("![?&]_profile=\d!", "", $url);
return $url;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment