/** * Hueco's default debug displayer * @param string $msg * @return void */ function _hueco_debuger_message($msg = '') { $backtrace = null; foreach (debug_backtrace() as $debug_backtrace) { if (isset($debug_backtrace['class']) && !has_string("Hueco\\", $debug_backtrace['class'])) { $backtrace = $debug_backtrace; } } // try to avoid print html in terminal if (php_sapi_name() == "cli") { trigger_error("\n\t Hueco Message: {$msg}, Function: {$backtrace['function']}.\n"); } else { require __DIR__ . DS . 'TEMPLATES' . DS . 'debugger_message.html'; die; } }
function is_web_client() { if (has_string($_SERVER['HTTP_USER_AGENT'], "Mozilla")) { return true; } elseif (has_string($_SERVER['HTTP_USER_AGENT'], "Opera")) { return true; } if (has_string($_SERVER['HTTP_ACCEPT'], "Mozilla")) { return true; } elseif (has_string($_SERVER['HTTP_ACCEPT'], "Opera")) { return true; } return false; }