/test-debug.php // SYNOPSIS // ================================ // Defines:- // // o pr( $value , [ $name = NULL ] ) // // All in the namespace:- // greatKiwi_byFernTec_adSwapper_local_v0x1x210_testDebug // ------------------------------------------------------------------------- // ============================================================================= // pr() // ============================================================================= function pr( $value , $name = NULL ) { if ( $name === NULL ) { echo '
' ;
        } else {
            echo '

' , $name , '

' ;
        }
        print_r( $value ) ;
        echo '
' ; } // ============================================================================= // \greatKiwi_byFernTec_adSwapper_local_v0x1x210_testDebug\ // debug_print_backtrace() // dpbt() // ============================================================================= function debug_print_backtrace( $title = NULL ) { // --------------------------------------------------------------------- //echo '
' , \debug_print_backtrace() , '
' ; //return ; // --------------------------------------------------------------------- $debug_backtrace = \debug_backtrace() ; // --------------------------------------------------------------------- // Here we should have (eg):- // // $debug_backtrace = Array( // // [0] => Array( // [file] => /opt/lampp/htdocs/plugdev/wp-content/plugins/teaser-maker-std-v0.1.54/includes/dataset-manager/common.php // [line] => 2656 // [function] => greatKiwi_byFernTec_teaserMaker_std_v0x1x54_testDebug\debug_print_backtrace // [args] => Array() // ) // // ... // // [8] => Array( // [file] => /opt/lampp/htdocs/plugdev/wp-content/plugins/teaser-maker-std-v0.1.54/app-defs/teaser-maker.app/plugin.stuff/admin/home.php // [line] => 255 // [function] => greatKiwi_byFernTec_teaserMaker_std_v0x1x54_standardDatasetManager\page_controller_wordpress_back_end // [args] => Array( // [0] => pluginPlant_byFernTec // [1] => /opt/lampp/htdocs/plugdev/wp-content/plugins/teaser-maker-std-v0.1.54/app-defs // [2] => /opt/ lampp/htdocs/plugdev/wp-content/plugins/teaser-maker-std-v0.1.54/includes // [3] => Teaser Maker Std 0.1.54 // [4] => ?page=teaserMakerStdV0x1x54 // [5] => Admin Home // [6] => teaserMakerStdV0x1x54 // ) // ) // // [9] => Array( // [function] => greatKiwi_byFernTec_teaserMaker_std_v0x1x54_adminSection\home_page // [args] => Array( // [0] => // ) // ) // // [10] => Array( // [file] => /opt/lampp/htdocs/plugdev/wp-includes/plugin.php // [line] => 406 // [function] => call_user_func_array // [args] => Array( // [0] => \greatKiwi_byFernTec_teaserMaker_std_v0x1x54_adminSection\home_page // [1] => Array( // [0] => // ) // ) // ) // // [11] => Array( // [file] => /opt/lampp/htdocs/plugdev/wp-admin/admin.php // [line] => 149 // [function] => do_action // [args] => Array( // [0] => toplevel_page_teaserMakerStdV0x1x54 // ) // // ) // // ) // // --------------------------------------------------------------------- //pr( \debug_backtrace() ) ; echo <<

