mirror of
https://github.com/e107inc/e107.git
synced 2025-05-04 19:27:54 +02:00
Fix for texts containing only one emoticon. Cleanup of some debug reporting.
This commit is contained in:
parent
4160389303
commit
1c98913f62
@ -4376,7 +4376,8 @@ class e107
|
||||
if(null === self::$_instance) return;
|
||||
|
||||
$print = defined('E107_DBG_TIMEDETAILS') && E107_DBG_TIMEDETAILS;
|
||||
!$print || print('Destructing $e107: <br />');
|
||||
|
||||
!$print || print('<table class="table table-striped table-condensed"><tr><td colspan="3"><b>Destructing $e107</b></td></tr>');
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $name => $value)
|
||||
{
|
||||
@ -4384,10 +4385,10 @@ class e107
|
||||
{
|
||||
if(method_exists($value, '__destruct'))
|
||||
{
|
||||
!$print || print('object [property] using __destruct(): '.$path.' - '.get_class($value).'<br />');
|
||||
!$print || print('<tr><td>object [property] using __destruct()</td><td>'.$name.'</td><td>'.get_class($value).'</td></tr>');
|
||||
$value->__destruct();
|
||||
}
|
||||
else !$print || print('object [property]: '.$name.' - '.get_class($value).'<br />');
|
||||
else !$print || print('<tr><td>object [property]</td><td>'.$name.'</td><td>'.get_class($value).'</td></tr>');
|
||||
$this->$name = null;
|
||||
}
|
||||
}
|
||||
@ -4397,14 +4398,21 @@ class e107
|
||||
{
|
||||
if(method_exists($reg, '__destruct'))
|
||||
{
|
||||
!$print || print('object [registry] using __destruct(): '.$path.' - '.get_class($reg).'<br />');
|
||||
!$print || print('<tr><td>object [registry] using __destruct()</td><td>'.$path.'</td><td>'.get_class($reg).'</td></tr>');
|
||||
$reg->__destruct();
|
||||
}
|
||||
else !$print || print('object [registry]: '.$path.' - '.get_class($reg).'<br />');
|
||||
else !$print || print('<tr><td>object [registry]</td><td>'.$path.'</td><td>'.get_class($reg).'</td></tr>');
|
||||
unset(self::$_registry[$path]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($print)
|
||||
{
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
self::$_registry = null;
|
||||
self::$_instance = null;
|
||||
}
|
||||
|
@ -4620,6 +4620,8 @@ class e_emotefilter
|
||||
private $search;
|
||||
private $replace;
|
||||
public $emotes;
|
||||
private $singleSearch;
|
||||
private $singleReplace;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
@ -4666,8 +4668,6 @@ class e_emotefilter
|
||||
foreach($tmp as $code)
|
||||
{
|
||||
$img = "<img class='e-emoticon' src='".$fileloc."' alt=\"".$alt."\" />";
|
||||
// $this->regSearch[] = "#(^|[\s>])(".$this->buildRegex($code).")($|[\s<])#";
|
||||
// $this->regReplace[] ="$1".$img."$3";
|
||||
|
||||
$this->search[] = "\n".$code;
|
||||
$this->replace[] = "\n".$img;
|
||||
@ -4678,8 +4678,9 @@ class e_emotefilter
|
||||
$this->search[] = ">".$code; // Fix for emote within html.
|
||||
$this->replace[] = ">".$img;
|
||||
|
||||
// $this->search[] = $code."<"; // Fix for emote within html.
|
||||
// $this->replace[] = $img."<";
|
||||
$this->singleSearch[] = $code;
|
||||
$this->singleReplace[] = $img;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -4723,19 +4724,22 @@ class e_emotefilter
|
||||
|
||||
}
|
||||
|
||||
private function buildRegex($code)
|
||||
{
|
||||
|
||||
$code = quotemeta($code);
|
||||
$code = str_replace('|','\|',$code);
|
||||
return $code;
|
||||
}
|
||||
|
||||
|
||||
function filterEmotes($text)
|
||||
{
|
||||
// return preg_replace($this->regSearch,$this->regReplace,$text);
|
||||
|
||||
if(empty($text))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
if((strlen($text) < 12) && in_array($text, $this->singleSearch)) // just one emoticon with no space, line-break or html tags around it.
|
||||
{
|
||||
return str_replace($this->singleSearch,$this->singleReplace,$text);
|
||||
}
|
||||
|
||||
return str_replace($this->search, $this->replace, $text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user