(bug 18880) Make LogEventsList::showLogExtract() more versatile by allowing it to...
authorHappy-melon <happy-melon@users.mediawiki.org>
Mon, 31 Aug 2009 11:54:53 +0000 (11:54 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Mon, 31 Aug 2009 11:54:53 +0000 (11:54 +0000)
RELEASE-NOTES
includes/LogEventsList.php

index aa149b0..d256afd 100644 (file)
@@ -199,6 +199,8 @@ this. Was used when mwEmbed was going to be an extension.
 * MakeSysop and MakeBot are now aliases for Special:UserRights
 * IndexPager->mLimitsShown can now be an associative array of limit => text-to-
   display-in-limit-form.
+* (bug 18880) LogEventsList::showLogExtract() can now take a string-by-reference
+  and add its HTML to it, rather than having to go straight to $wgOut.
 
 === Bug fixes in 1.16 ===
 
index d39842f..d6178ab 100644 (file)
@@ -557,28 +557,31 @@ class LogEventsList {
 
        /**
         * Quick function to show a short log extract
-        * @param $out OutputPage
+        * @param $out OutputPage or String-by-reference
         * @param $types String or Array
         * @param $page String
         * @param $user String
         * @param $lim Integer
         * @param $conds Array
         */
-       public static function showLogExtract( $out, $types=array(), $page='', $user='', $lim=0, $conds=array() ) {
-               global $wgUser;
+       public static function showLogExtract( &$out, $types=array(), $page='', $user='', $lim=0, $conds=array() ) {
+               global $wgUser, $wgOut;
                # Insert list of top 50 or so items
-               $loglist = new LogEventsList( $wgUser->getSkin(), $out, 0 );
+               $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
                $pager = new LogPager( $loglist, $types, $user, $page, '', $conds );
                if( $lim > 0 ) $pager->mLimit = $lim;
                $logBody = $pager->getBody();
                if( $logBody ) {
-                       $out->addHTML(
-                               $loglist->beginLogEventsList() .
-                               $logBody .
-                               $loglist->endLogEventsList()
-                       );
+                       $s = $loglist->beginLogEventsList() .
+                                $logBody .
+                                $loglist->endLogEventsList();
                } else {
-                       $out->addWikiMsg( 'logempty' );
+                       $s = wfMsgExt( 'logempty', array('parse') );
+               }
+               if( $out instanceof OutputPage ){
+                       $out->addHTML( $s );
+               } else {
+                       $out = $s;
                }
                return $pager->getNumRows();
        }