diff options
Diffstat (limited to 'includes/smilies.php')
| -rwxr-xr-x | includes/smilies.php | 35 |
1 files changed, 31 insertions, 4 deletions
| diff --git a/includes/smilies.php b/includes/smilies.php index f9ffde8..e189ad6 100755 --- a/includes/smilies.php +++ b/includes/smilies.php | |||
| @@ -37,7 +37,7 @@ class Smilies | |||
| 37 | $this->init = true; | 37 | $this->init = true; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | function parseSmilies($text) | 40 | function parseSmiliesFirstPass($text) |
| 41 | { | 41 | { |
| 42 | if (!$this->init) | 42 | if (!$this->init) |
| 43 | { | 43 | { |
| @@ -46,14 +46,29 @@ class Smilies | |||
| 46 | 46 | ||
| 47 | foreach ($this->smilies as $name => $value) | 47 | foreach ($this->smilies as $name => $value) |
| 48 | { | 48 | { |
| 49 | $text = str_replace($name, '<img src="http://fourisland.com/theme/images/smilies/' . $value . '" alt="' . $name . '" />', $text); | 49 | $text = str_replace($name, '[emoticon]' . $name . '[/emoticon]', $text); |
| 50 | } | ||
| 51 | |||
| 52 | return $text; | ||
| 53 | } | ||
| 54 | |||
| 55 | function parseSmiliesSecondPass($text) | ||
| 56 | { | ||
| 57 | if (!$this->init) | ||
| 58 | { | ||
| 59 | $this->init(); | ||
| 60 | } | ||
| 61 | |||
| 62 | foreach ($this->smilies as $name => $value) | ||
| 63 | { | ||
| 64 | $text = str_replace('[emoticon]' . $name . '[/emoticon]', '<img src="/theme/images/smilies/' . $value . '" alt="' . $name . '" />', $text); | ||
| 50 | } | 65 | } |
| 51 | 66 | ||
| 52 | return $text; | 67 | return $text; |
| 53 | } | 68 | } |
| 54 | } | 69 | } |
| 55 | 70 | ||
| 56 | function parseSmilies($text) | 71 | function parseSmiliesFirstPass($text) |
| 57 | { | 72 | { |
| 58 | global $smilies; | 73 | global $smilies; |
| 59 | if (!isset($smilies)) | 74 | if (!isset($smilies)) |
| @@ -61,7 +76,19 @@ function parseSmilies($text) | |||
| 61 | $smilies = new Smilies(); | 76 | $smilies = new Smilies(); |
| 62 | } | 77 | } |
| 63 | 78 | ||
| 64 | return $smilies->parseSmilies($text); | 79 | return $smilies->parseSmiliesFirstPass($text); |
| 65 | } | 80 | } |
| 66 | 81 | ||
| 82 | function parseSmiliesSecondPass($text) | ||
| 83 | { | ||
| 84 | global $smilies; | ||
| 85 | if (!isset($smilies)) | ||
| 86 | { | ||
| 87 | $smilies = new Smilies(); | ||
| 88 | } | ||
| 89 | |||
| 90 | return $smilies->parseSmiliesSecondPass($text); | ||
| 91 | } | ||
| 92 | |||
| 93 | |||
| 67 | ?> | 94 | ?> |
