1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Link words cleanup and compatibility for custom-fields (textarea/bbarea)

This commit is contained in:
Cameron 2019-04-25 13:29:00 -07:00
parent e3fcbabe56
commit 1c168aefa1
2 changed files with 9 additions and 4 deletions

View File

@ -220,7 +220,7 @@
case "textarea": case "textarea":
case "bbarea": case "bbarea":
return $tp->toHTML($value, true); return $tp->toHTML($value, true, "BODY");
break; break;

View File

@ -50,6 +50,7 @@ class e_tohtml_linkwords
protected $customClass = ''; protected $customClass = '';
protected $wordCount = array(); protected $wordCount = array();
protected $word_limit = array();
// protected $maxPerWord = 3; // protected $maxPerWord = 3;
@ -119,7 +120,7 @@ class e_tohtml_linkwords
while($row = $link_sql->fetch()) while($row = $link_sql->fetch())
{ {
$lw = $tp->uStrToLower($row['linkword_word']); // It was trimmed when saved *utf $lw = $tp->ustrtolower($row['linkword_word']); // It was trimmed when saved *utf
if($row['linkword_active'] == 2) if($row['linkword_active'] == 2)
{ {
@ -208,7 +209,11 @@ class e_tohtml_linkwords
} }
if (!$this->lw_enabled || empty($this->area_opts) || !array_key_exists($area,$this->area_opts) || !$this->area_opts[$area]) return $text; // No linkwords in disabled areas if (!$this->lw_enabled || empty($this->area_opts) || !array_key_exists($area,$this->area_opts) || !$this->area_opts[$area])
{
// e107::getDebug()->log("Link words skipped on ".substr($text, 0, 50));
return $text; // No linkwords in disabled areas
}
// Split up by HTML tags and process the odd bits here // Split up by HTML tags and process the odd bits here
$ptext = ""; $ptext = "";
@ -346,7 +351,7 @@ class e_tohtml_linkwords
foreach ($split_line as $count=>$sl) foreach ($split_line as $count=>$sl)
{ {
if ($tp->uStrToLower($sl) == $lw && $this->wordCount[$hash] < $this->word_limit[$first]) // Do linkword replace // We know the linkword is already lower case // *utf if ($tp->ustrtolower($sl) == $lw && $this->wordCount[$hash] < $this->word_limit[$first]) // Do linkword replace // We know the linkword is already lower case // *utf
{ {
$this->wordCount[$hash]++; $this->wordCount[$hash]++;