plugins:stopwatch:stopwatch_code

NP_StopWatch.php Source Code

<?php
class NP_StopWatch extends NucleusPlugin {
    function getName() { return get_class($this); }
    function supportsFeature($what) { return (int)($what=='SqlTablePrefix'); }
    function getEventList() { return array('InitSkinParse'); }
    var $beforeInit='';
    function event_InitSkinParse() {
        $this->mtime=time()+microtime();
        global $np_stopwatch;
        if (isset($np_stopwatch)) $this->beforeInit=$this->mtime-$np_stopwatch;
    }
    function doSkinVar() {
        global $SQLCount;
        $t=$this->beforeInit.($this->beforeInit?' + ':'').(time()+microtime()-$this->mtime);
        $t.=" SQLCount:$SQLCount";
        echo "<!--NP_StopWatch:$t-->";
    }
}
?>
 
plugins/stopwatch/stopwatch_code.txt · 最終更新: 2011/03/23 21:28 (外部編集)