public function onKernelResponse(FilterResponseEvent $event)
 {
     $request = $event->getRequest();
     if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
         return;
     }
     $response = $event->getResponse();
     if ($request->isXmlHttpRequest()) {
         $this->debugbar->sendDataInHeaders();
         return;
     }
     //        if ($response->isRedirection()
     //            OR !$response->headers->has('content-type')
     //            OR false === strpos($response->headers->get('content-type'), 'text/html')
     //        ) {
     //            if ($this->debugbar->hasStackedData()) {
     //                //esto es para que solo guarde la ultima
     //                $this->debugbar->getStackedData();
     //            }
     //            $this->debugbar->stackData();
     //
     //            return;
     //        }
     $base = $request->getBasePath() . '/debugbar/';
     $debugbarRenderer = $this->debugbar->getJavascriptRenderer($base);
     $this->injectScripts($response, $debugbarRenderer);
 }
 /**
  * 
  * @return string
  */
 protected function render()
 {
     $renderer = $this->debugbar->getJavascriptRenderer();
     $renderer->setOptions($this->config);
     $is_ajax = $this->CI->input->is_ajax_request();
     $initialize = !$is_ajax ? true : false;
     $assets = !$is_ajax ? $this->getAssets($renderer) : null;
     if ($is_ajax && $this->isJsonOutput()) {
         $use_open_handler = $this->setStorage();
         $this->debugbar->sendDataInHeaders($use_open_handler);
         return;
     } else {
         return $assets . $renderer->render($initialize);
     }
 }
Beispiel #3
0
 /**
  * 
  * @return string
  */
 protected function render()
 {
     $renderer = $this->debugbar->getJavascriptRenderer();
     $renderer->setOptions($this->config);
     $is_ajax = $this->CI->input->is_ajax_request();
     $is_json = $this->isJsonOutput();
     $is_sneaky = $is_ajax || $is_json ? TRUE : FALSE;
     $assets = !$is_sneaky ? $this->getAssets($renderer) : null;
     if ($is_sneaky) {
         $use_open_handler = $this->setStorage();
         $this->debugbar->sendDataInHeaders($use_open_handler);
         return;
     } else {
         return $assets . $renderer->render(!$is_sneaky);
     }
 }