mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Fix for texts containing only one emoticon. Cleanup of some debug reporting.
This commit is contained in:
@@ -4376,7 +4376,8 @@ class e107
|
|||||||
if(null === self::$_instance) return;
|
if(null === self::$_instance) return;
|
||||||
|
|
||||||
$print = defined('E107_DBG_TIMEDETAILS') && E107_DBG_TIMEDETAILS;
|
$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);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $name => $value)
|
foreach ($vars as $name => $value)
|
||||||
{
|
{
|
||||||
@@ -4384,10 +4385,10 @@ class e107
|
|||||||
{
|
{
|
||||||
if(method_exists($value, '__destruct'))
|
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();
|
$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;
|
$this->$name = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4397,14 +4398,21 @@ class e107
|
|||||||
{
|
{
|
||||||
if(method_exists($reg, '__destruct'))
|
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();
|
$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]);
|
unset(self::$_registry[$path]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($print)
|
||||||
|
{
|
||||||
|
echo "</table>";
|
||||||
|
}
|
||||||
|
|
||||||
self::$_registry = null;
|
self::$_registry = null;
|
||||||
self::$_instance = null;
|
self::$_instance = null;
|
||||||
}
|
}
|
||||||
|
@@ -4620,6 +4620,8 @@ class e_emotefilter
|
|||||||
private $search;
|
private $search;
|
||||||
private $replace;
|
private $replace;
|
||||||
public $emotes;
|
public $emotes;
|
||||||
|
private $singleSearch;
|
||||||
|
private $singleReplace;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
@@ -4666,8 +4668,6 @@ class e_emotefilter
|
|||||||
foreach($tmp as $code)
|
foreach($tmp as $code)
|
||||||
{
|
{
|
||||||
$img = "<img class='e-emoticon' src='".$fileloc."' alt=\"".$alt."\" />";
|
$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->search[] = "\n".$code;
|
||||||
$this->replace[] = "\n".$img;
|
$this->replace[] = "\n".$img;
|
||||||
@@ -4678,8 +4678,9 @@ class e_emotefilter
|
|||||||
$this->search[] = ">".$code; // Fix for emote within html.
|
$this->search[] = ">".$code; // Fix for emote within html.
|
||||||
$this->replace[] = ">".$img;
|
$this->replace[] = ">".$img;
|
||||||
|
|
||||||
// $this->search[] = $code."<"; // Fix for emote within html.
|
$this->singleSearch[] = $code;
|
||||||
// $this->replace[] = $img."<";
|
$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)
|
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);
|
return str_replace($this->search, $this->replace, $text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user