summaryrefslogtreecommitdiffstats
path: root/chat/lib/class
diff options
context:
space:
mode:
authorPhilip Nicolcev <frugen@gmail.com>2013-11-01 12:13:04 -0700
committerPhilip Nicolcev <frugen@gmail.com>2013-11-01 12:13:04 -0700
commit826f450ed2645303678c694450b19ccffce004d7 (patch)
treeb655f0df725507a280979b6fef7f40578d38175e /chat/lib/class
parent1c6f7f9219cacfbd5540259f1b653a0d48696850 (diff)
parent8ff9a69061e2f5e517434262fd1858be517ec524 (diff)
downloadAJAX-Chat-826f450ed2645303678c694450b19ccffce004d7.zip
AJAX-Chat-826f450ed2645303678c694450b19ccffce004d7.tar.gz
AJAX-Chat-826f450ed2645303678c694450b19ccffce004d7.tar.bz2
Merge pull request #99 from JanKroepke/patch-1
Change preg_replace to preg_replace_callback
Diffstat (limited to 'chat/lib/class')
-rw-r--r--chat/lib/class/AJAXChatTemplate.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/chat/lib/class/AJAXChatTemplate.php b/chat/lib/class/AJAXChatTemplate.php
index 5eca656..0797383 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();
@@ -174,7 +174,7 @@ class AJAXChatTemplate {
return 'write_allowed';
default:
- return $this->ajaxChat->replaceCustomTemplateTags($tag, $tagContent);
+ return $this->ajaxChat->replaceCustomTemplateTags($tagData[1], $tagData[2]);
}
}