コード例 #1
0
 /**
  * Constructor.
  *
  * @param ContainerAwareEventDispatcher $dispatcher ContainerAwareEventDispatcher.
  */
 public function __construct(ContainerAwareEventDispatcher $dispatcher)
 {
     $this->dispatcher = $dispatcher;
     $this->container = $this->dispatcher->getContainer();
     // get rid of this as it's available already in $dispatcher
     $this->setupHandlerDefinitions();
 }
コード例 #2
0
ファイル: DebugToolbar.php プロジェクト: planetenkiller/core
 /**
  * Returns the toolbar data in json format
  *
  * @return string
  */
 function asJSON()
 {
     $container = $this->dispatcher->getContainer();
     $request = $container->get('request');
     // check if security key is defined
     $secKey = isset($container['log.to_debug_toolbar_seckey']) ? $container['log.to_debug_toolbar_seckey'] : false;
     // if so - get client seckey from http header
     if (!empty($secKey)) {
         $requestSecKey = $request->getServer()->get('HTTP_X_ZIKULA_DEBUGTOOLBAR');
         // if client seckey is not valid - do not return data
         if ($secKey != $requestSecKey) {
             return '';
         }
     }
     $data = array();
     $data['__meta'] = array('realpath' => realpath('.'));
     $data['http_request'] = array('method' => $request->getMethod(), 'get' => (array) $request->getGet()->getCollection(), 'post' => (array) $request->getPost()->getCollection(), 'files' => (array) $request->getFiles()->getCollection(), 'cookie' => (array) $request->getCookie()->getCollection(), 'server' => (array) $request->getServer()->getCollection(), 'env' => (array) $request->getEnv()->getCollection());
     foreach ($this->_panels as $name => $panel) {
         $title = $panel->getPanelTitle();
         $data[$name] = array('title' => $title ? $title : $name, 'content' => $panel->getPaneldata());
     }
     // need to suppress errors due to recursion warrnings
     $data = @json_encode($data);
     $html = "<script type=\"text/javascript\">Zikula.DebugToolbarData = {$data}</script>";
     return $html;
 }