static function hook() { $run_id = uniqid(); self::$run_id = self::requestId() > 1 ? self::requestId() . '.' . $run_id : $run_id; setcookie('XDEBUG_PROFILE_ID', self::$run_id); self::$log->append(array('_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST)); foreach (self::$enabled as $hook => $enabled) { if (!$enabled) { continue; } $hook_class = "PHPIO_Hook_{$hook}"; self::$hooks[$hook] = new $hook_class(); self::$hooks[$hook]->init(); } register_shutdown_function(array(self::$log, 'save')); }
<?php define("PHPIO_PROFILE", "_profile"); if (isset($_GET[PHPIO_PROFILE])) { //Give them a cookie to hold status, and redirect back to the same page setcookie(PHPIO_PROFILE, $_GET[PHPIO_PROFILE]); $newURI = str_replace(array(PHPIO_PROFILE . '=1', PHPIO_PROFILE . '=0'), '', $_SERVER['REQUEST_URI']); header("Location: {$newURI}"); exit; } if (isset($_REQUEST[PHPIO_PROFILE]) && $_REQUEST[PHPIO_PROFILE] || isset($_COOKIE[PHPIO_PROFILE]) && $_COOKIE[PHPIO_PROFILE] || isset($_SERVER[PHPIO_PROFILE]) && $_SERVER[PHPIO_PROFILE]) { require __DIR__ . '/boot.php'; PHPIO::hook(); }