http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90520

Revision: 90520
Author:   nad
Date:     2011-06-21 10:52:21 +0000 (Tue, 21 Jun 2011)
Log Message:
-----------
dollarsigns in inputs were confusing regular expressions when saving forms from 
edit view

Modified Paths:
--------------
    trunk/extensions/RecordAdmin/RecordAdmin.php
    trunk/extensions/RecordAdmin/RecordAdmin_body.php

Modified: trunk/extensions/RecordAdmin/RecordAdmin.php
===================================================================
--- trunk/extensions/RecordAdmin/RecordAdmin.php        2011-06-21 10:49:52 UTC 
(rev 90519)
+++ trunk/extensions/RecordAdmin/RecordAdmin.php        2011-06-21 10:52:21 UTC 
(rev 90520)
@@ -10,7 +10,7 @@
  * @author Siebrand Mazeland
  * @licence GNU General Public Licence 2.0 or later
  */
-define( 'RECORDADMIN_VERSION', '1.2.4, 2011-06-21' );
+define( 'RECORDADMIN_VERSION', '1.2.5, 2011-06-21' );
 
 $dir = dirname( __FILE__ ) . '/';
 $wgExtensionMessagesFiles['RecordAdmin'] = $dir . 'RecordAdmin.i18n.php';

Modified: trunk/extensions/RecordAdmin/RecordAdmin_body.php
===================================================================
--- trunk/extensions/RecordAdmin/RecordAdmin_body.php   2011-06-21 10:49:52 UTC 
(rev 90519)
+++ trunk/extensions/RecordAdmin/RecordAdmin_body.php   2011-06-21 10:52:21 UTC 
(rev 90520)
@@ -171,10 +171,10 @@
                        $template = "<noinclude>" . $this->valuesToText( $type, 
$values ) . "</noinclude>";
 
                        # Replace any instance of the template in the text with 
the new parameters
-                       $text = preg_replace( "|\{\{$type\}\}|", $template, 
$text, -1, $count );
+                       $text = str_replace( '{{' . $type . '}}', $template, 
$text, $count );
 
                        # If there were no matches, prepend it (either its 
newly added, or is a prepended one)
-                       if( $count == 0) $text = "$template\n$text";
+                       if( $count == 0 ) $text = "$template\n$text";
 
                }
 
@@ -598,7 +598,7 @@
 
                        # Modify the element according to its type
                        # - clears default value, then adds new value
-                       $v = isset( $values[$k] ) ? $values[$k] : '';
+                       $v = str_replace( '$', '\$', isset( $values[$k] ) ? 
$values[$k] : '' );
                        switch ( $type ) {
                                case 'text':
                                        $html = preg_replace( 
"|value\s*=\s*\".*?\"|i", "", $html );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to