diff --git a/e107_plugins/linkwords/e_parse.php b/e107_plugins/linkwords/e_parse.php
index 8b222d8b0..b10e245dd 100644
--- a/e107_plugins/linkwords/e_parse.php
+++ b/e107_plugins/linkwords/e_parse.php
@@ -233,6 +233,7 @@ class linkwords_parse
// Split up by HTML tags and process the odd bits here
$ptext = "";
$lflag = FALSE;
+ $cflag = false; // commented code prsent.
// Shouldn't need utf-8 on next line - just looking for HTML tags
$content = preg_split('#(<.*?>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
@@ -241,12 +242,19 @@ class linkwords_parse
foreach($content as $cont)
{
+ if(strpos($cont, '-->') !== false)
+ {
+ $cflag = false; // end of commented code
+ $ptext .= $cont;
+ continue;
+ }
if ($cont[0] === "<") // Its some HTML
{
$ptext .= $cont;
- if (strpos($cont, "area_opts['TITLE'])) // disable linking on header tag content unless enabled in prefs.
{
@@ -263,7 +271,7 @@ class linkwords_parse
}
else // Its the text in between
{
- if ($lflag) // Its probably within a link - leave unchanged
+ if ($lflag || $cflag) // Its probably within a link - leave unchanged
{
$ptext .= $cont;
}
diff --git a/e107_tests/tests/unit/plugins/linkwords/e_tohtml_linkwordsTest.php b/e107_tests/tests/unit/plugins/linkwords/e_tohtml_linkwordsTest.php
index a4636ab28..0739ecad5 100644
--- a/e107_tests/tests/unit/plugins/linkwords/e_tohtml_linkwordsTest.php
+++ b/e107_tests/tests/unit/plugins/linkwords/e_tohtml_linkwordsTest.php
@@ -81,13 +81,22 @@
'text' => " body only text body only text body only text body only text body only textBody only title
Body only title
body only text
', + ), ); - foreach($tests as $val) + foreach($tests as $index => $val) { $result = $this->lw->toHTML($val['text'], 'BODY'); - $this->assertEquals($val['expected'],$result); + $this->assertEquals($val['expected'],$result, 'Test #'.$index.' failed. '); }