PHP Classes

File: engine/modules/core/stats/stats.qtags.inc

Recommend this page to a friend!
  Classes of Aldo Tripiciano   Quanta CMS   engine/modules/core/stats/stats.qtags.inc   Download  
File: engine/modules/core/stats/stats.qtags.inc
Role: Example script
Content type: text/plain
Description: Example script
Class: Quanta CMS
Manage content that works without a database
Author: By
Last change:
Date: 5 years ago
Size: 1,193 bytes
 

Contents

Class file image Download
<?php
/**
 * Implements qtag STATS.
 *
 * Statistics (only for admin) of the current page load.
 *
 * @param Environment $env
 * The Environment.
 *
 * @param string $target
 * The qtag's target.
 *
 * @param array $attributes
 * The qtag's attributes.
 *
 * @return string
 * The rendered qtag.
 */
function qtag_STATS($env, $target, $attributes) {
 
$stats = array();
 
$stats[] = 'Node loaded: ' . $env->getData(STATS_NODE_LOADED);
 
$stats[] = 'Node built: ' . $env->getData(STATS_NODE_BUILT);
 
$stats[] = 'Node built from cache: ' . $env->getData(STATS_NODE_LOADED_CACHE);
 
$ttime = $env->getData(STATS_PAGE_COMPLETE_TIME) - $env->getData(STATS_PAGE_BOOT_TIME);
 
$stats[] = 'Total time: ' . $ttime . 'ms';
  if (
$env->getData(STATS_NODE_BUILT) > 0) {
   
$stats[] = 'Node build time: ' . doubleval($ttime / $env->getData(STATS_NODE_BUILT)) . 'ms';
  }
 
$stats[] = 'Node list: ' . implode(' ', $env->getData(STATS_NODE_LIST));
 
$stats[] = 'Loaded tags (only first level - to fix): ' . $env->getData(STATS_QTAG_LOADED);

 
$string ='<div id="stats" style="border: 1px solid black; padding: 8px; background: #eee;">' . implode('<br>', $stats) . '</div>';
  return
$string;
}