1<?php 2 3use ComboStrap\PluginUtility; 4 5 6/** 7 * Dump the call stack 8 */ 9class renderer_plugin_dump_callstack extends Doku_Renderer 10{ 11 12 const NAME = "dump_callstack"; 13 14 public function getFormat() 15 { 16 return "callstack"; 17 } 18 19 /** 20 * Adapted from {@link p_wiki_xhtml()} 21 */ 22 public function document_start() 23 { 24 global $ID; 25 global $REV; 26 global $INFO; 27 28 if ( 29 auth_quickaclcheck($ID) >= AUTH_READ 30 && $INFO['isadmin'] 31 ) { 32 33 $file = wikiFN($ID, $REV); 34 $ins = p_cached_instructions($file, false, $ID); 35 $body = json_encode($ins, JSON_PRETTY_PRINT); 36 header("Content-Type: application/json; charset=utf-8"); 37 header("X-Robots-Tag: noindex"); 38 echo $body; 39 40 } else { 41 42 http_status(403); 43 } 44 45 exit; 46 47 } 48 49 50} 51 52