本文整理汇总了PHP中xdebug_peak_memory_usage函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_peak_memory_usage函数的具体用法?PHP xdebug_peak_memory_usage怎么用?PHP xdebug_peak_memory_usage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdebug_peak_memory_usage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bench
public function bench(RestServer $rest)
{
$rest->getResponse()->appendResponse("It took " . round(xdebug_time_index(), 5) . " seconds\n");
$rest->getResponse()->appendResponse("Used " . round(xdebug_memory_usage() / 1024, 5) . "Kb of Memory\n");
$rest->getResponse()->appendResponse("Used at peak " . round(xdebug_peak_memory_usage() / 1024, 5) . "Kb of Memory\n");
return $rest;
}
开发者ID:nolazybits,项目名称:restserver,代码行数:7,代码来源:server.php
示例2: paintFooter
public function paintFooter($test_name)
{
if (function_exists('xdebug_peak_memory_usage')) {
$max_mem = number_format(xdebug_peak_memory_usage());
echo "<div>Max memory usage: {$max_mem} bytes</div>";
}
parent::paintFooter($test_name);
}
开发者ID:blacklis,项目名称:yiiserv,代码行数:8,代码来源:Reporter.php
示例3: onApiRespond
/**
* @param \Civi\API\Event\RespondEvent $event
* API response event.
*/
public function onApiRespond(\Civi\API\Event\RespondEvent $event)
{
$apiRequest = $event->getApiRequest();
$result = $event->getResponse();
if (function_exists('xdebug_time_index') && \CRM_Utils_Array::value('debug', $apiRequest['params']) && is_array($result)) {
$result['xdebug']['peakMemory'] = xdebug_peak_memory_usage();
$result['xdebug']['memory'] = xdebug_memory_usage();
$result['xdebug']['timeIndex'] = xdebug_time_index();
$event->setResponse($result);
}
}
开发者ID:kidaa30,项目名称:yes,代码行数:15,代码来源:XDebugSubscriber.php
示例4: xdebug_memory_usage
// } else {
// $controller->execute(JRequest::getCmd('task', ''));
// }
$controller->execute(JRequest::getCmd('task', ''));
$jConfig =& JFactory::getConfig();
// Some hosting providers has xdebug installed for debugging purposes. We really shouldn't show this
// on live site unless they turn on debugging mode.
if (function_exists('xdebug_memory_usage') && $jConfig->getValue('debug')) {
$memNow = xdebug_memory_usage();
$db = JFactory::getDBO();
$db->debug(1);
echo '<div style="clear:both"> </div><pre>';
echo 'Start usage : ' . cConvertMem($mem) . '<br/>';
echo 'End usage : ' . cConvertMem($memNow) . '<br/>';
echo 'Mem usage : ' . cConvertMem($memNow - $mem) . '<br/>';
echo 'Peak mem : ' . cConvertMem(xdebug_peak_memory_usage()) . '<br/>';
echo 'Time : ' . (xdebug_time_index() - $tm) . '<br/>';
echo 'Query : ' . $db->getTicker();
echo '</pre>';
// Log average page load
jimport('joomla.filesystem.file');
$content = JFile::read(COMMUNITY_COM_PATH . DS . 'access.log');
$params = new JParameter($content);
$today = strftime('%Y-%m-%d');
$loadTime = $params->get($today, 0);
if ($loadTime > 0) {
$loadTime = ($loadTime + (xdebug_time_index() - $tm)) / 2;
} else {
$loadTime = xdebug_time_index() - $tm;
}
$params->set($today, $loadTime);
开发者ID:bizanto,项目名称:Hooked,代码行数:31,代码来源:community.php
示例5: addILIASFooter
/**
* add ILIAS footer
*/
function addILIASFooter()
{
global $ilAuth;
if (!$this->getAddFooter()) {
return;
}
global $ilias, $ilClientIniFile, $ilCtrl, $ilDB, $ilSetting, $lng;
$ftpl = new ilTemplate("tpl.footer.html", true, true, "Services/UICore");
$ftpl->setVariable("ILIAS_VERSION", $ilias->getSetting("ilias_version"));
$link_items = array();
// imprint
include_once "Services/Imprint/classes/class.ilImprint.php";
if ($_REQUEST["baseClass"] != "ilImprintGUI" && ilImprint::isActive()) {
include_once "Services/Link/classes/class.ilLink.php";
$link_items[ilLink::_getStaticLink(0, "impr")] = array($lng->txt("imprint"), true);
}
$link_items["mailto:" . ilUtil::prepareFormOutput($ilSetting->get("feedback_recipient"))] = array($lng->txt("contact_sysadmin"), false);
if (DEVMODE && version_compare(PHP_VERSION, '5', '>=')) {
$link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=xhtml")] = array("Validate", true);
$link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=accessibility")] = array("Accessibility", true);
}
// output translation link (extended language maintenance)
if ($ilSetting->get("lang_ext_maintenance") == "1") {
include_once "Services/Language/classes/class.ilObjLanguageAccess.php";
if (ilObjLanguageAccess::_checkTranslate() and !ilObjLanguageAccess::_isPageTranslation()) {
ilObjLanguageAccess::_saveUsages();
$link_items[ilObjLanguageAccess::_getTranslationLink()] = array($lng->txt('translation'), true);
}
}
$cnt = 0;
foreach ($link_items as $url => $caption) {
$cnt++;
if ($caption[1]) {
$ftpl->touchBlock("blank");
}
if ($cnt < sizeof($link_items)) {
$ftpl->touchBlock("item_separator");
}
$ftpl->setCurrentBlock("items");
$ftpl->setVariable("URL_ITEM", $url);
$ftpl->setVariable("TXT_ITEM", $caption[0]);
$ftpl->parseCurrentBlock();
}
if (DEVMODE) {
// execution time
$t1 = explode(" ", $GLOBALS['ilGlobalStartTime']);
$t2 = explode(" ", microtime());
$diff = $t2[0] - $t1[0] + $t2[1] - $t1[1];
$mem_usage = array();
if (function_exists("memory_get_usage")) {
$mem_usage[] = "Memory Usage: " . memory_get_usage() . " Bytes";
}
if (function_exists("xdebug_peak_memory_usage")) {
$mem_usage[] = "XDebug Peak Memory Usage: " . xdebug_peak_memory_usage() . " Bytes";
}
$mem_usage[] = round($diff, 4) . " Seconds";
if (sizeof($mem_usage)) {
$ftpl->setVariable("MEMORY_USAGE", "<br>" . implode(" | ", $mem_usage));
}
if (is_object($ilAuth) && isset($_SESSION[$ilAuth->_sessionName]) && isset($_SESSION[$ilAuth->_sessionName]["timestamp"])) {
$ftpl->setVariable("SESS_INFO", "<br />maxlifetime: " . ini_get("session.gc_maxlifetime") . " (" . ini_get("session.gc_maxlifetime") / 60 . "), id: " . session_id() . "<br />" . "timestamp: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["timestamp"]) . ", idle: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["idle"]) . "<br />expire: " . ($exp = $ilClientIniFile->readVariable("session", "expire")) . " (" . $exp / 60 . "), session ends at: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["idle"] + $exp));
}
if (!empty($_GET["do_dev_validate"]) && $ftpl->blockExists("xhtml_validation")) {
require_once "Services/XHTMLValidator/classes/class.ilValidatorAdapter.php";
$template2 = clone $this;
//echo "-".ilValidatorAdapter::validate($template2->get(), $_GET["do_dev_validate"])."-";
$ftpl->setCurrentBlock("xhtml_validation");
$ftpl->setVariable("VALIDATION", ilValidatorAdapter::validate($template2->get("DEFAULT", false, false, false, true), $_GET["do_dev_validate"]));
$ftpl->parseCurrentBlock();
}
// controller history
if (is_object($ilCtrl) && $ftpl->blockExists("c_entry") && $ftpl->blockExists("call_history")) {
$hist = $ilCtrl->getCallHistory();
foreach ($hist as $entry) {
$ftpl->setCurrentBlock("c_entry");
$ftpl->setVariable("C_ENTRY", $entry["class"]);
if (is_object($ilDB)) {
$file = $ilCtrl->lookupClassPath($entry["class"]);
$add = $entry["mode"] . " - " . $entry["cmd"];
if ($file != "") {
$add .= " - " . $file;
}
$ftpl->setVariable("C_FILE", $add);
}
$ftpl->parseCurrentBlock();
}
$ftpl->setCurrentBlock("call_history");
$ftpl->parseCurrentBlock();
// debug hack
$debug = $ilCtrl->getDebug();
foreach ($debug as $d) {
$ftpl->setCurrentBlock("c_entry");
$ftpl->setVariable("C_ENTRY", $d);
$ftpl->parseCurrentBlock();
}
$ftpl->setCurrentBlock("call_history");
$ftpl->parseCurrentBlock();
//.........这里部分代码省略.........
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.ilTemplate.php
示例6: time
<p><?php
echo ActiveSupport\DateHelper::to_string('db', time());
?>
</p>
<p><?php
echo ActiveSupport\DateHelper::to_string('rfc822', time());
?>
</p>
<p><?php
echo ActiveSupport\TimeHelper::to_string('db', time());
?>
</p>
<p><?php
echo ActiveSupport\TimeHelper::to_string('rfc822', time());
?>
</p>
<p>Memory usage: <?php
echo xdebug_memory_usage() / 1024 / 1024;
?>
</p>
<p>Peak Memory usage: <?php
echo xdebug_peak_memory_usage() / 1024 / 1024;
?>
</p>
<p>Execution Time: <?php
echo xdebug_time_index();
?>
</p>
开发者ID:scottdavis,项目名称:active_php,代码行数:29,代码来源:test.php
示例7: civicrm_api
/**
* @param string $entity
* type of entities to deal with
* @param string $action
* create, get, delete or some special action name.
* @param array $params
* array to be passed to function
* @param null $extra
*
* @return array|int
*/
function civicrm_api($entity, $action, $params, $extra = NULL)
{
$apiRequest = array();
$apiRequest['entity'] = CRM_Utils_String::munge($entity);
$apiRequest['action'] = CRM_Utils_String::munge($action);
$apiRequest['version'] = civicrm_get_api_version($params);
$apiRequest['params'] = $params;
$apiRequest['extra'] = $extra;
$apiWrappers = array(CRM_Utils_API_HTMLInputCoder::singleton(), CRM_Utils_API_NullOutputCoder::singleton(), CRM_Utils_API_ReloadOption::singleton(), CRM_Utils_API_MatchOption::singleton());
CRM_Utils_Hook::apiWrappers($apiWrappers, $apiRequest);
try {
require_once 'api/v3/utils.php';
require_once 'api/Exception.php';
if (!is_array($params)) {
throw new API_Exception('Input variable `params` is not an array', 2000);
}
_civicrm_api3_initialize();
$errorScope = CRM_Core_TemporaryErrorScope::useException();
// look up function, file, is_generic
$apiRequest += _civicrm_api_resolve($apiRequest);
if (strtolower($action) == 'create' || strtolower($action) == 'delete' || strtolower($action) == 'submit') {
$apiRequest['is_transactional'] = 1;
$transaction = new CRM_Core_Transaction();
}
// support multi-lingual requests
if ($language = CRM_Utils_Array::value('option.language', $params)) {
_civicrm_api_set_locale($language);
}
_civicrm_api3_api_check_permission($apiRequest['entity'], $apiRequest['action'], $apiRequest['params']);
$fields = _civicrm_api3_api_getfields($apiRequest);
// we do this before we
_civicrm_api3_swap_out_aliases($apiRequest, $fields);
if (strtolower($action) != 'getfields') {
if (empty($apiRequest['params']['id'])) {
$apiRequest['params'] = array_merge(_civicrm_api3_getdefaults($apiRequest, $fields), $apiRequest['params']);
}
//if 'id' is set then only 'version' will be checked but should still be checked for consistency
civicrm_api3_verify_mandatory($apiRequest['params'], NULL, _civicrm_api3_getrequired($apiRequest, $fields));
}
// For input filtering, process $apiWrappers in forward order
foreach ($apiWrappers as $apiWrapper) {
$apiRequest = $apiWrapper->fromApiInput($apiRequest);
}
$function = $apiRequest['function'];
if ($apiRequest['function'] && $apiRequest['is_generic']) {
// Unlike normal API implementations, generic implementations require explicit
// knowledge of the entity and action (as well as $params). Bundle up these bits
// into a convenient data structure.
$result = $function($apiRequest);
} elseif ($apiRequest['function'] && !$apiRequest['is_generic']) {
_civicrm_api3_validate_fields($apiRequest['entity'], $apiRequest['action'], $apiRequest['params'], $fields);
$result = isset($extra) ? $function($apiRequest['params'], $extra) : $function($apiRequest['params']);
} else {
return civicrm_api3_create_error("API (" . $apiRequest['entity'] . ", " . $apiRequest['action'] . ") does not exist (join the API team and implement it!)");
}
// For output filtering, process $apiWrappers in reverse order
foreach (array_reverse($apiWrappers) as $apiWrapper) {
$result = $apiWrapper->toApiOutput($apiRequest, $result);
}
if (CRM_Utils_Array::value('format.is_success', $apiRequest['params']) == 1) {
if ($result['is_error'] === 0) {
return 1;
} else {
return 0;
}
}
if (!empty($apiRequest['params']['format.only_id']) && isset($result['id'])) {
return $result['id'];
}
if (CRM_Utils_Array::value('is_error', $result, 0) == 0) {
_civicrm_api_call_nested_api($apiRequest['params'], $result, $apiRequest['action'], $apiRequest['entity'], $apiRequest['version']);
}
if (function_exists('xdebug_time_index') && CRM_Utils_Array::value('debug', $apiRequest['params']) && is_array($result)) {
$result['xdebug']['peakMemory'] = xdebug_peak_memory_usage();
$result['xdebug']['memory'] = xdebug_memory_usage();
$result['xdebug']['timeIndex'] = xdebug_time_index();
}
return $result;
} catch (PEAR_Exception $e) {
if (CRM_Utils_Array::value('format.is_success', $apiRequest['params']) == 1) {
return 0;
}
$error = $e->getCause();
if ($error instanceof DB_Error) {
$data["error_code"] = DB::errorMessage($error->getCode());
$data["sql"] = $error->getDebugInfo();
}
if (!empty($apiRequest['params']['debug'])) {
if (method_exists($e, 'getUserInfo')) {
//.........这里部分代码省略.........
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:101,代码来源:api.php
示例8: Swift_Connection_Sendmail
$conn->setPassword($pass);
}
break;
case "sendmail":
require_once TestConfiguration::SWIFT_LIBRARY_PATH . "/Swift/Connection/Sendmail.php";
$conn = new Swift_Connection_Sendmail(TestConfiguration::SENDMAIL_PATH);
break;
case "nativemail":
require_once TestConfiguration::SWIFT_LIBRARY_PATH . "/Swift/Connection/NativeMail.php";
$conn = new Swift_Connection_NativeMail();
break;
}
?>
Run Test for number of recipients:
<ul>
<li><a href="?n=1">1</a></li>
<li><a href="?n=10">10</a></li>
<li><a href="?n=30">30</a></li>
<li><a href="?n=100">100</a></li>
</ul><?php
$swift = new Swift($conn);
$message = new Swift_Message("Test", "Test");
$from = new Swift_Address(TestConfiguration::FROM_ADDRESS, TestConfiguration::FROM_NAME);
$to = new Swift_Address(TestConfiguration::TO_ADDRESS, TestConfiguration::TO_NAME);
for ($i = 0; $i < $n; $i++) {
$swift->send($message, $to, $from);
}
xdebug_stop_trace();
echo "Check the output file [" . TestConfiguration::WRITABLE_PATH . "/bench-output.xt] for the trace if the peak memory value below is zero<br />";
echo xdebug_peak_memory_usage();
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:30,代码来源:mem_sending_with_swift.php
示例9: render
//.........这里部分代码省略.........
width: 100%;
background: none repeat scroll 0 0 #FFFFCC;
border-width: 1px;
border-style: outset;
border-color: #BF0000;
border-collapse: collapse;
color: #222;
font: 12px tahoma,verdana,arial,sans-serif;
margin-top: 5px;
margin-bottom: 8px;
}
table.xdebug-console th, table.xdebug-superglobals th {
border: 1px inset #BF0000;
padding: 3px;
padding-bottom: 3px;
font-weight: bold;
background: #E03937;
text-align: left;
}
.xdebug-superglobals td {
border: 1px solid grey;
padding: 2px;
padding-left: 5px;
vertical-align:top;
}
table.xdebug-console td {
border: 1px inset grey;
padding: 2px;
padding-left: 5px;
}
table.xdebug-console td.td1 {width: 30%; padding-left:20px; color:#FF0000; }
table.xdebug-console td.td2 {width: 70%;}
table.xdebug-console tr:hover td, table.xdebug-superglobals tr:hover td {
background: #ffff88;
}
fieldset.xdebug-console {
background: none repeat scroll 0 0 #ccc;
border: 1px solid #666666;
font: 12px tahoma,verdana,arial,sans-serif;
margin: 35px;
padding: 10px;
width: 95%;
}
fieldset.xdebug-console legend {
background: #fff;
border: 1px solid #333;
font-weight: bold;
padding: 5px 15px;
color: #222;
float: left;
margin-top: -23px;
margin-bottom: 10px;
}
fieldset.xdebug-console pre {
margin: 2px;
text-align: left;
width: 100%;
}
/*]]>*/
</style>
<!--[if IE]>
<style type="text/css">
fieldset.xdebug-console legend {
position:relative;
top: -0.2em;
}
</style>
<![endif]-->';
echo '<fieldset class="xdebug-console"><legend>XDebug Console</legend>';
echo xdebug_dump_superglobals();
echo '<table class="xdebug-console">';
echo '<tr><th>Name</th><th>Value</th></tr>';
echo '<tr>';
echo '<td class="td1">Time to execute</td>';
echo '<td class="td2">' . round(xdebug_time_index(), 4) . ' seconds</td>';
echo '</tr><tr>';
echo '<td class="td1">Memory Usage (before)</td>';
echo '<td class="td2">' . self::$xdebug_memory_before . ' MB</td>';
echo '</tr><tr>';
echo '<td class="td1">Memory Usage by ' . APPLICATION_NAME . ' </td>';
echo '<td class="td2">' . self::roundMB(xdebug_memory_usage()) . ' MB</td>';
echo '</tr><tr>';
echo '<td class="td1">Memory Peak</td>';
echo '<td class="td2">' . self::roundMB(xdebug_peak_memory_usage()) . ' MB</td>';
echo '</tr>';
// stop tracings and var_dump
#var_dump(xdebug_get_code_coverage());
echo '</table>';
self::showConstants();
#self::showBrowserInfo();
self::showHttpHeaders();
echo '</table>';
echo '</fieldset>';
/*
* Reset for hardcoded bgcolor attributes in the "xdebug-superglobals" table.
* This will select all <td> elements and reset the bgcolor attribute on each element.
*/
echo "<script type=\"text/javascript\">\n var xdebugTds = document.getElementsByClassName('xdebug-superglobals')[0].getElementsByTagName('td');\n for (var i = 0; i < xdebugTds.length; i++) {xdebugTds[i].setAttribute('bgcolor', '');}\n xdebugTds[0].setAttribute('width', '30%');\n </script>";
}
}
开发者ID:ksst,项目名称:kf,代码行数:101,代码来源:XDebug.php
示例10: reply
/**
* Send HTTP response body and create performance.log
*
*/
public function reply($data)
{
$this->response->sendHeader();
echo $data;
if (function_exists("xdebug_time_index")) {
$filename = 'app/log/performance.log';
$time = $this->getRequestURI() . " took " . round(xdebug_time_index(), 5) . " seconds\n";
$time .= "Used " . round(xdebug_memory_usage() / 1024, 5) . "Kb of Memory\n";
$time .= "Used at peak " . round(xdebug_peak_memory_usage() / 1024, 5) . "Kb of Memory\n";
if (is_writeable($filename)) {
file_put_contents($filename, $time);
}
}
}
开发者ID:kuntoaji,项目名称:drestcode,代码行数:18,代码来源:RestServer.php
示例11: printCommonFooter
/**
* Print common footer :
* conf->global->MAIN_HTML_FOOTER
* conf->global->MAIN_GOOGLE_AN_ID
* DOL_TUNING
* conf->logbuffer
*
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
* @return void
*/
function printCommonFooter($zone = 'private')
{
global $conf;
global $micro_start_time;
if ($zone == 'private') {
print "\n" . '<!-- Common footer for private page -->' . "\n";
} else {
print "\n" . '<!-- Common footer for public page -->' . "\n";
}
if (!empty($conf->global->MAIN_HTML_FOOTER)) {
print $conf->global->MAIN_HTML_FOOTER . "\n";
}
// Google Analytics (need Google module)
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
if (empty($conf->dol_use_jmobile)) {
print "\n";
print '<script type="text/javascript">' . "\n";
print ' var _gaq = _gaq || [];' . "\n";
print ' _gaq.push([\'_setAccount\', \'' . $conf->global->MAIN_GOOGLE_AN_ID . '\']);' . "\n";
print ' _gaq.push([\'_trackPageview\']);' . "\n";
print '' . "\n";
print ' (function() {' . "\n";
print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n";
print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n";
print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n";
print ' })();' . "\n";
print '</script>' . "\n";
}
}
// End of tuning
if (!empty($_SERVER['DOL_TUNING']) || !empty($conf->global->MAIN_SHOW_TUNING_INFO)) {
print "\n" . '<script type="text/javascript">' . "\n";
print 'window.console && console.log("';
if (!empty($conf->global->MEMCACHED_SERVER)) {
print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - ';
}
print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off');
if ($micro_start_time) {
$micro_end_time = dol_microtime_float(true);
print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms';
}
if (function_exists("memory_get_usage")) {
print ' - Mem: ' . memory_get_usage();
}
if (function_exists("xdebug_memory_usage")) {
print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms';
print ' - XDebug mem: ' . xdebug_memory_usage();
print ' - XDebug mem peak: ' . xdebug_peak_memory_usage();
}
if (function_exists("zend_loader_file_encoded")) {
print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no');
}
print '");' . "\n";
print '</script>' . "\n";
// Add Xdebug coverage of code
if (defined('XDEBUGCOVERAGE')) {
var_dump(xdebug_get_code_coverage());
}
}
// If there is some logs in buffer to show
if (count($conf->logbuffer)) {
print "\n";
print "<!-- Start of log output\n";
//print '<div class="hidden">'."\n";
foreach ($conf->logbuffer as $logline) {
print $logline . "<br>\n";
}
//print '</div>'."\n";
print "End of log output -->\n";
}
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:81,代码来源:functions.lib.php
示例12: displayPublicAdminBar
public static function displayPublicAdminBar($okt)
{
$aBasesUrl = new ArrayObject();
$aPrimaryAdminBar = new ArrayObject();
$aSecondaryAdminBar = new ArrayObject();
$aBasesUrl['admin'] = $okt->config->app_path . OKT_ADMIN_DIR;
$aBasesUrl['logout'] = $aBasesUrl['admin'] . '/index.php?logout=1';
$aBasesUrl['profil'] = $aBasesUrl['admin'];
# -- CORE TRIGGER : publicAdminBarBeforeDefaultsItems
$okt->triggers->callTrigger('publicAdminBarBeforeDefaultsItems', $okt, $aPrimaryAdminBar, $aSecondaryAdminBar, $aBasesUrl);
# éléments première barre
$aPrimaryAdminBar[10] = array('intitle' => '<img src="' . OKT_PUBLIC_URL . '/img/notify/error.png" width="22" height="22" alt="' . __('c_c_warning') . '" />', 'items' => array());
$aPrimaryAdminBar[100] = array('href' => $aBasesUrl['admin'], 'intitle' => __('c_c_administration'));
$aPrimaryAdminBar[200] = array('intitle' => __('c_c_action_Add'), 'items' => array());
# éléments seconde barre
$aSecondaryAdminBar[100] = array('href' => $aBasesUrl['profil'], 'intitle' => sprintf(__('c_c_user_hello_%s'), html::escapeHTML(oktAuth::getUserCN($okt->user->username, $okt->user->lastname, $okt->user->firstname))));
if (!$okt->languages->unique) {
$iStartIdx = 150;
foreach ($okt->languages->list as $aLanguage) {
if ($aLanguage['code'] == $okt->user->language) {
continue;
}
$aSecondaryAdminBar[$iStartIdx++] = array('href' => html::escapeHTML($okt->config->app_path . $aLanguage['code'] . '/'), 'title' => html::escapeHTML($aLanguage['title']), 'intitle' => '<img src="' . OKT_PUBLIC_URL . '/img/flags/' . $aLanguage['img'] . '" alt="' . html::escapeHTML($aLanguage['title']) . '" />');
}
}
$aSecondaryAdminBar[200] = array('href' => $aBasesUrl['logout'], 'intitle' => __('c_c_user_log_off_action'));
# infos super-admin
if ($okt->checkPerm('is_superadmin')) {
# avertissement nouvelle version disponible
if ($okt->config->update_enabled && is_readable(OKT_DIGESTS)) {
$updater = new oktUpdate($okt->config->update_url, 'okatea', $okt->config->update_type, OKT_CACHE_PATH . '/versions');
$new_v = $updater->check(util::getVersion());
if ($updater->getNotify() && $new_v) {
# locales
l10n::set(OKT_LOCALES_PATH . '/' . $okt->user->language . '/admin.update');
$aPrimaryAdminBar[10]['items'][100] = array('href' => $aBasesUrl['admin'] . '/configuration.php?action=update', 'intitle' => sprintf(__('c_a_update_okatea_%s_available'), $new_v));
}
}
# avertissement mode maintenance est activé sur la partie publique
if ($okt->config->public_maintenance_mode) {
$aPrimaryAdminBar[10]['items'][300] = array('href' => $aBasesUrl['admin'] . '/configuration.php?action=advanced#tab_others', 'intitle' => sprintf(__('c_a_public_maintenance_mode_enabled'), $new_v));
}
# avertissement mode maintenance est activé sur l'admin
if ($okt->config->admin_maintenance_mode) {
$aPrimaryAdminBar[10]['items'][400] = array('href' => $aBasesUrl['admin'] . '/configuration.php?action=advanced#tab_others', 'intitle' => sprintf(__('c_a_admin_maintenance_mode_enabled'), $new_v));
}
# info execution
$aExecInfos = array();
$aExecInfos['execTime'] = util::getExecutionTime();
if (OKT_XDEBUG) {
$aExecInfos['memUsage'] = util::l10nFileSize(xdebug_memory_usage());
$aExecInfos['peakUsage'] = util::l10nFileSize(xdebug_peak_memory_usage());
} else {
$aExecInfos['memUsage'] = util::l10nFileSize(memory_get_usage());
$aExecInfos['peakUsage'] = util::l10nFileSize(memory_get_peak_usage());
}
$aSecondaryAdminBar[1000] = array('title' => $aExecInfos['execTime'] . ' s - ' . $aExecInfos['memUsage'], 'intitle' => '<img src="' . OKT_PUBLIC_URL . '/img/ico/terminal.gif" width="16" height="16" alt="" />', 'items' => array(array('intitle' => 'Temps d\'execution du script : ' . $aExecInfos['execTime'] . ' s'), array('intitle' => 'Mémoire utilisée par PHP : ' . $aExecInfos['memUsage']), array('intitle' => 'Pic mémoire allouée par PHP : ' . $aExecInfos['peakUsage']), array('intitle' => 'Router lang : ' . $okt->router->getLanguage()), array('intitle' => 'Router path : ' . $okt->router->getPath()), array('intitle' => 'Router route ID : ' . $okt->router->getFindedRouteId())));
if (!empty($okt->page->module)) {
$aSecondaryAdminBar[1000]['items'][] = array('intitle' => '$okt->page->module : ' . $okt->page->module);
}
if (!empty($okt->page->action)) {
$aSecondaryAdminBar[1000]['items'][] = array('intitle' => '$okt->page->action : ' . $okt->page->action);
}
}
# -- CORE TRIGGER : publicAdminBarItems
$okt->triggers->callTrigger('publicAdminBarItems', $okt, $aPrimaryAdminBar, $aSecondaryAdminBar, $aBasesUrl);
# sort items of by keys
$aPrimaryAdminBar->ksort();
$aSecondaryAdminBar->ksort();
# remove empty values of admins bars
$aPrimaryAdminBar = array_filter((array) $aPrimaryAdminBar);
$aSecondaryAdminBar = array_filter((array) $aSecondaryAdminBar);
# reverse sedond bar items
$aSecondaryAdminBar = array_reverse($aSecondaryAdminBar);
$class = '';
?>
<div id="oktadminbar" class="<?php
echo $class;
?>
" role="navigation">
<a class="screen-reader-shortcut" href="#okt-toolbar" tabindex="1"><?php
_e('Skip to toolbar');
?>
</a>
<div class="quicklinks" id="okt-toolbar" role="navigation"
aria-label="<?php
echo util::escapeAttrHTML(__('Top navigation toolbar.'));
?>
"
tabindex="0">
<ul class="ab-top-menu">
<?php
foreach ($aPrimaryAdminBar as $aPrimaryItem) {
echo self::getItems($aPrimaryItem);
}
?>
</ul>
<ul class="ab-top-secondary ab-top-menu">
<?php
foreach ($aSecondaryAdminBar as $aSecondaryItem) {
//.........这里部分代码省略.........
开发者ID:jewelhuq,项目名称:okatea,代码行数:101,代码来源:class.oktPublicAdminBar.php
示例13: error_reporting
<pre>
<?php
require 'ezc_mail_setup.php';
error_reporting(E_ALL);
$parser = new ezcMailParser();
$set = new ezcMailFileSet(array(dirname(__FILE__) . '/ezcmailtest.mail'));
echo "Memory: ", xdebug_memory_usage(), " bytes\n\n";
$mail = $parser->parseMail($set);
foreach ($mail as $mailPart) {
echo "From: {$mailPart->from->email}\n";
echo "Subject: {$mailPart->subject}\n";
}
unset($mail);
echo "\nMaximum Memory: ", xdebug_peak_memory_usage(), " bytes\n";
开发者ID:SandyS1,项目名称:presentations,代码行数:14,代码来源:dr_mail_test.php
示例14: output
/**
* Prepare template for render from View
*
* @throws \Exception if template path is incorrect
*/
public function output()
{
$template = $this->template;
$data = $this->data;
$css = $this->css;
$js = $this->js;
$title = $this->title;
ob_start();
try {
if (!file_exists(APP . "Templates/_pages/{$template}.html")) {
throw new \Exception("The required Template ({$template}) not exist.");
}
require APP . 'Templates/_shared/header.html';
require APP . "Templates/_pages/{$template}.html";
require APP . 'Templates/_shared/footer.html';
} catch (\Exception $e) {
echo 'Template exception: ', $e->getMessage(), "\n";
}
//only for debug, return time execution and memory usage
echo '<!-- Memory: ';
echo round(xdebug_memory_usage() / 1024, 2), ' (';
echo round(xdebug_peak_memory_usage() / 1024, 2), ') KByte - Time: ';
echo xdebug_time_index();
echo ' Seconds -->';
ob_end_flush();
}
开发者ID:s3b4stian,项目名称:app,代码行数:31,代码来源:HtmlTemplate.php
示例15: llxFooter
function llxFooter($foot = '')
{
global $conf, $langs, $dolibarr_auto_user, $micro_start_time;
// Core error message
if (defined("MAIN_CORE_ERROR") && constant("MAIN_CORE_ERROR") == 1) {
// Ajax version
if ($conf->use_javascript_ajax) {
$title = img_warning() . ' ' . $langs->trans('CoreErrorTitle');
print ajax_dialog($title, $langs->trans('CoreErrorMessage'));
} else {
$msg = img_warning() . ' ' . $langs->trans('CoreErrorMessage');
print '<div class="error">' . $msg . '</div>';
}
define("MAIN_CORE_ERROR", 0);
}
print "\n\n";
if (preg_match('/^smartphone/', $conf->smart_menu) && isset($conf->browser->phone)) {
print '</div> <!-- end div data-role="content" -->' . "\n";
print '</div> <!-- end div data-role="page" -->' . "\n";
}
print '</div> <!-- end div class="fiche" -->' . "\n";
print "\n" . '</td></tr></table> <!-- end right area -->' . "\n";
if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) {
print '</div></div> <!-- end main layout -->' . "\n";
}
print "\n";
if ($foot) {
print '<!-- ' . $foot . ' -->' . "\n";
}
if (!empty($conf->global->MAIN_HTML_FOOTER)) {
print $conf->global->MAIN_HTML_FOOTER . "\n";
}
// If there is some logs in buffer to show
if (sizeof($conf->logbuffer)) {
print "\n";
print "<!-- Start of log output\n";
//print '<div class="hidden">'."\n";
foreach ($conf->logbuffer as $logline) {
print $logline . "<br>\n";
}
//print '</div>'."\n";
print "End of log output -->\n";
}
// End of tuning
if (!empty($_SERVER['DOL_TUNING'])) {
$micro_end_time = dol_microtime_float(true);
print "\n" . '<script type="text/javascript">console.log("';
if (!empty($conf->global->MEMCACHED_SERVER)) {
print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - ';
}
print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off');
print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms';
if (function_exists("memory_get_usage")) {
print ' - Mem: ' . memory_get_usage();
}
if (function_exists("xdebug_memory_usage")) {
print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms';
print ' - XDebug mem: ' . xdebug_memory_usage();
print ' - XDebug mem peak: ' . xdebug_peak_memory_usage();
}
if (function_exists("zend_loader_file_encoded")) {
print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no');
}
print '")</script>' . "\n";
// Add Xdebug coverage of code
if (defined('XDEBUGCOVERAGE')) {
var_dump(xdebug_get_code_coverage());
}
}
print "</body>\n";
print "</html>\n";
}
开发者ID:netors,项目名称:dolibarr,代码行数:72,代码来源:main.inc.php
示例16: Lotus
include $lotusHome . 'runtime/Lotus.php';
$lotus = new Lotus();
$lotus->devMode = false;
// 关闭开发模式
$lotus->option['proj_dir'] = dirname(__FILE__) . '/proj_dir/';
$lotus->option['app_name'] = 'app_name1';
$lotus->init();
/**
* 使用xdebug测试性能
*/
if (function_exists('xdebug_time_index') && function_exists('xdebug_peak_memory_usage')) {
echo "\n<script type=\"text/javascript\">\n";
echo 'document.getElementById("debug_info").innerHTML = "';
echo xdebug_time_index();
echo ' - ';
echo format_size(xdebug_peak_memory_usage());
echo "\";\n</script>\n";
}
function format_size($size)
{
if ($size >= 1073741824) {
$size = round($size / 1073741824, 2) . ' GB';
} else {
if ($size >= 1048576) {
$size = round($size / 1048576, 2) . ' MB';
} else {
if ($size >= 1024) {
$size = round($size / 1024, 2) . ' KB';
} else {
$size = round($size, 2) . ' Bytes';
}
开发者ID:jianghaiming0426,项目名称:lotusphp,代码行数:31,代码来源:index.php
示例17: printCommonFooter
/**
* Print common footer :
* conf->global->MAIN_HTML_FOOTER
* conf->global->MAIN_GOOGLE_AN_ID
* conf->global->MAIN_SHOW_TUNING_INFO or $_SERVER["MAIN_SHOW_TUNING_INFO"]
* conf->logbuffer
*
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
* @return void
*/
function printCommonFooter($zone = 'private')
{
global $conf, $hookmanager;
global $micro_start_time;
if ($zone == 'private') {
print "\n" . '<!-- Common footer for private page -->' . "\n";
} else {
print "\n" . '<!-- Common footer for public page -->' . "\n";
}
if (!empty($conf->global->MAIN_HTML_FOOTER)) {
print $conf->global->MAIN_HTML_FOOTER . "\n";
}
print "\n";
if (!empty($conf->use_javascript_ajax)) {
print '<script type="tex
|
请发表评论