diff --git a/common/functions.php b/common/functions.php index 046586c75..80a9dfbc4 100644 --- a/common/functions.php +++ b/common/functions.php @@ -616,7 +616,11 @@ function is_html_content($str) { return true; } - + $span_tag_count = preg_match_all('!]*?">.+?!i', $str); + if ($span_tag_count >= 1) + { + return true; + } return false; } diff --git a/tests/unit/functions/FunctionsTest.php b/tests/unit/functions/FunctionsTest.php index 8c5755435..03fdc20da 100644 --- a/tests/unit/functions/FunctionsTest.php +++ b/tests/unit/functions/FunctionsTest.php @@ -176,6 +176,8 @@ class FunctionsTest extends \Codeception\TestCase\Test $this->assertTrue(is_html_content("Hello
\nWorld")); $this->assertTrue(is_html_content("

Hello

\n

World

")); $this->assertTrue(is_html_content("
Hello
\r\n\n\n\n\nWorld
")); + $this->assertTrue(is_html_content('This is italic text.')); + $this->assertFalse(is_html_content('This is an empty tag. Most editors don\'t produce these.')); $this->assertFalse(is_html_content("You have to use a

tag.")); $this->assertFalse(is_html_content("This is multiline content.\n

tag is here.\nOther lines are here, too.
\nMost lines don't have any tags.")); $this->assertFalse(is_html_content("

tag is unbalanced here.\nAnother line!
\nAnd a dangling line..."));