Fix for r69139: create_function() is not allowed.
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 8 Dec 2010 05:57:57 +0000 (05:57 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 8 Dec 2010 05:57:57 +0000 (05:57 +0000)
includes/DjVuImage.php

index c202024..a55017e 100644 (file)
@@ -266,10 +266,7 @@ class DjVuImage {
                                        | # Or page can be empty ; in this case, djvutxt dumps ()
                                        \(\s*()\)/sx
 EOR;
-                               $txt = preg_replace_callback( $reg,
-                                       create_function('$matches', 'return \'<PAGE value="\'.htmlspecialchars($matches[1]).\'" />\';'),
-                                       $txt );
-
+                               $txt = preg_replace_callback( $reg, array( $this, 'pageTextCallback' ), $txt );
                                $txt = "<DjVuTxt>\n<HEAD></HEAD>\n<BODY>\n" . $txt . "</BODY>\n</DjVuTxt>\n";
                                $xml = preg_replace( "/<DjVuXML>/", "<mw-djvu><DjVuXML>", $xml );
                                $xml = $xml . $txt. '</mw-djvu>' ;
@@ -278,6 +275,10 @@ EOR;
                return $xml;
        }
 
+       function pageTextCallback( $matches ) {
+               return '<PAGE value="' . htmlspecialchars( $matches[1] ) . '" />';
+       }
+
        /**
         * Hack to temporarily work around djvutoxml bug
         */