|
@@ -33,27 +33,45 @@ class Debug_Bar_Deprecated extends Debug_Bar_Panel {
|
|
echo '<h2><span>Total Files:</span>' . number_format( count( $this->deprecated_files ) ) . "</h2>\n";
|
|
echo '<h2><span>Total Files:</span>' . number_format( count( $this->deprecated_files ) ) . "</h2>\n";
|
|
if ( count( $this->deprecated_functions ) ) {
|
|
if ( count( $this->deprecated_functions ) ) {
|
|
echo '<ol class="debug-bar-deprecated-list">';
|
|
echo '<ol class="debug-bar-deprecated-list">';
|
|
- foreach ( $this->deprecated_functions as $location => $message)
|
|
|
|
- echo "<li class='debug-bar-deprecated-function'>".str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message). "</li>";
|
|
|
|
|
|
+ foreach ( $this->deprecated_functions as $location => $message_stack) {
|
|
|
|
+ list( $message, $stack) = $message_stack;
|
|
|
|
+ echo "<li class='debug-bar-deprecated-function'>";
|
|
|
|
+ echo str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message);
|
|
|
|
+ echo "<br/>";
|
|
|
|
+ echo $stack;
|
|
|
|
+ echo "</li>";
|
|
|
|
+ }
|
|
echo '</ol>';
|
|
echo '</ol>';
|
|
}
|
|
}
|
|
if ( count( $this->deprecated_files ) ) {
|
|
if ( count( $this->deprecated_files ) ) {
|
|
echo '<ol class="debug-bar-deprecated-list">';
|
|
echo '<ol class="debug-bar-deprecated-list">';
|
|
- foreach ( $this->deprecated_files as $location => $message)
|
|
|
|
- echo "<li class='debug-bar-deprecated-function'>".str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message). "</li>";
|
|
|
|
|
|
+ foreach ( $this->deprecated_files as $location => $message_stack) {
|
|
|
|
+ list( $message, $stack) = $message_stack;
|
|
|
|
+ echo "<li class='debug-bar-deprecated-file'>";
|
|
|
|
+ echo str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message);
|
|
|
|
+ echo "<br/>";
|
|
|
|
+ echo $stack;
|
|
|
|
+ echo "</li>";
|
|
|
|
+ }
|
|
echo '</ol>';
|
|
echo '</ol>';
|
|
}
|
|
}
|
|
if ( count( $this->deprecated_arguments ) ) {
|
|
if ( count( $this->deprecated_arguments ) ) {
|
|
echo '<ol class="debug-bar-deprecated-list">';
|
|
echo '<ol class="debug-bar-deprecated-list">';
|
|
- foreach ( $this->deprecated_arguments as $location => $message)
|
|
|
|
- echo "<li class='debug-bar-deprecated-function'>".str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message). "</li>";
|
|
|
|
|
|
+ foreach ( $this->deprecated_arguments as $location => $message_stack) {
|
|
|
|
+ list( $message, $stack) = $message_stack;
|
|
|
|
+ echo "<li class='debug-bar-deprecated-argument'>";
|
|
|
|
+ echo str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message);
|
|
|
|
+ echo "<br/>";
|
|
|
|
+ echo $stack;
|
|
|
|
+ echo "</li>";
|
|
|
|
+ }
|
|
echo '</ol>';
|
|
echo '</ol>';
|
|
}
|
|
}
|
|
echo "</div>";
|
|
echo "</div>";
|
|
}
|
|
}
|
|
|
|
|
|
function deprecated_function_run($function, $replacement, $version) {
|
|
function deprecated_function_run($function, $replacement, $version) {
|
|
- $backtrace = debug_backtrace();
|
|
|
|
|
|
+ $backtrace = debug_backtrace( false );
|
|
$bt = 4;
|
|
$bt = 4;
|
|
// Check if we're a hook callback.
|
|
// Check if we're a hook callback.
|
|
if ( ! isset( $backtrace[4]['file'] ) && 'call_user_func_array' == $backtrace[5]['function'] ) {
|
|
if ( ! isset( $backtrace[4]['file'] ) && 'call_user_func_array' == $backtrace[5]['function'] ) {
|
|
@@ -66,11 +84,11 @@ class Debug_Bar_Deprecated extends Debug_Bar_Panel {
|
|
else
|
|
else
|
|
$message = sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'debug-bar'), $function, $version );
|
|
$message = sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'debug-bar'), $function, $version );
|
|
|
|
|
|
- $this->deprecated_functions[$file.':'.$line] = $message;
|
|
|
|
|
|
+ $this->deprecated_functions[$file.':'.$line] = array( $message, wp_debug_backtrace_summary( null, $bt ) );
|
|
}
|
|
}
|
|
|
|
|
|
function deprecated_file_included( $old_file, $replacement, $version, $message ) {
|
|
function deprecated_file_included( $old_file, $replacement, $version, $message ) {
|
|
- $backtrace = debug_backtrace();
|
|
|
|
|
|
+ $backtrace = debug_backtrace( false );
|
|
$file = $backtrace[4]['file'];
|
|
$file = $backtrace[4]['file'];
|
|
$file_abs = str_replace(ABSPATH, '', $file);
|
|
$file_abs = str_replace(ABSPATH, '', $file);
|
|
$line = $backtrace[4]['line'];
|
|
$line = $backtrace[4]['line'];
|
|
@@ -80,11 +98,16 @@ class Debug_Bar_Deprecated extends Debug_Bar_Panel {
|
|
else
|
|
else
|
|
$message = sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'debug-bar'), $file_abs, $version ) . $message;
|
|
$message = sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'debug-bar'), $file_abs, $version ) . $message;
|
|
|
|
|
|
- $this->deprecated_files[$file.':'.$line] = $message;
|
|
|
|
|
|
+ $this->deprecated_functions[$file.':'.$line] = array( $message, wp_debug_backtrace_summary( null, 4 ) );
|
|
}
|
|
}
|
|
|
|
|
|
function deprecated_argument_run( $function, $message, $version) {
|
|
function deprecated_argument_run( $function, $message, $version) {
|
|
- $backtrace = debug_backtrace();
|
|
|
|
|
|
+ $backtrace = debug_backtrace( false );
|
|
|
|
+ if ( $function === 'define()' ) {
|
|
|
|
+ $this->deprecated_functions[] = array( $message, '' );
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
$bt = 4;
|
|
$bt = 4;
|
|
if ( ! isset( $backtrace[4]['file'] ) && 'call_user_func_array' == $backtrace[5]['function'] ) {
|
|
if ( ! isset( $backtrace[4]['file'] ) && 'call_user_func_array' == $backtrace[5]['function'] ) {
|
|
$bt = 6;
|
|
$bt = 6;
|
|
@@ -92,6 +115,6 @@ class Debug_Bar_Deprecated extends Debug_Bar_Panel {
|
|
$file = $backtrace[ $bt ]['file'];
|
|
$file = $backtrace[ $bt ]['file'];
|
|
$line = $backtrace[ $bt ]['line'];
|
|
$line = $backtrace[ $bt ]['line'];
|
|
|
|
|
|
- $this->deprecated_arguments[$file.':'.$line] = $message;
|
|
|
|
|
|
+ $this->deprecated_functions[$file.':'.$line] = array( $message, wp_debug_backtrace_summary( null, $bt ) );
|
|
}
|
|
}
|
|
}
|
|
}
|