Created
June 7, 2012 08:11
-
-
Save dshafik/2887343 to your computer and use it in GitHub Desktop.
xh-gui urlSimilartor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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