Esempio n. 1
0
 /**
  * Display the debugger button and main div on the page, includes JS functions
  */
 public static function display()
 {
     $csp_debugger = \caspar\core\Caspar::getDebugger();
     require CASPAR_PATH . 'templates' . DS . 'debugger.php';
 }
Esempio n. 2
0
 public function ajaxResponseText($code, $error)
 {
     $ob_status = ob_get_status();
     if (!empty($ob_status) && (isset($ob_status['status']) && $ob_status['status'] != PHP_OUTPUT_HANDLER_END || isset($ob_status['flags']) && !($ob_status['flags'] & PHP_OUTPUT_HANDLER_END))) {
         ob_end_clean();
     }
     $this->setContentType('application/json');
     $this->setHttpStatus($code);
     $this->renderHeaders();
     if (\caspar\core\Caspar::isDebugMode()) {
         $json_data = array('error' => $error);
         \caspar\core\Caspar::getDebugger()->setJsonOutput($json_data);
         $json_data['csp-debugger'] = \caspar\core\Caspar::getDebugger()->returnCurrentPageRow();
         echo json_encode($json_data);
         die;
     }
     echo json_encode(array('error' => $error));
     die;
 }
Esempio n. 3
0
 /**
  * Renders JSON output, also takes care of setting the correct headers
  * 
  * @param array $content The array to render
  *  
  * @return boolean
  */
 public function renderJSON($text = array())
 {
     $this->getResponse()->setContentType('application/json');
     $this->getResponse()->setDecoration(Response::DECORATE_NONE);
     if (false && \caspar\core\Caspar::isDebugMode()) {
         $json_data = $text;
         \caspar\core\Caspar::getDebugger()->setJsonOutput($json_data);
         $json_data['csp-debugger'] = \caspar\core\Caspar::getDebugger()->returnCurrentPageRow();
         echo json_encode($json_data);
         return true;
     }
     echo json_encode($text);
     return true;
 }