]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14029 html2text throws tons of notices is style or script tags found; merged...
authorskodak <skodak>
Sun, 23 Mar 2008 16:51:55 +0000 (16:51 +0000)
committerskodak <skodak>
Sun, 23 Mar 2008 16:51:55 +0000 (16:51 +0000)
lib/html2text.php

index 13181bdf96ddd983b77786e3fc262729f67d4d3d..42c05565ff3b17c279365d06dfdcfb20c10e428e 100644 (file)
@@ -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 ), '</style>', $x ) + 7 ); 
+                        $x = strpos( strtolower( $badStr ), '</style>', $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 ), '</script>', $x ) + 8 ); 
+                        $x = strpos( strtolower( $badStr ), '</script>', $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( "/<li[^>]*>/i", "\n· ", $goodStr );
+    $goodStr = preg_replace( "/<li[^>]*>/i", "\n ", $goodStr );
 
     $goodStr = preg_replace( "/<dd[^>]*>/i", "\n\t", $goodStr );