Stop fatal error in post revisions when setting the include path is disabled. Props santosj, for 2.7

git-svn-id: https://develop.svn.wordpress.org/trunk@8562 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2008-08-05 23:56:52 +00:00
parent 17bc095dd1
commit b07aca4429
2 changed files with 17 additions and 6 deletions

View File

@@ -1527,13 +1527,12 @@ if ( !function_exists( 'wp_text_diff' ) ) :
* @return string Empty string if strings are equivalent or HTML with differences.
*/
function wp_text_diff( $left_string, $right_string, $args = null ) {
if ( defined( 'WP_INCLUDE_PATH_DISABLED' ) )
return '';
$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 +1551,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 '';