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

Revision: 91965
Author:   ialex
Date:     2011-07-12 14:32:10 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Preprocess the text in the current Parser instance instead of creating a new one

Modified Paths:
--------------
    trunk/extensions/RandomImageByCategory/RandomImageByCategory.php

Modified: trunk/extensions/RandomImageByCategory/RandomImageByCategory.php
===================================================================
--- trunk/extensions/RandomImageByCategory/RandomImageByCategory.php    
2011-07-12 14:29:31 UTC (rev 91964)
+++ trunk/extensions/RandomImageByCategory/RandomImageByCategory.php    
2011-07-12 14:32:10 UTC (rev 91965)
@@ -35,7 +35,7 @@
 }
 
 function getRandomImage( $input, $args, $parser ) {
-       global $wgOut, $wgMemc;
+       global $wgMemc;
 
        wfProfileIn( __METHOD__ );
 
@@ -60,8 +60,8 @@
        $image_list = array();
        if( !$data ) {
                wfDebug( "Getting random image list from DB\n" );
-               $p = new Parser();
-               $ctg = $p->transformMsg( $categories, $wgOut->parserOptions() );
+               $ctg = $parser->replaceVariables( $categories );
+               $ctg = $parser->mStripState->unstripBoth( $ctg );
                $ctg = str_replace( "\,", '#comma#', $ctg );
                $aCat = explode( ',', $ctg );
 
@@ -99,7 +99,7 @@
                $image_list = $data;
                wfDebug( "Cache hit for random image list\n" );
        }
-
+var_dump( $image_list );
        $random_image = '';
        $thumbnail = '';
        if( count( $image_list ) > 1 ) {
@@ -117,4 +117,4 @@
        wfProfileOut( __METHOD__ );
 
        return $thumbnail;
-}
\ No newline at end of file
+}


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to