4676 | | ?> |
| 4676 | /** |
| 4677 | * Return a comma seperated string of functions that have been called to get to the current point in code. |
| 4678 | * |
| 4679 | * @since 3.4 |
| 4680 | */ |
| 4681 | function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0 ) { |
| 4682 | // TODO: Maybe add version based switching for even less backtrace info |
| 4683 | $trace = debug_backtrace( false ); |
| 4684 | $caller = array(); |
| 4685 | $check_class = ! is_null( $ignore_class ); |
| 4686 | $skip_frames++; // skip this function |
| 4687 | |
| 4688 | foreach ( $trace as $call ) { |
| 4689 | if ( $skip_frames > 0 ) { |
| 4690 | $skip_frames--; |
| 4691 | } elseif ( isset( $call['class'] ) ) { |
| 4692 | if ( $check_class && $ignore_class == $call['class'] ) |
| 4693 | continue; // Filter out calls |
| 4694 | |
| 4695 | $caller[] = "{$call['class']}{$call['type']}{$call['function']}"; |
| 4696 | } else { |
| 4697 | if ( in_array( $call['function'], array( 'do_action', 'apply_filters' ) ) ) { |
| 4698 | $caller[] = "{$call['function']}('{$call['args'][0]}')"; |
| 4699 | } elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ) ) ) { |
| 4700 | $caller[] = $call['function'] . "('" . str_replace( array( WP_CONTENT_DIR, ABSPATH ) , '', $call['args'][0] ) . "')"; |
| 4701 | } else { |
| 4702 | $caller[] = $call['function']; |
| 4703 | } |
| 4704 | } |
| 4705 | } |
| 4706 | |
| 4707 | return join( ', ', array_reverse( $caller ) ); |
| 4708 | |
| 4709 | } |
| 4710 | |
| 4711 | ?> |
| 4712 | No newline at end of file |