r12148 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12147‎ | r12148 | r12149 >
Date:08:57, 19 December 2005
Author:ilyah
Status:old
Tags:
Comment:
now passing category name through parser to replace magic variables in order to allow date-based expansions; also, increased max categories in DPL to 6
Modified paths:
  • /trunk/extensions/intersection/DynamicPageList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/intersection/DynamicPageList.php
@@ -37,7 +37,7 @@
3838 */
3939
4040 $wgDLPminCategories = 1; // Minimum number of categories to look for
41 -$wgDLPmaxCategories = 5; // Maximum number of categories to look for
 41+$wgDLPmaxCategories = 6; // Maximum number of categories to look for
4242 $wgDLPMinResultCount = 1; // Minimum number of results to allow
4343 $wgDLPMaxResultCount = 50; // Maximum number of results to allow
4444 $wgDLPAllowUnlimitedResults = true; // Allow unlimited results
@@ -69,6 +69,7 @@
7070 // The callback function for converting the input text to HTML output
7171 function DynamicPageList( $input ) {
7272 global $wgUser;
 73+ global $wgTitle;
7374 global $wgLang;
7475 global $wgContLang;
7576 global $wgDLPminCategories, $wgDLPmaxCategories,$wgDLPMinResultCount, $wgDLPMaxResultCount;
@@ -95,6 +96,11 @@
9697
9798 $aParams = explode("\n", $input);
9899
 100+ $parser = new Parser();
 101+ $parser->mTitle = $wgTitle;
 102+ $parser->mOutputType = OT_MSG;
 103+ $parser->initialiseVariables();
 104+
99105 foreach($aParams as $sParam)
100106 {
101107 $aParam = explode("=", $sParam);
@@ -104,14 +110,14 @@
105111 $sArg = trim($aParam[1]);
106112 if ($sType == 'category')
107113 {
108 - $title = Title::newFromText( $sArg );
 114+ $title = Title::newFromText( $parser->replaceVariables($sArg) );
109115 if( is_null( $title ) )
110116 continue;
111117 $aCategories[] = $title;
112118 }
113119 else if ($sType == 'notcategory')
114120 {
115 - $title = Title::newFromText( $sArg );
 121+ $title = Title::newFromText( $parser->replaceVariables($sArg) );
116122 if( is_null( $title ) )
117123 continue;
118124 $aExcludeCategories[] = $title;

Status & tagging log