| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
if( ! class_exists( 'MywpDeveloperAbstractModule' ) ) { |
| 8 |
return false; |
| 9 |
} |
| 10 |
|
| 11 |
if ( ! class_exists( 'MywpDeveloperModuleDevRequest' ) ) : |
| 12 |
|
| 13 |
final class MywpDeveloperModuleDevRequest extends MywpDeveloperAbstractModule { |
| 14 |
|
| 15 |
static protected $id = 'dev_request'; |
| 16 |
|
| 17 |
static protected $priority = 80; |
| 18 |
|
| 19 |
public static function mywp_debug_renders( $debug_renders ) { |
| 20 |
|
| 21 |
$debug_renders[ self::$id ] = array( |
| 22 |
'debug_type' => 'dev', |
| 23 |
'title' => __( 'Request' , 'mywp'), |
| 24 |
); |
| 25 |
|
| 26 |
return $debug_renders; |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
protected static function get_debug_lists() { |
| 31 |
|
| 32 |
$debug_lists = array( |
| 33 |
'DOING_AJAX' => defined( 'DOING_AJAX' ), |
| 34 |
'DOING_CRON' => defined( 'DOING_CRON' ), |
| 35 |
'XMLRPC_REQUEST' => defined( 'XMLRPC_REQUEST' ), |
| 36 |
'REST_REQUEST' => defined( 'REST_REQUEST' ), |
| 37 |
'is_ssl()' => is_ssl(), |
| 38 |
'is_admin()' => is_admin(), |
| 39 |
'is_network_admin()' => is_network_admin(), |
| 40 |
'$_POST' => $_POST, |
| 41 |
'$_GET' => $_GET, |
| 42 |
); |
| 43 |
|
| 44 |
return $debug_lists; |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
protected static function mywp_debug_render() { |
| 49 |
|
| 50 |
$debug_lists = self::get_debug_lists(); |
| 51 |
|
| 52 |
if( empty( $debug_lists ) ) { |
| 53 |
|
| 54 |
return false; |
| 55 |
|
| 56 |
} |
| 57 |
|
| 58 |
echo '<table class="debug-table">'; |
| 59 |
|
| 60 |
foreach( $debug_lists as $key => $val ) { |
| 61 |
|
| 62 |
echo '<tr>'; |
| 63 |
|
| 64 |
printf( '<th>%s</th>' , $key ); |
| 65 |
|
| 66 |
echo '<td>'; |
| 67 |
|
| 68 |
if( in_array( $key , array( '$_POST' , '$_GET' ) ) ) { |
| 69 |
|
| 70 |
printf( '<textarea readonly="readonly">%s</textarea>' , print_r( map_deep( $val , 'esc_html' ) , true ) ); |
| 71 |
|
| 72 |
} else { |
| 73 |
|
| 74 |
echo $val; |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
echo '</td>'; |
| 79 |
|
| 80 |
echo '</tr>'; |
| 81 |
|
| 82 |
} |
| 83 |
|
| 84 |
echo '</table>'; |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
} |
| 89 |
|
| 90 |
MywpDeveloperModuleDevRequest::init(); |
| 91 |
|
| 92 |
endif; |
| 93 |
|