From 4cfededa0d8e45bc5c4a95fa3499c757e130b38b Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 23 Mar 2008 16:51:55 +0000 Subject: [PATCH] MDL-14029 html2text throws tons of notices is style or script tags found; merged from MOODLE_19_STABLE --- lib/html2text.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/html2text.php b/lib/html2text.php index 13181bdf96..42c05565ff 100644 --- a/lib/html2text.php +++ b/lib/html2text.php @@ -45,12 +45,10 @@ function html2text( $badStr ) { switch ( $chr ) { case '<': if ( !$is_open_tb && strtolower( substr( $badStr, $x + 1, 5 ) ) == 'style' ) { - $badStr = substr( $badStr, 0, $x ) . - substr( $badStr, strpos( strtolower( $badStr ), '', $x ) + 7 ); + $x = strpos( strtolower( $badStr ), '', $x ) + 7; // Moodle $chr = ''; } else if ( !$is_open_tb && strtolower( substr( $badStr, $x + 1, 6 ) ) == 'script' ) { - $badStr = substr( $badStr, 0, $x ) . - substr( $badStr, strpos( strtolower( $badStr ), '', $x ) + 8 ); + $x = strpos( strtolower( $badStr ), '', $x ) + 8; // Moodle $chr = ''; } else if (!$is_open_tb) { $is_open_tb = true; @@ -125,7 +123,7 @@ function html2text( $badStr ) { $goodStr = preg_replace( "/<(ul|ol|br|dl|dt|table|caption|\/textarea|tr[^>]*>\s*<(td|th))[^>]*>/i", "\n", $goodStr ); - $goodStr = preg_replace( "/]*>/i", "\n· ", $goodStr ); + $goodStr = preg_replace( "/]*>/i", "\n� ", $goodStr ); $goodStr = preg_replace( "/]*>/i", "\n\t", $goodStr ); -- 2.39.5