diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 16f626778..701fb9d0d 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -4615,12 +4615,13 @@ return $html; -class e_emotefilter { - var $search; - var $replace; - var $emotes; +class e_emotefilter +{ + private $search; + private $replace; + private $emotes; - function __construct() /* constructor */ + function __construct() { $pref = e107::getPref(); @@ -4633,28 +4634,46 @@ class e_emotefilter { $this->emotes = e107::getConfig("emote")->getPref(); - if(!vartrue($this->emotes)) + if(empty($this->emotes)) { return; } foreach($this->emotes as $key => $value) { + $value = trim($value); if ($value) { // Only 'activate' emote if there's a substitution string set + + $key = preg_replace("#!(\w{3,}?)$#si", ".\\1", $key); // Next two probably to sort out legacy issues - may not be required any more - $key = preg_replace("#_(\w{3})$#", ".\\1", $key); - $key = str_replace("!", "_", $key); + // $key = preg_replace("#_(\w{3})$#", ".\\1", $key); + + $key = str_replace("!", "_", $key); $filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key; $fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key; + $alt = str_replace(array('.png','.gif', '.jpg'),'', $key); + if(file_exists($filename)) { + $tmp = explode(" ", $value); + foreach($tmp as $code) + { + $img = "\"".$alt."\""; + $this->regSearch[] = "/(^|[\s>])(".quotemeta($code).")($|[\s<])/"; + $this->regReplace[] ="$1".$img."$3"; + $this->search[] = $code; + $this->replace[] = $img; + } + + + /* if(strstr($value, " ")) { $tmp = explode(" ", $value); @@ -4662,9 +4681,9 @@ class e_emotefilter { { $this->search[] = " ".$code; $this->search[] = "\n".$code; - //TODO CSS class? - $this->replace[] = " "; - $this->replace[] = "\n "; + + $this->replace[] = " \"".$alt."\" "; + $this->replace[] = "\n \"".$alt."\" "; } unset($tmp); } @@ -4674,32 +4693,36 @@ class e_emotefilter { { $this->search[] = " ".$value; $this->search[] = "\n".$value; - //TODO CSS class? - $this->replace[] = " "; - $this->replace[] = "\n "; + + $this->replace[] = " \"".$alt."\" "; + $this->replace[] = "\n \"".$alt."\" "; } - } + }*/ } } else { unset($this->emotes[$key]); } + + } + + } function filterEmotes($text) - { - $text = str_replace($this->search, $this->replace, $text); - return $text; + { + return preg_replace($this->regSearch,$this->regReplace,$text); + //$text = str_replace($this->search, $this->replace, $text); + //return $text; } function filterEmotesRev($text) { - $text = str_replace($this->replace, $this->search, $text); - return $text; + return str_replace($this->replace, $this->search, $text); } } diff --git a/e107_web/css/e107.css b/e107_web/css/e107.css index 22a676d09..6c95b309f 100644 --- a/e107_web/css/e107.css +++ b/e107_web/css/e107.css @@ -321,4 +321,7 @@ optgroup.level-5 { padding-left:4em } .online-menu-extended li, .online-menu li ul li { min-height: 40px; padding-top:8px} .online-menu-extended ul { padding-bottom:20px} .online-menu-extended span.online-menu-user { display:block; font-size:1.1em;margin-top:4px; line-height:1} -.online-menu-extended-label { font-size:1.2em; } \ No newline at end of file +.online-menu-extended-label { font-size:1.2em; } + +/* Emoticons */ +img.e-emoticon { vertical-align:middle; border:0; width:24px } \ No newline at end of file