Skip to content

Commit

Permalink
Improvements #503
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Sep 7, 2014
1 parent ed6b6cd commit 2d357c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
6 changes: 6 additions & 0 deletions lhc_web/design/defaulttheme/tpl/lhbbcode/smiley.tpl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<img alt=":)" src="<?php echo erLhcoreClassDesign::design('images/smileys/emoticon_smile.png')?>" />||
<img alt=":D:" src="<?php echo erLhcoreClassDesign::design('images/smileys/emoticon_happy.png')?>" />||
<img alt=":(" src="<?php echo erLhcoreClassDesign::design('images/smileys/emoticon_unhappy.png')?>" />||
<img alt=":o:" src="<?php echo erLhcoreClassDesign::design('images/smileys/emoticon_surprised.png')?>" />||
<img alt=":p:" src="<?php echo erLhcoreClassDesign::design('images/smileys/emoticon_tongue.png')?>" />||
<img alt=";)" src="<?php echo erLhcoreClassDesign::design('images/smileys/emoticon_wink.png')?>" />
22 changes: 15 additions & 7 deletions lhc_web/lib/core/lhbbcode/lhbbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ public static function _make_url_clickable_cb($matches) {
return $matches[1] . "<a href=\"$url\" class=\"link\" target=\"_blank\">$url</a>" . $suffix;
}

private static $outArray = null;

public static function getOutArray() {

if (self::$outArray == null) {
$tpl = new erLhcoreClassTemplate();
$smileys = explode('||', $tpl->fetch('lhbbcode/smiley.tpl.php'));
self::$outArray = $smileys;
}

return self::$outArray;
}

public static function BBCode2Html($text) {
$text = trim($text);

Expand All @@ -35,13 +48,8 @@ public static function BBCode2Html($text) {
);

// And replace them by...
$out = array( '<img alt=":)" src="'.erLhcoreClassDesign::design('images/smileys/emoticon_smile.png').'" />',
'<img alt=":D:" src="'.erLhcoreClassDesign::design('images/smileys/emoticon_happy.png').'" />',
'<img alt=":(" src="'.erLhcoreClassDesign::design('images/smileys/emoticon_unhappy.png').'" />',
'<img alt=":o:" src="'.erLhcoreClassDesign::design('images/smileys/emoticon_surprised.png').'" />',
'<img alt=":p:" src="'.erLhcoreClassDesign::design('images/smileys/emoticon_tongue.png').'" />',
'<img alt=";)" src="'.erLhcoreClassDesign::design('images/smileys/emoticon_wink.png').'" />'
);
$out = self::getOutArray();

$text = str_replace($in, $out, $text);

// BBCode to find...
Expand Down

0 comments on commit 2d357c4

Please sign in to comment.