From 8af2db1892604414e9bd474892b0eaef86349f04 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Sat, 8 Oct 2016 07:00:05 -0700 Subject: [PATCH] Fully resolve `ABSPATH` --- inc/class-profiler.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/inc/class-profiler.php b/inc/class-profiler.php index 717f920..731b281 100644 --- a/inc/class-profiler.php +++ b/inc/class-profiler.php @@ -299,16 +299,17 @@ class Profiler { } if ( $reflection ) { $location = $reflection->getFileName() . ':' . $reflection->getStartLine(); + $abspath = rtrim( realpath( ABSPATH ), '/' ) . '/'; if ( 0 === stripos( $location, WP_PLUGIN_DIR ) ) { $location = str_replace( trailingslashit( WP_PLUGIN_DIR ), '', $location ); } else if ( 0 === stripos( $location, WPMU_PLUGIN_DIR ) ) { $location = str_replace( trailingslashit( dirname( WPMU_PLUGIN_DIR ) ), '', $location ); } else if ( 0 === stripos( $location, get_theme_root() ) ) { $location = str_replace( trailingslashit( get_theme_root() ), '', $location ); - } else if ( 0 === stripos( $location, ABSPATH . 'wp-admin/' ) ) { - $location = str_replace( ABSPATH, '', $location ); - } else if ( 0 === stripos( $location, ABSPATH . 'wp-includes/' ) ) { - $location = str_replace( ABSPATH, '', $location ); + } else if ( 0 === stripos( $location, $abspath . 'wp-admin/' ) ) { + $location = str_replace( $abspath, '', $location ); + } else if ( 0 === stripos( $location, $abspath . 'wp-includes/' ) ) { + $location = str_replace( $abspath, '', $location ); } } return array( $name, $location );