| 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( 'MywpDeveloperModuleCoreTheme' ) ) : |
| 12 |
|
| 13 |
final class MywpDeveloperModuleCoreTheme extends MywpDeveloperAbstractModule { |
| 14 |
|
| 15 |
static protected $id = 'core_theme'; |
| 16 |
|
| 17 |
static protected $priority = 60; |
| 18 |
|
| 19 |
public static function mywp_debug_renders( $debug_renders ) { |
| 20 |
|
| 21 |
$debug_renders[ self::$id ] = array( |
| 22 |
'debug_type' => 'core', |
| 23 |
'title' => __( 'Current Theme' , 'my-wp' ), |
| 24 |
); |
| 25 |
|
| 26 |
return $debug_renders; |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
protected static function get_debug_lists() { |
| 31 |
|
| 32 |
if( ! did_action( 'after_setup_theme' ) ) { |
| 33 |
|
| 34 |
$called_text = sprintf( '%s::%s()' , __CLASS__ , __FUNCTION__ ); |
| 35 |
|
| 36 |
MywpHelper::error_after_called_message( 'after_setup_theme' , $called_text ); |
| 37 |
|
| 38 |
return false; |
| 39 |
|
| 40 |
} |
| 41 |
|
| 42 |
$debug_lists = array( |
| 43 |
'get_template()' => get_template(), |
| 44 |
'get_template_directory()' => get_template_directory(), |
| 45 |
'get_template_directory_uri()' => get_template_directory_uri(), |
| 46 |
'is_child_theme()' => is_child_theme(), |
| 47 |
'get_stylesheet()' => get_stylesheet(), |
| 48 |
'get_stylesheet_directory()' => get_stylesheet_directory(), |
| 49 |
'get_stylesheet_directory_uri()' => get_stylesheet_directory_uri(), |
| 50 |
'WP_DEFAULT_THEME' => WP_DEFAULT_THEME, |
| 51 |
); |
| 52 |
|
| 53 |
return $debug_lists; |
| 54 |
|
| 55 |
} |
| 56 |
|
| 57 |
protected static function mywp_debug_render() { |
| 58 |
|
| 59 |
$debug_lists = self::get_debug_lists(); |
| 60 |
|
| 61 |
if( empty( $debug_lists ) ) { |
| 62 |
|
| 63 |
return false; |
| 64 |
|
| 65 |
} |
| 66 |
|
| 67 |
echo '<table class="debug-table">'; |
| 68 |
|
| 69 |
foreach( $debug_lists as $key => $val ) { |
| 70 |
|
| 71 |
echo '<tr>'; |
| 72 |
|
| 73 |
printf( '<th>%s</th>' , $key ); |
| 74 |
|
| 75 |
echo '<td>'; |
| 76 |
|
| 77 |
if( in_array( $key , array( 'get_template_directory_uri()' , 'get_stylesheet_uri()' ) ) ) { |
| 78 |
|
| 79 |
echo esc_url( $val ); |
| 80 |
|
| 81 |
} else { |
| 82 |
|
| 83 |
echo $val; |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
echo '</td>'; |
| 88 |
|
| 89 |
echo '</tr>'; |
| 90 |
|
| 91 |
} |
| 92 |
|
| 93 |
echo '</table>'; |
| 94 |
|
| 95 |
} |
| 96 |
|
| 97 |
} |
| 98 |
|
| 99 |
MywpDeveloperModuleCoreTheme::init(); |
| 100 |
|
| 101 |
endif; |
| 102 |
|