diff options
author | Jan Kröpke <info@2moons.cc> | 2013-08-08 15:34:53 +0200 |
---|---|---|
committer | Jan Kröpke <info@2moons.cc> | 2013-08-08 15:34:53 +0200 |
commit | 8ff9a69061e2f5e517434262fd1858be517ec524 (patch) | |
tree | b77d7ca24af55457168451bf1715f9fbc95c5fba /chat/lib/class | |
parent | a007fba0cd5d891d1d82474a49cd0842e924b5d8 (diff) | |
download | AJAX-Chat-8ff9a69061e2f5e517434262fd1858be517ec524.zip AJAX-Chat-8ff9a69061e2f5e517434262fd1858be517ec524.tar.gz AJAX-Chat-8ff9a69061e2f5e517434262fd1858be517ec524.tar.bz2 |
Change preg_replace to preg_replace_callback
As of PHP 5.5, the preg e modifier is deprecated and throw errors.
Diffstat (limited to 'chat/lib/class')
-rw-r--r-- | chat/lib/class/AJAXChatTemplate.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/chat/lib/class/AJAXChatTemplate.php b/chat/lib/class/AJAXChatTemplate.php index 6b28ea2..a6e97d1 100644 --- a/chat/lib/class/AJAXChatTemplate.php +++ b/chat/lib/class/AJAXChatTemplate.php @@ -20,7 +20,7 @@ class AJAXChatTemplate { // Constructor: function AJAXChatTemplate(&$ajaxChat, $templateFile, $contentType=null) { $this->ajaxChat = $ajaxChat; - $this->_regExpTemplateTags = '/\[(\w+?)(?:(?:\/)|(?:\](.+?)\[\/\1))\]/se'; + $this->_regExpTemplateTags = '/\[(\w+?)(?:(?:\/)|(?:\](.+?)\[\/\1))\]/s'; $this->_templateFile = $templateFile; $this->_contentType = $contentType; } @@ -52,16 +52,16 @@ class AJAXChatTemplate { } // Replace template tags ([TAG/] and [TAG]content[/TAG]) and return parsed template content: - $this->_parsedContent = preg_replace($this->_regExpTemplateTags, '$this->replaceTemplateTags(\'$1\', \'$2\')', $this->_parsedContent); + $this->_parsedContent = preg_replace_callback($this->_regExpTemplateTags, array($this, 'replaceTemplateTags'), $this->_parsedContent); } - function replaceTemplateTags($tag, $tagContent) { - switch($tag) { + function replaceTemplateTags($tagData) { + switch($tagData[1]) { case 'AJAX_CHAT_URL': return $this->ajaxChat->htmlEncode($this->ajaxChat->getChatURL()); case 'LANG': - return $this->ajaxChat->htmlEncode($this->ajaxChat->getLang($tagContent)); + return $this->ajaxChat->htmlEncode($this->ajaxChat->getLang($tagData[2])); case 'LANG_CODE': return $this->ajaxChat->getLangCode(); @@ -167,7 +167,7 @@ class AJAXChatTemplate { return $this->getLogsHourOptionTags(); default: - return $this->ajaxChat->replaceCustomTemplateTags($tag, $tagContent); + return $this->ajaxChat->replaceCustomTemplateTags($tagData[1], $tagData[2]); } } @@ -319,4 +319,4 @@ class AJAXChatTemplate { } } -?>
\ No newline at end of file +?> |