| 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( 'MywpDeveloperModuleCoreSite' ) ) : |
| 12 |
|
| 13 |
final class MywpDeveloperModuleCoreSite extends MywpDeveloperAbstractModule { |
| 14 |
|
| 15 |
static protected $id = 'core_site'; |
| 16 |
|
| 17 |
static protected $priority = 40; |
| 18 |
|
| 19 |
public static function mywp_debug_renders( $debug_renders ) { |
| 20 |
|
| 21 |
$debug_renders[ self::$id ] = array( |
| 22 |
'debug_type' => 'core', |
| 23 |
'title' => __( 'Current Site' , 'my-wp' ), |
| 24 |
); |
| 25 |
|
| 26 |
return $debug_renders; |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
protected static function get_debug_lists() { |
| 31 |
|
| 32 |
$debug_lists = array( |
| 33 |
'site_url()' => site_url(), |
| 34 |
'get_site_url()' => get_site_url(), |
| 35 |
'home_url()' => home_url(), |
| 36 |
'get_home_url()' => get_home_url(), |
| 37 |
'get_bloginfo( "name" , "display" )' => get_bloginfo( 'name' , 'display' ), |
| 38 |
'admin_url()' => admin_url(), |
| 39 |
'get_admin_url()' => get_admin_url(), |
| 40 |
'self_admin_url()' => self_admin_url(), |
| 41 |
//'get_dashboard_url()' => get_dashboard_url(), |
| 42 |
'content_url()' => content_url(), |
| 43 |
'get_locale()' => get_locale(), |
| 44 |
); |
| 45 |
|
| 46 |
return $debug_lists; |
| 47 |
|
| 48 |
} |
| 49 |
|
| 50 |
protected static function mywp_debug_render() { |
| 51 |
|
| 52 |
$debug_lists = self::get_debug_lists(); |
| 53 |
|
| 54 |
if( empty( $debug_lists ) ) { |
| 55 |
|
| 56 |
return false; |
| 57 |
|
| 58 |
} |
| 59 |
|
| 60 |
echo '<table class="debug-table">'; |
| 61 |
|
| 62 |
foreach( $debug_lists as $key => $val ) { |
| 63 |
|
| 64 |
echo '<tr>'; |
| 65 |
|
| 66 |
printf( '<th>%s</th>' , esc_html( $key ) ); |
| 67 |
|
| 68 |
echo '<td>'; |
| 69 |
|
| 70 |
if( in_array( $key , array( 'site_url()' , 'home_url()' ) ) ) { |
| 71 |
|
| 72 |
echo esc_url( $val ); |
| 73 |
|
| 74 |
} else { |
| 75 |
|
| 76 |
echo esc_html( $val ); |
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
echo '</td>'; |
| 81 |
|
| 82 |
echo '</tr>'; |
| 83 |
|
| 84 |
} |
| 85 |
|
| 86 |
echo '</table>'; |
| 87 |
|
| 88 |
} |
| 89 |
|
| 90 |
} |
| 91 |
|
| 92 |
MywpDeveloperModuleCoreSite::init(); |
| 93 |
|
| 94 |
endif; |
| 95 |
|