Followup r78924: keep track of exception/warning comments separately, to prevent...
[lhc/web/wiklou.git] / includes / DjVuImage.php
index 330fe4a..a55017e 100644 (file)
@@ -249,7 +249,7 @@ class DjVuImage {
                        $cmd = wfEscapeShellArg( $wgDjvuTxt ) . ' --detail=page ' . wfEscapeShellArg( $this->mFilename ) ;
                        wfDebug( __METHOD__.": $cmd\n" );
                        $retval = '';
-                       $txt = wfShellExec( $cmd, &$retval );
+                       $txt = wfShellExec( $cmd, $retval );
                        wfProfileOut( 'djvutxt' );
                        if( $retval == 0) {
                                # Get rid of invalid UTF-8, strip control characters
@@ -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
         */