1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-10 00:27:45 +02:00

Shortcode tests for list_new, pm, rss_menu, signin and simpleParse()

This commit is contained in:
Cameron
2021-01-08 17:00:23 -08:00
parent d86d8d999f
commit c8ba5fe30a
11 changed files with 363 additions and 396 deletions

View File

@@ -929,7 +929,7 @@ class e_parse extends e_parser
//return ($this->replaceVars[$key] !== null ? $this->replaceVars[$key]: $unset);
}
$key = $tmp[1]; // PHP7 fix.
return ($this->replaceVars->$key !== null ? $this->replaceVars->$key : $unset); // Doesn't work.
return (!empty($this->replaceVars) && ($this->replaceVars->$key !== null)) ? $this->replaceVars->$key : $unset; // Doesn't work.
}
@@ -6060,12 +6060,19 @@ class e_emotefilter
class e_profanityFilter
{
protected $profanityList;
private $pref;
public function __construct()
{
global $pref;
$words = explode(',', $pref['profanity_words']);
$this->pref = e107::getPref();
if(empty($this->pref['profanity_words']))
{
return null;
}
$words = explode(',', $this->pref['profanity_words']);
$word_array = array();
foreach($words as $word)
{
@@ -6089,14 +6096,15 @@ class e_profanityFilter
public function filterProfanities($text)
{
global $pref;
if (!$this->profanityList)
if (empty($this->profanityList))
{
return $text;
}
if ($pref['profanity_replace'])
if(!empty($this->pref['profanity_replace']))
{
return preg_replace("#\b".$this->profanityList."\b#is", $pref['profanity_replace'], $text);
return preg_replace("#\b".$this->profanityList."\b#is", $this->pref['profanity_replace'], $text);
}
return preg_replace_callback("#\b".$this->profanityList."\b#is", array($this, 'replaceProfanities'), $text);