Permalink
Browse files

Merge branch 'MDL-29462_20' of git://github.com/timhunt/moodle into M…

…OODLE_20_STABLE
  • Loading branch information...
2 parents aa11496 + 8dce32b commit d2175fceaaf65f53d60d459b9b364176135383a7 @stronk7 stronk7 committed Sep 26, 2011
Showing with 24 additions and 1 deletion.
  1. +1 −1 lib/html2text.php
  2. +15 −0 lib/html2text_readme.txt
  3. +8 −0 lib/simpletest/testweblib.php
View
@@ -333,7 +333,7 @@ class html2text
*/
function html2text( $source = '', $from_file = false, $do_links = true, $width = 75 )
{
- if ( !empty($source) ) {
+ if ($source !== '') {
$this->set_html($source, $from_file);
}
View
@@ -53,3 +53,18 @@ Index: lib/html2text.php
}
-- Tim Hunt 2010-11-02
+
+4 - Make sure html2text does not destroy '0'.
+
+index e2d0dff..9cc213d 100644
+--- a/lib/html2text.php
++++ b/lib/html2text.php
+@@ -335,7 +335,7 @@ class html2text
+ */
+ function html2text( $source = '', $from_file = false, $do_links = true, $wi {
+- if ( !empty($source) ) {
++ if ($source !== '') {
+ $this->set_html($source, $from_file);
+ }
+
+-- Tim Hunt 2011-09-21
@@ -136,6 +136,14 @@ public function test_html_to_text_dont_screw_up_utf8() {
$this->assertEqual("\n\nAll the WORLD’S a stage.", html_to_text('<p>All the <strong>world’s</strong> a stage.</p>'));
}
+ public function test_html_to_text_trailing_whitespace() {
+ $this->assertEqual('With trailing whitespace and some more text', html_to_text("With trailing whitespace \nand some more text", 0));
+ }
+
+ public function test_html_to_text_0() {
+ $this->assertIdentical('0', html_to_text('0'));
+ }
+
public function test_clean_text() {
$text = "lala <applet>xx</applet>";
$this->assertEqual($text, clean_text($text, FORMAT_PLAIN));

0 comments on commit d2175fc

Please sign in to comment.