mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Also use the <span> tag to determine whether an editor was used
This commit is contained in:
parent
3c772bf1cf
commit
2a023f0854
2 changed files with 7 additions and 1 deletions
|
|
@ -616,7 +616,11 @@ function is_html_content($str)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
$span_tag_count = preg_match_all('!<span\s+style="[^"<>]*?">.+?</span>!i', $str);
|
||||||
|
if ($span_tag_count >= 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,8 @@ class FunctionsTest extends \Codeception\TestCase\Test
|
||||||
$this->assertTrue(is_html_content("Hello<br />\nWorld"));
|
$this->assertTrue(is_html_content("Hello<br />\nWorld"));
|
||||||
$this->assertTrue(is_html_content("<p class='foo'>Hello</p>\n<p class='bar'>World</p>"));
|
$this->assertTrue(is_html_content("<p class='foo'>Hello</p>\n<p class='bar'>World</p>"));
|
||||||
$this->assertTrue(is_html_content("<div>Hello<br>\r\n\n\n\n\nWorld</div>"));
|
$this->assertTrue(is_html_content("<div>Hello<br>\r\n\n\n\n\nWorld</div>"));
|
||||||
|
$this->assertTrue(is_html_content('This is <span style="font-style:italic">italic</span> text.'));
|
||||||
|
$this->assertFalse(is_html_content('This is an empty <span></span> tag. Most editors don\'t produce these.'));
|
||||||
$this->assertFalse(is_html_content("You have to use a <p> tag."));
|
$this->assertFalse(is_html_content("You have to use a <p> tag."));
|
||||||
$this->assertFalse(is_html_content("This is multiline content.\n<p> tag is here.\nOther lines are here, too.<br>\nMost lines don't have any tags."));
|
$this->assertFalse(is_html_content("This is multiline content.\n<p> tag is here.\nOther lines are here, too.<br>\nMost lines don't have any tags."));
|
||||||
$this->assertFalse(is_html_content("<p> tag is unbalanced here.\nAnother line!<br />\nAnd a dangling line..."));
|
$this->assertFalse(is_html_content("<p> tag is unbalanced here.\nAnother line!<br />\nAnd a dangling line..."));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue