From ea522c10c98f1c52d6e29607e1cbe6e350ad930a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 7 Aug 2008 21:02:07 +0000 Subject: [PATCH] Fix Text/Diff includes. Props codestyling. fixes #7391 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@8581 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/Text/Diff.php | 3 ++- wp-includes/Text/Diff/Renderer/inline.php | 4 +++- wp-includes/pluggable.php | 6 ------ wp-includes/wp-diff.php | 6 +++--- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/wp-includes/Text/Diff.php b/wp-includes/Text/Diff.php index f8a974c1c0..06d1c6c764 100644 --- a/wp-includes/Text/Diff.php +++ b/wp-includes/Text/Diff.php @@ -49,7 +49,8 @@ class Text_Diff { $engine = basename($engine); } - require_once 'Text/Diff/Engine/' . $engine . '.php'; + // WP #7391 + require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php'; $class = 'Text_Diff_Engine_' . $engine; $diff_engine = new $class(); diff --git a/wp-includes/Text/Diff/Renderer/inline.php b/wp-includes/Text/Diff/Renderer/inline.php index b547ff2362..1493eaa04e 100644 --- a/wp-includes/Text/Diff/Renderer/inline.php +++ b/wp-includes/Text/Diff/Renderer/inline.php @@ -14,7 +14,9 @@ */ /** Text_Diff_Renderer */ -require_once 'Text/Diff/Renderer.php'; + +// WP #7391 +require_once dirname(dirname(__FILE__)) . '/Renderer.php'; /** * "Inline" diff renderer. diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index b9409669a0..34d5b426e6 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1530,10 +1530,6 @@ function wp_text_diff( $left_string, $right_string, $args = null ) { $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' ); $args = wp_parse_args( $args, $defaults ); - // PEAR Text_Diff is lame; it includes things from include_path rather than it's own path. - // Not sure of the ramifications of disttributing modified code. - ini_set('include_path', '.' . PATH_SEPARATOR . ABSPATH . WPINC ); - if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) ) require( ABSPATH . WPINC . '/wp-diff.php' ); @@ -1552,8 +1548,6 @@ function wp_text_diff( $left_string, $right_string, $args = null ) { $renderer = new WP_Text_Diff_Renderer_Table(); $diff = $renderer->render($text_diff); - ini_restore('include_path'); - if ( !$diff ) return ''; diff --git a/wp-includes/wp-diff.php b/wp-includes/wp-diff.php index 77f3258123..e43903d80d 100644 --- a/wp-includes/wp-diff.php +++ b/wp-includes/wp-diff.php @@ -1,9 +1,9 @@