/** * Event listener for module.postexecute. * * @param GenericEvent $event Event. * * @return void */ public function modexecPost(GenericEvent $event) { if (count($this->_stack) == 0) { return; } // pos to last stack entry $stackPos = count($this->_stack) - 1; // extract value of stack entry $lastExecPos = $this->_stack[$stackPos]; // remove from stack unset($this->_stack[$stackPos]); $this->_stack = array_values($this->_stack); // calculate time $startTime = $this->_executions[$lastExecPos]['time']; $this->_executions[$lastExecPos]['time'] = (microtime(true) - $startTime) * 1000; $this->_executions[$lastExecPos]['level'] = count($this->_stack); $this->_executions[$lastExecPos]['data'] = $event->getData(); }
/** * Debug toolbar rendering (listener for 'theme.prefetch' and 'theme.postfetch' events). * * @param GenericEvent $event Event. * * @return void */ public function debugToolbarRendering(GenericEvent $event) { if (!$event->getSubject() instanceof \Zikula_ErrorHandler_Ajax) { if ($event->getName() == 'theme.prefetch') { // force object construction (debug toolbar constructor registers javascript and css files via PageUtil) $this->container->get('debug.toolbar'); } else { $toolbar = $this->container->get('debug.toolbar'); $html = $toolbar->getContent() . "\n</body>"; $event->setData(str_replace('</body>', $html, $event->getData())); } } }