当前位置: 首页>>代码示例>>PHP>>正文


PHP PhpFox::getCodeName方法代码示例

本文整理汇总了PHP中PhpFox::getCodeName方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpFox::getCodeName方法的具体用法?PHP PhpFox::getCodeName怎么用?PHP PhpFox::getCodeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpFox的用法示例。


在下文中一共展示了PhpFox::getCodeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDetails

    /**
     * Debug output found at the bottom of the site when debug mode is enabled.
     *
     * @static 
     * @return mixed Only returns something if the installer is being used and in that case it returns FALSE
     */
    public static function getDetails()
    {
        if (defined('PHPFOX_INSTALLER')) {
            return false;
        }
        // SQL
        $iSqlCount = 0;
        $fSum = 0.0;
        $fLimit = 0.05 * 128;
        $iSqlMemory = 0;
        $aKeywords = array('SELECT', 'SELECT ', 'FROM', 'FROM ', 'WHERE ', 'UPDATE ', 'OFFSET', ' AS ', 'UNION ALL', 'INNER JOIN ', 'LEFT JOIN ', 'INSERT INTO ', 'SHOW COLUMNS ', 'ON', 'SET', 'USING', 'USE INDEX', 'JOIN ', 'ORDER BY', 'DESC', 'LIMIT', 'DELETE');
        $oRequest = Phpfox_Request::instance();
        $oFile = Phpfox_File::instance();
        $aReplaces = array_map(array('self', '_addKeywordSyntax'), $aKeywords);
        $sDriver = Phpfox::getParam(array('db', 'driver'));
        $sSql = '';
        $bIsCmd = PHP_SAPI == 'cli' || defined('PHPFOX_IS_AJAX') && PHPFOX_IS_AJAX;
        if (!isset(self::$_aDebugHistory['sql'])) {
            self::$_aDebugHistory['sql'] = array();
        }
        // Fresh install, no need to display sql debug
        if ($sDriver == 'DATABASE_DRIVER') {
            self::$_aDebugHistory['sql'] = array();
        }
        foreach (self::$_aDebugHistory['sql'] as $aLine) {
            if (!isset($aLine['sql'])) {
                continue;
            }
            $iSqlCount++;
            $sExtra = Phpfox_Database::instance()->sqlReport($aLine['sql']);
            if ($bIsCmd) {
                $sSql .= "\n ----------------- \n Rows: " . $aLine['rows'] . " Slave: " . ($aLine['slave'] ? 'Yes' : 'No') . " \n " . $aLine['sql'] . " \n\n";
            } else {
                if ($aLine['time'] == '0.0000000') {
                    $aLine['time'] = '0.0000001';
                }
                $sColor = sprintf('%02X', min(255, $fLimit / $aLine['time']));
                $aLine['sql'] = str_replace($aKeywords, $aReplaces, htmlspecialchars($aLine['sql']));
                $sSql .= '<div class="nDebugInfo">
				<span style="background-color: #FF' . $sColor . $sColor . '; color:#000; padding:2px;">' . $aLine['time'] . '</span>
				| <b>Memory Before:</b> ' . $oFile->filesize($aLine['memory_before']) . '
				| <b>Memory After:</b> ' . $oFile->filesize($aLine['memory_after']) . '
				| <b>Memory Used:</b> ' . $oFile->filesize($aLine['memory_after'] - $aLine['memory_before']) . '
				| <b>Rows:</b> ' . $aLine['rows'] . '
				| <b>Slave:</b> ' . ($aLine['slave'] ? 'Yes' : 'No') . '
				</div>';
                $sSql .= '<div class="nDebugItems">' . self::_parseSQL($aLine['sql']) . '' . $sExtra . '</div>';
            }
            $fSum += $aLine['time'];
            $iSqlMemory += $aLine['memory_after'] - $aLine['memory_before'];
        }
        // General Stats
        $iTotalTime = sprintf('%0.7f', array_sum(explode(' ', microtime())) - PHPFOX_TIME_START);
        $iTotalSqlTime = sprintf('%0.7f', $fSum);
        $sDebugReturn = '<div id="js_main_debug_holder">';
        if (!defined('PHPFOX_MEM_END')) {
            define('PHPFOX_MEM_END', memory_get_usage());
        }
        if (PHPFOX_DEBUG_LEVEL === 1) {
            $sDebugReturn .= '<div style="font-size:9pt; text-align:center; padding-bottom:50px;">Page generated in ' . round($iTotalTime, 4) . ' seconds with ' . $iSqlCount . ' queries and GZIP ' . (Phpfox::getParam('core.use_gzip') ? 'enabled' : 'disabled') . ' on ' . $_SERVER['SERVER_ADDR'] . '.</div>';
        } elseif (PHPFOX_DEBUG_LEVEL === 2 || PHPFOX_DEBUG_LEVEL === 3) {
            $bSlaveEnabled = Phpfox::getParam(array('db', 'slave'));
            $aStats = array('Version' => PhpFox::getVersion(), 'Product Code Name' => PhpFox::getCodeName(), '1' => '', 'Total Time' => $iTotalTime, 'PHP General Time' => $iTotalTime - $iTotalSqlTime, 'GZIP' => Phpfox::getParam('core.use_gzip') ? 'enabled' : 'disabled', '2' => '', 'Driver Version' => $sDriver == 'DATABASE_DRIVER' ? 'N/A' : Phpfox_Database::instance()->getServerInfo(), 'SQL Time' => $iTotalSqlTime, 'SQL Queries' => $iSqlCount, 'SQL Memory Usage' => $oFile->filesize($iSqlMemory), 'SQL Slave Enabled' => $bSlaveEnabled ? 'Yes' : 'No', 'SQL Total Slaves' => $bSlaveEnabled ? count(Phpfox::getParam(array('db', 'slave_servers'))) : 'N/A', 'SQL Slave Server' => $bSlaveEnabled ? Phpfox_Database::instance()->sSlaveServer : 'N/A', '3' => '', 'Total Memory Usage' => $oFile->filesize(PHPFOX_MEM_END), 'Total Memory Usage (Including Debug)' => $oFile->filesize(memory_get_usage()), 'Memory Limit' => $oFile->filesize(self::_getUsableMemory()) . ' (' . @ini_get('memory_limit') . ')', '4' => '', 'Load Balancing Enabled' => Phpfox::getParam(array('balancer', 'enabled')) ? 'Yes' : 'No', 'Requests From' => $oRequest->getServer('SERVER_ADDR'), 'Server ID#' => $oRequest->getServer('PHPFOX_SERVER_ID'), '5' => '', 'Server Time Stamp' => date('F j, Y, g:i a', PHPFOX_TIME), 'PHP Version' => PHP_VERSION, 'PHP Sapi' => php_sapi_name(), 'PHP safe_mode' => PHPFOX_SAFE_MODE ? 'true' : 'false', 'PHP open_basedir' => PHPFOX_OPEN_BASE_DIR ? 'true' : 'false', 'Operating System' => PHP_OS, '6' => '', 'Cache' => Phpfox::getParam('core.cache_storage'));
            if (extension_loaded('xdebug')) {
                $aXdebug = array('4' => '', 'xDebug File Name' => xdebug_get_profiler_filename(), 'xDebug Total Time' => xdebug_time_index());
                $aStats = array_merge($aStats, $aXdebug);
            }
            $sDebugStats = '';
            foreach ($aStats as $sStatTitle => $mStatValue) {
                if (!$mStatValue) {
                    $sDebugStats .= $bIsCmd ? "\n" : "<br />";
                } else {
                    $sDebugStats .= $bIsCmd ? "" . $sStatTitle . ": " . $mStatValue . "\n" : "<div class=\"nDebugLeft\">" . $sStatTitle . ":</div><div>" . $mStatValue . "</div>\n<div class=\"nClear\"></div>\n";
                }
            }
            $aCookies = array();
            $sCookiePrefix = Phpfox::getParam('core.session_prefix');
            $iPrefixLength = strlen($sCookiePrefix);
            foreach ($_COOKIE as $sKey => $sValue) {
                if (substr($sKey, 0, $iPrefixLength) != $sCookiePrefix) {
                    continue;
                }
                $aCookies[$sKey] = $sValue;
            }
            if ($bIsCmd) {
                $sDebugReturn .= $sDebugStats;
                $sDebugReturn .= "##############################################";
            } else {
                $sDebugReturn .= '
				<div id="n_debug">
				<div id="n_debug_header">
					phpFox Developers Debug
					<a href="#" onclick="if (getCookie(\'js_console\')) { deleteCookie(\'js_console\'); $(\'#firebug_no_console\').remove(); } else { setCookie(\'js_console\', \'1\', 365); p(\'Enabled JavaScript Console\'); } return false;">Toggle JavaScript Console</a>
				</div>		
//.........这里部分代码省略.........
开发者ID:lev1976g,项目名称:core,代码行数:101,代码来源:debug.class.php


注:本文中的PhpFox::getCodeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。