/** * Handle shutdown * When development, record the time spent on script execution (since 0.7.2) * * @since ADD MVC 0.5.1 */ static function handle_shutdown() { if (static::$handle_shutdown && !add::is_live() && add::is_developer()) { global $add_mvc_root_timer; $smarty = new add_smarty(); $smarty->display('debug/handle_shutdown.tpl'); if (isset($add_mvc_root_timer) && $add_mvc_root_timer instanceof add_debug_timer) { add_debug::print_config('environment_status'); add_debug::print_config('add_dir'); add_debug::print_config('path'); add_debug::print_config('developer_ips', true); add_debug::print_data('current_user_ip', current_user_ip()); add_debug::print_data('POST variable', $_POST); add_debug::print_data('GET variable', $_GET); add_debug::print_data('COOKIE variable', $_COOKIE); add_debug::print_data('REQUEST variable', $_COOKIE); add_debug::print_data('SESSION variable', $_SESSION); $add_mvc_root_timer->lap("Shutdown"); $add_mvc_root_timer->print_all_laps(); } return static::print_errors(); } }
/** * return_var_dump() * get var dump function * @param mixed $args * @since ADD MVC 0.0 */ public static final function return_var_dump($args) { ob_start(); self::$dumping = true; call_user_func_array('var_dump', func_get_args()); /** * Debugging for https://code.google.com/p/add-mvc-framework/issues/detail?id=93 * throw new Exception("test"); die(); */ $var = ob_get_clean(); self::$dumping = false; return $var; }
/** * Handle shutdown * When development, record the time spent on script execution (since 0.7.2) * * @since ADD MVC 0.5.1 */ static function handle_shutdown() { try { while (ob_get_level()) { # Do not echo this, it is a big security risk ob_get_clean(); } if (static::$handle_shutdown && !add::is_live() && add::is_developer()) { global $add_mvc_root_timer; $smarty = new add_smarty(); $smarty->display('debug/handle_shutdown.tpl'); if (isset($add_mvc_root_timer) && $add_mvc_root_timer instanceof add_debug_timer) { add_debug::print_config('environment_status'); add_debug::print_config('add_dir'); add_debug::print_config('path'); add_debug::print_config('developer_ips', true); add_debug::print_data('current_user_ip', current_user_ip()); add_debug::print_data('POST variable', $_POST); add_debug::print_data('GET variable', $_GET); add_debug::print_data('COOKIE variable', $_COOKIE); add_debug::print_data('REQUEST variable', $_COOKIE); if (isset($_SESSION)) { add_debug::print_data('SESSION variable', $_SESSION); } $add_mvc_root_timer->lap("Shutdown"); $add_mvc_root_timer->print_all_laps(); } return static::print_errors(); } } catch (Exception $e) { add::$handle_shutdown = false; add::handle_exception($e); } }
/** * Handle shutdown * When development, record the time spent on script execution (since 0.7.2) * * @since ADD MVC 0.5.1 */ static function handle_shutdown() { if (static::$handle_shutdown) { global $add_mvc_root_timer; $smarty = new add_smarty(); $smarty->display('debug/handle_shutdown.tpl'); if (isset($add_mvc_root_timer) && $add_mvc_root_timer instanceof add_debug_timer) { if (!add::is_live()) { add_debug::print_config('environment_status'); add_debug::print_config('add_dir'); add_debug::print_config('path'); add_debug::print_config('developer_ips', true); } $add_mvc_root_timer->lap("Shutdown"); $add_mvc_root_timer->print_all_laps(); } return static::print_errors(); } }
/** * Flush unflushed buffers, if the debug class isn't done var dumping, then void * */ public static function ob_flush() { if (!add_debug::dumping()) { while (ob_get_level()) { echo ob_get_clean(); } } else { $void_dump = ob_get_clean(); } }
/** * print_data extended * * @param float $us_time the microsecond time * @param * * @since ADD MVC 0.7.4 */ public static function print_data($label, $lap_difference) { parent::print_data($label, static::us_diff_html(static::us_diff_readable_format($lap_difference), $lap_difference)); }
/** * print_data extended * * @param float $label the microsecond time * @param float $lap_difference * * @since ADD MVC 0.7.4 */ public static function print_data($label, $lap_difference, $escape = false) { $diff = static::us_diff_readable_format($lap_difference); if (add::content_type() == 'text/html') { $diff = static::us_diff_html($diff, $lap_difference); } else { if ($lap_difference > 1) { $diff = "*{$diff}*"; if ($lap_difference > 10) { $diff = "*{$diff}*"; } } } parent::print_data($label, $diff, $escape); }