/** * 追加JSON高度信息 * * @param array $result 原要数据的数据 * @param Exception $exception 异常对象 * * @return array */ protected function _appendDebugJson(array $result, Exception $exception) { if (!\Comm\Misc::isProEnv()) { $result['_debug']['code'] = $exception->getCode(); $result['_debug']['message'] = $exception->getMessage(); $result['_debug']['file'] = $exception->getFile(); $result['_debug']['line'] = $exception->getLine(); $result['_debug']['trace'] = $exception->getTraceAsString(); if (method_exists($exception, 'getMetadata')) { $result['_debug']['metadata'] = $exception->getMetadata(); } } return $result; }
* instance. Your object should have a method log(string $message). */ $min_errorLogger = !\Comm\Misc::isProEnv(); /** * To allow debug mode output, you must set this option to true. * * Once true, you can send the cookie minDebug to request debug mode output. The * cookie value should match the URIs you'd like to debug. E.g. to debug * /min/f=file1.js send the cookie minDebug=file1.js * You can manually enable debugging by appending "&debug" to a URI. * E.g. /min/?f=script1.js,script2.js&debug * * In 'debug' mode, Minify combines files with no minification and adds comments * to indicate line #s of the original files. */ $min_allowDebugFlag = !\Comm\Misc::isProEnv(); /** * For best performance, specify your temp directory here. Otherwise Minify * will have to load extra code to guess. Some examples below: */ //$min_cachePath = 'c:\\WINDOWS\\Temp'; //$min_cachePath = '/tmp'; //$min_cachePath = preg_replace('/^\\d+;/', '', session_save_path()); /** * To use APC/Memcache/ZendPlatform for cache storage, require the class and * set $min_cachePath to an instance. Example below: */ //$min_cachePath = new Minify_Cache_APC(); /** * Leave an empty string to use PHP's $_SERVER['DOCUMENT_ROOT']. *
/** * 加载JS * @param string $path * @param boolean $return * @param boolean $absolutely * @return \mixed */ public static function js($path, $with_version = true, $return = false, $absolutely = false) { $src = $absolutely ? $path : self::path('static/js/' . $path); if (!\Comm\Misc::isProEnv()) { $src .= (strpos($src, '?') === false ? '?' : '&') . "debug=1"; } if ($with_version) { $ver = self::jsVer(); $src .= "&version={$ver}"; } $result = "<script type=\"text/javascript\" src=\"{$src}\"></script>"; if ($return) { return $result; } else { echo $result; return null; } }