EOT; // --------------------------------------------------------------------- $count_varname = 'greatKiwi_byFernTec_adSwapper_local_v0x1x210_testDebug_debugPrintBacktrace_numberOnPage' ; if ( array_key_exists( $count_varname , $GLOBALS ) ) { $GLOBALS[ $count_varname ] = $GLOBALS[ $count_varname ] + 1 ; } else { $GLOBALS[ $count_varname ] = 1 ; } // --------------------------------------------------------------------- foreach ( $debug_backtrace as $this_depth => $this_details ) { // ----------------------------------------------------------------- $rows = << Depth: {$this_depth} EOT; // ----------------------------------------------------------------- if ( array_key_exists( 'file' , $this_details ) ) { $dirname = dirname( $this_details['file'] ) ; $basename = basename( $this_details['file'] ) ; $rows .= << File: {$dirname}/{$basename} EOT; } // ----------------------------------------------------------------- if ( array_key_exists( 'line' , $this_details ) ) { $line = number_format( $this_details['line'] ) ; $rows .= << Line: {$line} EOT; } // ----------------------------------------------------------------- $parts = explode( '\\' , $this_details['function'] ) ; $fn = $parts[ count( $parts ) - 1 ] ; unset( $parts[ count( $parts ) - 1 ] ) ; $ns = implode( '\\' , $parts ) ; // ----------------------------------------------------------------- $rows .= << Function: {$ns}\\
    {$fn} EOT; // ----------------------------------------------------------------- if ( is_array( $this_details['args'] ) && count( $this_details['args'] ) > 0 ) { ob_start() ; pr( $this_details['args'] ) ; $args = ob_get_clean() ; $number_args = count( $this_details['args'] ) ; $args = <<toggle {$number_args} args EOT; } else { $args = '—' ; } // ----------------------------------------------------------------- $rows .= << Args: {$args} EOT; // ----------------------------------------------------------------- echo << {$rows}
\n EOT; // ----------------------------------------------------------------- } // --------------------------------------------------------------------- echo << function greatKiwi_byFernTec_adSwapper_local_v0x1x210_testDebug_toggleArgs( number_on_page , depth ) { var id = 'greatKiwi_byFernTec_adSwapper_local_v0x1x210_testDebug_args_' + number_on_page + '_' + depth ; var el = document.getElementById( id ) ; if ( el.style.display === 'none' ) { el.style.display = '' ; } else { el.style.display = 'none' ; } } EOT; return ; // --------------------------------------------------------------------- // Original version // --------------------------------------------------------------------- // --------------------------------------------------------------------- // From:- // http://web.enavu.com/tutorials/the-css-pre-wrap-trick/ // pre { // white-space: pre-wrap; /* css-3 */ // white-space: -pre-wrap; /* Opera 4-6 */ // white-space: -o-pre-wrap; /* Opera 7 */ // word-wrap: break-word; /* Internet Explorer 5+ */ // white-space: -moz-pre-wrap; /* Older Versions of Mozilla */ // } // --------------------------------------------------------------------- $pre_style = <<' ; } else { echo '

' , $title , '

' ;
        }
        ob_start() ;
            \debug_print_backtrace() ;
        echo str_replace( "\n" , "\n\n" , ob_get_clean() ) ;
        echo '
' ; // --------------------------------------------------------------------- } // ------------------------------------------------------------------------- function dpbt( $title = NULL ) { debug_print_backtrace( $title ) ; } // ============================================================================= // echo_list() // ============================================================================= function echo_list( $numeric_array , $title = NULL ) { if ( is_string( $title ) && trim( $title ) !== '' ) { echo '

' , $title , '

' ; } echo '
' ;

    if ( count( $numeric_array ) === 0 ) {
        echo 'array()' ;

    } else {

        foreach ( $numeric_array as $this_entry ) {
            if ( trim( $this_entry ) === '' ) {
                echo '<empty>' ;
            } else {
                echo $this_entry ;
            }
            echo "\n" ;
        }

    }

    echo '
' ; } // ============================================================================= // echo_key_list() // echo_keyed_list() // ============================================================================= function echo_key_list( $numeric_array , $title = NULL ) { if ( is_string( $title ) && trim( $title ) !== '' ) { echo '

' , $title , '

' ; } if ( count( $numeric_array ) === 0 ) { echo 'array()

' ; } else { $rows = '' ; foreach ( $numeric_array as $name => $value ) { $rows .= <<{$name} :   {$value} EOT; } echo <<{$rows} EOT; } } function echo_keyed_list( $numeric_array , $title = NULL ) { echo_key_list( $numeric_array , $title ) ; } // ============================================================================= // That's that! // =============================================================================