Skip to content

Commit

Permalink
Merge pull request #87 from northdakota/ajax-fix
Browse files Browse the repository at this point in the history
fix ajax
  • Loading branch information
preinheimer committed May 12, 2015
2 parents c513a75 + 916fb51 commit 42e5f38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion external/footer.php
Expand Up @@ -3,12 +3,16 @@
define('XHPROF_LIB_ROOT', dirname(dirname(__FILE__)) . '/xhprof_lib');
}

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$isAjax = true;
}

if (extension_loaded('xhprof') && $_xhprof['doprofile'] === true) {
$profiler_namespace = $_xhprof['namespace']; // namespace for your application
$xhprof_data = xhprof_disable();
$xhprof_runs = new XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace, null, $_xhprof);
if ($_xhprof['display'] === true && PHP_SAPI != 'cli')
if ($_xhprof['display'] === true && PHP_SAPI != 'cli' && !isset($isAjax))
{
// url to the XHProf UI libraries (change the host name and path)
$profiler_url = sprintf($_xhprof['url'].'/index.php?run=%s&source=%s', $run_id, $profiler_namespace);
Expand Down

0 comments on commit 42e5f38

Please sign in to comment.