[Svn] r1660 - trunk/roundcubemail/program/include
trac at roundcube.net
trac at roundcube.net
Wed Aug 20 08:33:41 CEST 2008
Author: alec
Date: 2008-08-20 06:33:40 +0000 (Wed, 20 Aug 2008)
New Revision: 1660
Modified:
trunk/roundcubemail/program/include/rcube_template.php
Log:
#1485286: don't use /e modifier with preg_replace()
Modified: trunk/roundcubemail/program/include/rcube_template.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_template.php 2008-08-18 12:47:43 UTC (rev 1659)
+++ trunk/roundcubemail/program/include/rcube_template.php 2008-08-20 06:33:40 UTC (rev 1660)
@@ -484,11 +484,36 @@
*/
private function parse_xml($input)
{
- return preg_replace('/<roundcube:([-_a-z]+)\s+([^>]+)>/Uie', "\$this->xml_command('\\1', '\\2')", $input);
+ return preg_replace_callback('/<roundcube:([-_a-z]+)\s+([^>]+)>/Ui', array($this, 'xml_command_callback'), $input);
}
/**
+ * This is a callback function for preg_replace_callback (see #1485286)
+ * It's only purpose is to reconfigure parameters for xml_command, so that the signature isn't disturbed
+ */
+ private function xml_command_callback($matches)
+ {
+ if (isset($matches[2])) {
+ $str_attrib = $matches[2];
+ } else {
+ $str_attrib = '';
+ }
+
+ if (isset($matches[3])) {
+ $add_attrib = $matches[3];
+ } else {
+ $add_attrib = array();
+ }
+
+ $command = $matches[1];
+ //matches[0] is the entire matched portion of the string
+
+ return $this->xml_command($command, $str_attrib, $add_attrib);
+ }
+
+
+ /**
* Convert a xml command tag into real content
*
* @param string Tag command: object,button,label, etc.
_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn
More information about the Svn
mailing list