From e4da9a5caf2b9a87fcc4736aed871414acfe8742 Mon Sep 17 00:00:00 2001 From: Evan Mattson Date: Mon, 13 Oct 2014 11:49:03 -0400 Subject: [PATCH] improve style/script fallbacks --- classes/DevDebug.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/classes/DevDebug.php b/classes/DevDebug.php index c4c8ffd..2b2f990 100644 --- a/classes/DevDebug.php +++ b/classes/DevDebug.php @@ -170,22 +170,32 @@ function get_screen() function print_styles() { - if ( ! wp_style_is( 'dev-debug', 'done' ) ) + if ( ! wp_style_is( 'dev-debug', 'done' ) && ! $this->did_styles ) { - $css = file_get_contents( "{$this->dir}/assets/dist/dev-debug.min.css" ); - echo "\n - \n"; + if ( wp_style_is( 'dev-debug', 'registered' ) ) + wp_print_styles( 'dev-debug' ); + else + { + $css = file_get_contents( "{$this->dir}/assets/dist/dev-debug.min.css" ); + echo "\n + \n"; + } } $this->did_styles = true; } function print_scripts() { - if ( ! wp_script_is( 'dev-debug', 'done' ) ) + if ( ! wp_script_is( 'dev-debug', 'done' ) && ! $this->did_scripts ) { - $scripts = file_get_contents( "{$this->dir}/assets/dist/dev-debug.min.js" ); - echo "\n - \n"; + if ( wp_script_is( 'dev-debug', 'registered' ) ) + wp_print_scripts( 'dev-debug' ); + else + { + $scripts = file_get_contents( "{$this->dir}/assets/dist/dev-debug.min.js" ); + echo "\n + \n"; + } } $this->did_scripts = true; }