r40607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40606‎ | r40607 | r40608 >
Date:11:42, 8 September 2008
Author:nad
Status:old
Tags:
Comment:
update to 1.7.4 from site
Modified paths:
  • /trunk/extensions/DynamicPageList/DynamicPageList2.i18n.php (modified) (history)
  • /trunk/extensions/DynamicPageList/DynamicPageList2.php (modified) (history)
  • /trunk/extensions/DynamicPageList/DynamicPageList2Include.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DynamicPageList/DynamicPageList2.i18n.php
@@ -65,77 +65,77 @@
6666 * $1: wrong parameter given by user
6767 * $3: list of possible titles of namespaces (except pseudo-namespaces: Media, Special)
6868 */
69 - 'dpl2_log_' . self::FATAL_WRONGNS => "Error: Wrong '$0' parameter: '$1'! Help: <code>$0= <i>empty string</i> (Main)$3</code>.",
 69+ 'dpl2_log_' . self::FATAL_WRONGNS => "ERROR: Wrong '$0' parameter: '$1'! Help: <code>$0= <i>empty string</i> (Main)$3</code>.",
7070 /**
7171 * $0: 'linksto' (left as $0 just in case the parameter is renamed in the future)
7272 * $1: wrong parameter given by user
7373 */
74 - 'dpl2_log_' . self::FATAL_WRONGLINKSTO => "Error: Wrong '$0' parameter: '$1'! Help: <code>$0= <i>full pagename</i></code>.",
 74+ 'dpl2_log_' . self::FATAL_WRONGLINKSTO => "ERROR: Wrong '$0' parameter: '$1'! Help: <code>$0= <i>full pagename</i></code>.",
7575 /**
7676 * $0: max number of categories that can be included
7777 */
78 - 'dpl2_log_' . self::FATAL_TOOMANYCATS => 'Error: Too many categories! Maximum: $0. Help: increase <code>ExtDynamicPageList2::$maxCategoryCount</code> to specify more categories or set <code>ExtDynamicPageList2::$allowUnlimitedCategories=true</code> for no limitation. (Set the variable in <code>LocalSettings.php</code>, after including <code>DynamicPageList2.php</code>.)',
 78+ 'dpl2_log_' . self::FATAL_TOOMANYCATS => 'ERROR: Too many categories! Maximum: $0. Help: increase <code>ExtDynamicPageList2::$maxCategoryCount</code> to specify more categories or set <code>ExtDynamicPageList2::$allowUnlimitedCategories=true</code> for no limitation. (Set the variable in <code>LocalSettings.php</code>, after including <code>DynamicPageList2.php</code>.)',
7979 /**
8080 * $0: min number of categories that have to be included
8181 */
82 - 'dpl2_log_' . self::FATAL_TOOFEWCATS => 'Error: Too few categories! Minimum: $0. Help: decrease <code>ExtDynamicPageList2::$minCategoryCount</code> to specify fewer categories. (Set the variable preferably in <code>LocalSettings.php</code>, after including <code>DynamicPageList2.php</code>.)',
83 - 'dpl2_log_' . self::FATAL_NOSELECTION => "Error: No selection criteria found! You must use at least one of the following parameters: category, namespace, titlematch, linksto, uses, createdby, modifiedby, lastmodifiedby or their 'not' variants",
84 - 'dpl2_log_' . self::FATAL_CATDATEBUTNOINCLUDEDCATS => "Error: You need to include at least one category if you want to use 'addfirstcategorydate=true' or 'ordermethod=categoryadd'!",
85 - 'dpl2_log_' . self::FATAL_CATDATEBUTMORETHAN1CAT => "Error: If you include more than one category, you cannot use 'addfirstcategorydate=true' or 'ordermethod=categoryadd'!",
86 - 'dpl2_log_' . self::FATAL_MORETHAN1TYPEOFDATE => 'Error: You cannot add more than one type of date at a time!',
 82+ 'dpl2_log_' . self::FATAL_TOOFEWCATS => 'ERROR: Too few categories! Minimum: $0. Help: decrease <code>ExtDynamicPageList2::$minCategoryCount</code> to specify fewer categories. (Set the variable preferably in <code>LocalSettings.php</code>, after including <code>DynamicPageList2.php</code>.)',
 83+ 'dpl2_log_' . self::FATAL_NOSELECTION => "ERROR: No selection criteria found! You must use at least one of the following parameters: category, namespace, titlematch, linksto, uses, createdby, modifiedby, lastmodifiedby or their 'not' variants",
 84+ 'dpl2_log_' . self::FATAL_CATDATEBUTNOINCLUDEDCATS => "ERROR: You need to include at least one category if you want to use 'addfirstcategorydate=true' or 'ordermethod=categoryadd'!",
 85+ 'dpl2_log_' . self::FATAL_CATDATEBUTMORETHAN1CAT => "ERROR: If you include more than one category, you cannot use 'addfirstcategorydate=true' or 'ordermethod=categoryadd'!",
 86+ 'dpl2_log_' . self::FATAL_MORETHAN1TYPEOFDATE => 'ERROR: You cannot add more than one type of date at a time!',
8787 /**
8888 * $0: param=val that is possible only with $1 as last 'ordermethod' parameter
8989 * $1: last 'ordermethod' parameter required for $0
9090 */
91 - 'dpl2_log_' . self::FATAL_WRONGORDERMETHOD => "Error: You can use '$0' with 'ordermethod=[...,]$1' only!",
 91+ 'dpl2_log_' . self::FATAL_WRONGORDERMETHOD => "ERROR: You can use '$0' with 'ordermethod=[...,]$1' only!",
9292 /**
9393 * $0: the number of arguments in includepage
9494 */
95 - 'dpl2_log_' . self::FATAL_DOMINANTSECTIONRANGE => "Error: the index for the dominant section must be between 1 and the number of arguments of includepage ($0 in this case)",
 95+ 'dpl2_log_' . self::FATAL_DOMINANTSECTIONRANGE => "ERROR: the index for the dominant section must be between 1 and the number of arguments of includepage ($0 in this case)",
9696 /**
9797 * $0: prefix_dpl_clview where 'prefix' is the prefix of your mediawiki table names
9898 * $1: SQL query to create the prefix_dpl_clview on your mediawiki DB
9999 */
100 - 'dpl2_log_' . self::FATAL_NOCLVIEW => "Error: Cannot perform logical operations on the Uncategorized pages (e.g. with the 'category' parameter) because the $0 view does not exist on the database! Help: have the DB admin execute this query: <code>$1</code>.",
101 - 'dpl2_log_' . self::FATAL_OPENREFERENCES => 'Error: specifying "openreferences" is incompatible with some other option you specified. See the manual for details.',
 100+ 'dpl2_log_' . self::FATAL_NOCLVIEW => "ERROR: Cannot perform logical operations on the Uncategorized pages (e.g. with the 'category' parameter) because the $0 view does not exist on the database! Help: have the DB admin execute this query: <code>$1</code>.",
 101+ 'dpl2_log_' . self::FATAL_OPENREFERENCES => 'ERROR: specifying "openreferences" is incompatible with some other option you specified. See the manual for details.',
102102
103103 // WARN
104104 /**
105105 * $0: unknown parameter given by user
106106 * $1: list of DPL2 available parameters separated by ', '
107107 */
108 - 'dpl2_log_' . self::WARN_UNKNOWNPARAM => "Warning: Unknown parameter '$0' is ignored. Help: available parameters: <code>$1</code>.",
 108+ 'dpl2_log_' . self::WARN_UNKNOWNPARAM => "WARNING: Unknown parameter '$0' is ignored. Help: available parameters: <code>$1</code>.",
109109 /**
110110 * $3: list of valid param values separated by ' | '
111111 */
112 - 'dpl2_log_' . self::WARN_WRONGPARAM => "Warning: Wrong '$0' parameter: '$1'! Using default: '$2'. Help: <code>$0= $3</code>.",
 112+ 'dpl2_log_' . self::WARN_WRONGPARAM => "WARNING: Wrong '$0' parameter: '$1'! Using default: '$2'. Help: <code>$0= $3</code>.",
113113 /**
114114 * $0: param name
115115 * $1: wrong param value given by user
116116 * $2: default param value used instead by program
117117 */
118 - 'dpl2_log_' . self::WARN_WRONGPARAM_INT => "Warning: Wrong '$0' parameter: '$1'! Using default: '$2' (no limit). Help: <code>$0= <i>empty string</i> (no limit) | n</code>, with <code>n</code> a positive integer.",
119 - 'dpl2_log_' . self::WARN_NORESULTS => 'Warning: No results!',
120 - 'dpl2_log_' . self::WARN_CATOUTPUTBUTWRONGPARAMS => "Warning: Add* parameters ('adduser', 'addeditdate', etc.)' and 'includepage' have no effect with 'mode=category'. Only the page namespace/title can be viewed in this mode.",
 118+ 'dpl2_log_' . self::WARN_WRONGPARAM_INT => "WARNING: Wrong '$0' parameter: '$1'! Using default: '$2' (no limit). Help: <code>$0= <i>empty string</i> (no limit) | n</code>, with <code>n</code> a positive integer.",
 119+ 'dpl2_log_' . self::WARN_NORESULTS => 'WARNING: No results!',
 120+ 'dpl2_log_' . self::WARN_CATOUTPUTBUTWRONGPARAMS => "WARNING: Add* parameters ('adduser', 'addeditdate', etc.)' and 'includepage' have no effect with 'mode=category'. Only the page namespace/title can be viewed in this mode.",
121121 /**
122122 * $0: 'headingmode' value given by user
123123 * $1: value used instead by program (which means no heading)
124124 */
125 - 'dpl2_log_' . self::WARN_HEADINGBUTSIMPLEORDERMETHOD => "Warning: 'headingmode=$0' has no effect with 'ordermethod' on a single component. Using: '$1'. Help: you can use not-$1 'headingmode' values with 'ordermethod' on multiple components. The first component is used for headings. E.g. 'ordermethod=category,<i>comp</i>' (<i>comp</i> is another component) for category headings.",
 125+ 'dpl2_log_' . self::WARN_HEADINGBUTSIMPLEORDERMETHOD => "WARNING: 'headingmode=$0' has no effect with 'ordermethod' on a single component. Using: '$1'. Help: you can use not-$1 'headingmode' values with 'ordermethod' on multiple components. The first component is used for headings. E.g. 'ordermethod=category,<i>comp</i>' (<i>comp</i> is another component) for category headings.",
126126 /**
127127 * $0: 'log' value
128128 */
129 - 'dpl2_log_' . self::WARN_DEBUGPARAMNOTFIRST => "Warning: 'debug=$0' is not in first position in the DPL element. The new debug settings are not applied before all previous parameters have been parsed and checked.",
 129+ 'dpl2_log_' . self::WARN_DEBUGPARAMNOTFIRST => "WARNING: 'debug=$0' is not in first position in the DPL element. The new debug settings are not applied before all previous parameters have been parsed and checked.",
130130 /**
131131 * $0: title of page that creates an infinite transclusion loop
132132 */
133 - 'dpl2_log_' . self::WARN_TRANSCLUSIONLOOP => "Warning: An infinite transclusion loop is created by page '$0'.",
 133+ 'dpl2_log_' . self::WARN_TRANSCLUSIONLOOP => "WARNING: An infinite transclusion loop is created by page '$0'.",
134134
135135 // DEBUG
136136 /**
137137 * $0: SQL query executed to generate the dynamic page list
138138 */
139 - 'dpl2_log_' . self::DEBUG_QUERY => 'Query: <code>$0</code>',
 139+ 'dpl2_log_' . self::DEBUG_QUERY => 'QUERY: <code>$0</code>',
140140
141141 /*
142142 Output formatting
@@ -233,7 +233,7 @@
234234 /**
235235 * $1: number of articles
236236 */
237 - 'dpl2_articlecount' => '{{PLURAL:$1|???? $1 ????|???? ?? ???}} ??? ????? ??.'
 237+ 'dpl2_articlecount' => '{{plural:$1|???? $1 ????|???? ?? ???}} ??? ????? ??.'
238238 );
239239 self::$messages['it'] = array(
240240 /*
Index: trunk/extensions/DynamicPageList/DynamicPageList2.php
@@ -9,7 +9,7 @@
1010 * Note: DynamicPageList2 is based on DynamicPageList.
1111 *
1212 * Usage:
13 - * require_once("extensions/DynamicPageList2.php"); in LocalSettings.php
 13+ * require_once("extensions/DynamicPageList/DynamicPageList2.php"); in LocalSettings.php
1414 *
1515 * @package MediaWiki
1616 * @subpackage Extensions
@@ -259,6 +259,20 @@
260260 * @version 1.6.9
261261 * added check against non-includable namespaces
262262 * added includetrim' command
 263+ * @version 1.7.0
 264+ * bug fix at articlecategory (underscore)
 265+ * bug fix in installation checking (#2128)
 266+ * new command 'imageused'
 267+ * @version 1.7.1
 268+ * allow % within included template parameters
 269+ * @version 1.7.2
 270+ * experimental sorting of result tables (tablesortcol)
 271+ * @version 1.7.3
 272+ * %SECTION% can now be used within multiseseparators
 273+ * preliminary patch for MW 1.12 (recursive template expansion)
 274+ * @version 1.7.4
 275+ * new command: imagecontainer
 276+ * @version 1.7.5
263277
264278 * ! when making changes here you must update the VERSION constant at the beginning of class ExtSynamicPageList2 !
265279 */
@@ -298,7 +312,7 @@
299313
300314 class ExtDynamicPageList2
301315 {
302 - const VERSION = '1.6.9'; // current version
 316+ const VERSION = '1.7.4'; // current version
303317
304318 /**
305319 * Extension options
@@ -518,6 +532,16 @@
519533 */
520534 'notlinksto' => array('default' => ''),
521535 /**
 536+ * this parameter restricts the output to articles which use one of the specified images.
 537+ * Examples: imageused=Image:my image|Image:your image
 538+ */
 539+ 'imageused' => array('default' => ''),
 540+ /**
 541+ * this parameter restricts the output to images which are used (contained) by one of the specified pages.
 542+ * Examples: imagecontainer=my article|your article
 543+ */
 544+ 'imagecontainer' => array('default' => ''),
 545+ /**
522546 * this parameter restricts the output to articles which use the specified template.
523547 * Examples: uses=Template:my template
524548 */
@@ -742,6 +766,10 @@
743767 */
744768 'tablerow' => array('default' => ''),
745769 /**
 770+ * The number (starting with 1) of the column to be used for sorting
 771+ */
 772+ 'tablesortcol' => array('default' => '0', 'pattern' => '/^-?\d*$/'),
 773+ /**
746774 * Max # characters of page title to display.
747775 * Empty value (default) means no limit.
748776 * Not applicable to mode=category.
@@ -878,7 +906,15 @@
879907 // $dump2 = self::dumpParsedRefs($parser,"after DPL func");
880908 // return $dump1.$text.$dump2;
881909
882 - return self::dynamicPageList($input, $params, $parser, $reset, 'func');
 910+ $dplresult = self::dynamicPageList($input, $params, $parser, $reset, 'func');
 911+ global $wgVersion;
 912+ if (version_compare($wgVersion, '1.12.0')<0 || $parser instanceof Parser_OldPP) return $dplresult;
 913+ // old parser does further recursive processing by default
 914+ return array( // normal parser needs to be coaxed to do further recursive processing
 915+ $parser->getPreprocessor()->preprocessToObj($dplresult, Parser::PTD_FOR_INCLUSION ),
 916+ "isChildObj" => true
 917+ );
 918+
883919 }
884920
885921 public static function dplChapterParserFunction(&$parser, $text='', $heading=' ', $maxLength = -1, $page = '?page?', $link = 'default', $trim=false ) {
@@ -1131,6 +1167,7 @@
11321168 $aListSeparators = array();
11331169 $sTable = self::$options['table']['default'];
11341170 $aTableRow = array();
 1171+ $iTableSortCol = self::$options['tablesortcol']['default'];
11351172
11361173 $sInlTxt = self::$options['inlinetext']['default'];
11371174
@@ -1225,6 +1262,9 @@
12261263 $aLinksFrom = array();
12271264 $aNotLinksFrom = array();
12281265
 1266+ $aImageUsed = array();
 1267+ $aImageContainer= array();
 1268+
12291269 $aUses = array();
12301270 $aNotUses = array();
12311271
@@ -1476,6 +1516,31 @@
14771517 if(!$bSelectionCriteriaFound) return $logger->msgWrongParam('notlinksfrom', $sArg);
14781518 break;
14791519
 1520+ case 'imageused':
 1521+ $pages = explode('|', trim($sArg));
 1522+ $n=0;
 1523+ foreach($pages as $page) {
 1524+ if (trim($page)=='') continue;
 1525+ if (!($theTitle = Title::newFromText(trim($page)))) return $logger->msgWrongParam('imageused', $sArg);
 1526+ $aImageUsed[$n++] = $theTitle;
 1527+ $bSelectionCriteriaFound=true;
 1528+ }
 1529+ if(!$bSelectionCriteriaFound) return $logger->msgWrongParam('imageused', $sArg);
 1530+ $bConflictsWithOpenReferences=true;
 1531+ break;
 1532+
 1533+ case 'imagecontainer':
 1534+ $pages = explode('|', trim($sArg));
 1535+ $n=0;
 1536+ foreach($pages as $page) {
 1537+ if (trim($page)=='') continue;
 1538+ if (!($theTitle = Title::newFromText(trim($page)))) return $logger->msgWrongParam('imagecontainer', $sArg);
 1539+ $aImageContainer[$n++] = $theTitle;
 1540+ $bSelectionCriteriaFound=true;
 1541+ }
 1542+ if(!$bSelectionCriteriaFound) return $logger->msgWrongParam('imagecontainer', $sArg);
 1543+ break;
 1544+
14801545 case 'uses':
14811546 $pages = explode('|', $sArg);
14821547 $n=0;
@@ -1693,7 +1758,7 @@
16941759 break;
16951760
16961761 case 'articlecategory':
1697 - $sArticleCategory = $sArg;
 1762+ $sArticleCategory = str_replace(' ','_',$sArg);
16981763 break;
16991764
17001765 /**
@@ -1966,6 +2031,13 @@
19672032 else $aTableRow = explode (',',$sArg);
19682033 break;
19692034
 2035+ case 'tablesortcol':
 2036+ if( preg_match(self::$options['tablesortcol']['pattern'], $sArg) )
 2037+ $iTableSortCol = ($sArg == '') ? 0 : intval($sArg);
 2038+ else // wrong value
 2039+ $output .= $logger->msgWrongParam('tablesortcol', $sArg);
 2040+ break;
 2041+
19702042 case 'dominantsection':
19712043 if( preg_match(self::$options['dominantsection']['pattern'], $sArg) )
19722044 $iDominantSection = ($sArg == '') ? NULL: intval($sArg);
@@ -2133,14 +2205,13 @@
21342206 global $wgHooks;
21352207 if (!isset($wgHooks['ParserAfterTidy']) ||
21362208 !( in_array( __CLASS__ . '::endReset',$wgHooks['ParserAfterTidy']) ||
2137 - in_array( array(__CLASS__, 'endReset' ),$wgHooks['ParserAfterTidy']) ) ) {
 2209+ in_array( array(__CLASS__, 'endReset' ),$wgHooks['ParserAfterTidy'],true) ) ) {
21382210 // changed back to globals, gs
21392211 //$wgHooks['ParserAfterTidy'][] = __CLASS__ . '::endReset';
21402212 $wgHooks['ParserAfterTidy'][] = __CLASS__ . '__endReset';
21412213 }
21422214 }
2143 -
2144 -
 2215+
21452216 // ###### CHECKS ON PARAMETERS ######
21462217 // too many categories!!
21472218 if ( ($iTotalCatCount > self::$maxCategoryCount) && (!self::$allowUnlimitedCategories) )
@@ -2293,7 +2364,7 @@
22942365 else $sSqlDistinct = 'DISTINCT';
22952366 $sSqlGroupBy = '';
22962367 if ($sDistinctResultSet == 'strict'
2297 - && (count($aLinksTo)+count($aNotLinksTo)+count($aLinksFrom)+count($aNotLinksFrom))>0 ) $sSqlGroupBy = 'page_title';
 2368+ && (count($aLinksTo)+count($aNotLinksTo)+count($aLinksFrom)+count($aNotLinksFrom)+count($aImageUsed))>0 ) $sSqlGroupBy = 'page_title';
22982369 $sSqlSortkey = '';
22992370 $sSqlCl_to = '';
23002371 $sSqlCats = '';
@@ -2311,6 +2382,7 @@
23122383 $sSqlRev_user = '';
23132384 $sSqlCond_page_rev = '';
23142385 $sPageLinksTable = $dbr->tableName( 'pagelinks' );
 2386+ $sImageLinksTable = $dbr->tableName( 'imagelinks' );
23152387 $sTemplateLinksTable = $dbr->tableName( 'templatelinks' );
23162388 $sSqlPageLinksTable = '';
23172389 $sSqlCond_page_pl = '';
@@ -2478,6 +2550,40 @@
24792551 }
24802552 }
24812553
 2554+ // imageused
 2555+ if ( count($aImageUsed)>0 ) {
 2556+ $sSqlPageLinksTable .= $sImageLinksTable . ' as il, ';
 2557+ $sSqlCond_page_pl .= ' AND '.$sPageTable.'.page_id=il.il_from AND (';
 2558+ $sSqlSelPage = ', il.il_to as image_sel_title';
 2559+ $n=0;
 2560+ foreach ($aImageUsed as $link) {
 2561+ if ($n>0) $sSqlCond_page_pl .= ' OR ';
 2562+ if ($bIgnoreCase) $sSqlCond_page_pl .= "UPPER(il.il_to)=UPPER(" . $dbr->addQuotes( $link->getDbKey() ).')';
 2563+ else $sSqlCond_page_pl .= "il.il_to=" . $dbr->addQuotes( $link->getDbKey() );
 2564+ $n++;
 2565+ }
 2566+ $sSqlCond_page_pl .= ')';
 2567+ }
 2568+
 2569+ // imagecontainer
 2570+ if ( count($aImageContainer)>0 ) {
 2571+ $sSqlPageLinksTable .= $sImageLinksTable . ' as ic, ';
 2572+ if ($acceptOpenReferences) {
 2573+ $sSqlCond_page_pl .= ' AND (';
 2574+ }
 2575+ else {
 2576+ $sSqlCond_page_pl .= ' AND '.$sPageTable.'.page_namespace=\'6\' AND '.$sPageTable.'.page_title=ic.il_to AND (';
 2577+ }
 2578+ $n=0;
 2579+ foreach ($aImageContainer as $link) {
 2580+ if ($n>0) $sSqlCond_page_pl .= ' OR ';
 2581+ if ($bIgnoreCase) $sSqlCond_page_pl .= "UPPER(ic.il_from)=UPPER(" . $dbr->addQuotes( $link->getArticleID() ).')';
 2582+ else $sSqlCond_page_pl .= "ic.il_from=" . $dbr->addQuotes( $link->getArticleID() );
 2583+ $n++;
 2584+ }
 2585+ $sSqlCond_page_pl .= ')';
 2586+ }
 2587+
24822588 // uses
24832589 if ( count($aUses)>0 ) {
24842590 $sSqlPageLinksTable .= ' '.$sTemplateLinksTable . ' as tl, ';
@@ -2610,8 +2716,13 @@
26112717 // SELECT ... FROM
26122718 if ($acceptOpenReferences)
26132719 // SELECT ... FROM
2614 - $sSqlSelectFrom = "SELECT $sSqlCalcFoundRows $sSqlDistinct " . $sSqlCl_to . 'pl_namespace, pl_title' . $sSqlSelPage . $sSqlSortkey . ' FROM ' . $sPageLinksTable;
2615 - else
 2720+ if (count($aImageContainer)>0) {
 2721+ $sSqlSelectFrom = "SELECT $sSqlCalcFoundRows $sSqlDistinct " . $sSqlCl_to . 'ic.il_to, ' . $sSqlSelPage . "ic.il_to as sortkey" . ' FROM ' . $sImageLinksTable . ' AS ic';
 2722+ }
 2723+ else {
 2724+ $sSqlSelectFrom = "SELECT $sSqlCalcFoundRows $sSqlDistinct " . $sSqlCl_to . 'pl_namespace, pl_title' . $sSqlSelPage . $sSqlSortkey . ' FROM ' . $sPageLinksTable;
 2725+ }
 2726+ else
26162727 $sSqlSelectFrom = "SELECT $sSqlCalcFoundRows $sSqlDistinct " . $sSqlCl_to . $sPageTable.'.page_namespace as page_namespace,'.
26172728 $sPageTable.'.page_title as page_title' . $sSqlSelPage . $sSqlSortkey . $sSqlPage_counter .
26182729 $sSqlPage_size . $sSqlPage_touched . $sSqlRev_user .
@@ -2875,12 +2986,18 @@
28762987 $pageNamespace = 14; // CATEGORY
28772988 $pageTitle = $row->cl_to;
28782989 } else if ($acceptOpenReferences) {
2879 - // existing PAGE TITLE
2880 - $pageNamespace = $row->pl_namespace;
2881 - $pageTitle = $row->pl_title;
 2990+ if (count($aImageContainer)>0) {
 2991+ $pageNamespace = 6;
 2992+ $pageTitle = $row->il_to;
 2993+ }
 2994+ else {
 2995+ // maybe non-existing title
 2996+ $pageNamespace = $row->pl_namespace;
 2997+ $pageTitle = $row->pl_title;
 2998+ }
28822999 }
28833000 else {
2884 - // maybe non-existing title
 3001+ // existing PAGE TITLE
28853002 $pageNamespace = $row->page_namespace;
28863003 $pageTitle = $row->page_title;
28873004 }
@@ -2939,6 +3056,15 @@
29403057 }
29413058 }
29423059
 3060+ //STORE selected image
 3061+ if ( count($aImageUsed)>0 ) {
 3062+ if (!isset($row->image_sel_title)) {
 3063+ $dplArticle->mImageSelTitle = 'unknown image';
 3064+ } else {
 3065+ $dplArticle->mImageSelTitle = $row->image_sel_title;
 3066+ }
 3067+ }
 3068+
29433069 if ($bGoalIsPages) {
29443070 //REVISION SPECIFIED
29453071 if( $sLastRevisionBefore.$sAllRevisionsBefore.$sFirstRevisionSince.$sAllRevisionsSince !='') {
@@ -3029,7 +3155,7 @@
30303156 $dpl = new DPL2($aHeadings, $bHeadingCount, $iColumns, $iRows, $iRowSize, $sRowColFormat, $aArticles,
30313157 $aOrderMethods[0], $hListMode, $listMode, $bEscapeLinks, $bIncPage, $iIncludeMaxLen,
30323158 $aSecLabels, $aSecLabelsMatch, $aSecLabelsNotMatch, $bIncParsed, $parser, $logger, $aReplaceInTitle,
3033 - $iTitleMaxLen, $defaultTemplateSuffix, $aTableRow, $bIncludeTrim);
 3159+ $iTitleMaxLen, $defaultTemplateSuffix, $aTableRow, $bIncludeTrim, $iTableSortCol);
30343160
30353161 if ($rowcount == -1) $rowcount = $dpl->getRowCount();
30363162 $dpl2result = $dpl->getText();
@@ -3067,7 +3193,7 @@
30683194 global $wgHooks;
30693195 if (!isset($wgHooks['ParserAfterTidy']) ||
30703196 !(in_array(__CLASS__ . '::endEliminate',$wgHooks['ParserAfterTidy']) ||
3071 - in_array( array( __CLASS__, 'endEliminate'),$wgHooks['ParserAfterTidy']))) {
 3197+ in_array( array( __CLASS__, 'endEliminate'),$wgHooks['ParserAfterTidy'],true))) {
30723198 // changed back to globals, gs
30733199 // $wgHooks['ParserAfterTidy'][] = __CLASS__ . '::endEliminate';
30743200 $wgHooks['ParserAfterTidy'][] = __CLASS__ . '__endEliminate';
@@ -3108,7 +3234,7 @@
31093235
31103236 }
31113237
3112 - // create keys for TableRow which representg the structure of the "include=" arguments
 3238+ // create keys for TableRow which represent the structure of the "include=" arguments
31133239 private static function updateTableRowKeys(&$aTableRow,$aSecLabels) {
31143240 $tableRow = $aTableRow;
31153241 $aTableRow=array();
@@ -3219,6 +3345,7 @@
32203346 var $mNamespace = -1; // namespace (number)
32213347 var $mSelTitle = ''; // selected title of initial page
32223348 var $mSelNamespace = -1;// selected namespace (number) of initial page
 3349+ var $mImageSelTitle = ''; // selected title of image
32233350 var $mLink = ''; // html link to page
32243351 var $mStartChar = ''; // page title first char
32253352 var $mParentHLink = ''; // heading (link to the associated page) that page belongs to in the list (default '' means no heading)
@@ -3350,7 +3477,7 @@
33513478 function DPL2($headings, $bHeadingCount, $iColumns, $iRows, $iRowSize, $sRowColFormat, $articles, $headingtype, $hlistmode,
33523479 $listmode, $bescapelinks, $includepage, $includemaxlen, $includeseclabels, $includeseclabelsmatch,
33533480 $includeseclabelsnotmatch, $includematchparsed, &$parser, $logger, $replaceInTitle, $iTitleMaxLen,
3354 - $defaultTemplateSuffix, $aTableRow, $bIncludeTrim ) {
 3481+ $defaultTemplateSuffix, $aTableRow, $bIncludeTrim, $iTableSortCol ) {
33553482 global $wgContLang;
33563483 $this->nameSpaces = $wgContLang->getNamespaces();
33573484 $this->mArticles = $articles;
@@ -3406,13 +3533,13 @@
34073534 $greml -= $portion;
34083535 // $this->mOutput .= "nsize=$nsize, portion=$portion, greml=$greml";
34093536 if ($greml>0) {
3410 - $this->mOutput .= $this->formatList($nstart-$offset, $portion, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim);
 3537+ $this->mOutput .= $this->formatList($nstart-$offset, $portion, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim, $iTableSortCol);
34113538 $nstart += $portion;
34123539 $portion=0;
34133540 break;
34143541 }
34153542 else {
3416 - $this->mOutput .= $this->formatList($nstart-$offset, $portion+$greml, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim);
 3543+ $this->mOutput .= $this->formatList($nstart-$offset, $portion+$greml, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim, $iTableSortCol);
34173544 $nstart += ($portion+$greml);
34183545 $portion = (-$greml);
34193546 if ($iColumns!=1) $this->mOutput .= "\n|valign=top|\n";
@@ -3439,7 +3566,7 @@
34403567 $this->mOutput .= $hlistmode->sItemStart;
34413568 $this->mOutput .= $hlistmode->sHeadingStart . $headingLink . $hlistmode->sHeadingEnd;
34423569 if ($bHeadingCount) $this->mOutput .= $this->formatCount($headingCount);
3443 - $this->mOutput .= $this->formatList($headingStart, $headingCount, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim);
 3570+ $this->mOutput .= $this->formatList($headingStart, $headingCount, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim, $iTableSortCol);
34443571 $this->mOutput .= $hlistmode->sItemEnd;
34453572 $headingStart += $headingCount;
34463573 }
@@ -3456,7 +3583,7 @@
34573584 if ($rest>0) $nsize += 1;
34583585 $this->mOutput .= "{|".$sRowColFormat."\n|\n";
34593586 for ($g=0;$g<$iGroup;$g++) {
3460 - $this->mOutput .= $this->formatList($nstart, $nsize, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim);
 3587+ $this->mOutput .= $this->formatList($nstart, $nsize, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim, $iTableSortCol);
34613588 if ($iColumns!=1) $this->mOutput .= "\n|valign=top|\n";
34623589 else $this->mOutput .= "\n|-\n|\n";
34633590 $nstart = $nstart + $nsize;
@@ -3472,14 +3599,14 @@
34733600 $this->mOutput .= '{|'.$sRowColFormat."\n|\n";
34743601 do {
34753602 if ($nstart+$nsize > $count) $nsize = $count - $nstart;
3476 - $this->mOutput .= $this->formatList($nstart, $nsize, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim);
 3603+ $this->mOutput .= $this->formatList($nstart, $nsize, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim, $iTableSortCol);
34773604 $this->mOutput .= "\n|-\n|\n";
34783605 $nstart = $nstart + $nsize;
34793606 if ($nstart >= $count) break;
34803607 } while (true);
34813608 $this->mOutput .= "\n|}\n";
34823609 } else {
3483 - $this->mOutput .= $this->formatList(0, count($articles), $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim);
 3610+ $this->mOutput .= $this->formatList(0, count($articles), $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim, $iTableSortCol);
34843611 }
34853612
34863613 }
@@ -3532,6 +3659,7 @@
35333660 $sTag = str_replace('%PAGESEL%',$this->nameSpaces[$article->mSelNamespace].':'.str_replace('_',' ',$article->mSelTitle),$sTag);
35343661 }
35353662 }
 3663+ if ($article->mImageSelTitle!= '') $sTag = str_replace('%IMAGESEL%',str_replace('_',' ',$article->mImageSelTitle),$sTag);
35363664 if (!empty($article->mCategoryLinks) ) {
35373665 $sTag = str_replace('%'.'CATLIST%',implode(', ', $article->mCategoryLinks),$sTag);
35383666 $sTag = str_replace('%'.'CATNAMES%',implode(', ', $article->mCategoryTexts),$sTag);
@@ -3543,20 +3671,19 @@
35443672 return $sTag;
35453673 }
35463674
3547 - function formatList($iStart, $iCount, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim) {
 3675+ function formatList($iStart, $iCount, $iTitleMaxLen, $defaultTemplateSuffix, $bIncludeTrim, $iTableSortCol) {
35483676 global $wgUser, $wgLang, $wgContLang;
35493677
35503678 $mode = $this->mListMode;
35513679 //categorypage-style list output mode
3552 - if($mode->name == 'category')
3553 - return $this->formatCategoryList($iStart, $iCount);
 3680+ if($mode->name == 'category') return $this->formatCategoryList($iStart, $iCount);
35543681
35553682 //other list modes
35563683 $sk = & $wgUser->getSkin();
35573684
35583685 //process results of query, outputing equivalent of <li>[[Article]]</li> for each result,
35593686 //or something similar if the list uses other startlist/endlist;
3560 - $r = $mode->sListStart;
 3687+ $rBody='';
35613688 // the following statement caused a problem with multiple columns: $this->filteredCount = 0;
35623689 for ($i = $iStart; $i < $iStart+$iCount; $i++) {
35633690 $article = $this->mArticles[$i];
@@ -3618,9 +3745,9 @@
36193746 else $mustNotMatch = '';
36203747
36213748 // if chapters are selected by number we get the heading from DPL2Include::includeHeading
3622 - $sectionHeading='';
 3749+ $sectionHeading[0]='';
36233750 if($sSecLabel[0] == '#') {
3624 - $sectionHeading=substr($sSecLabel,1);
 3751+ $sectionHeading[0]=substr($sSecLabel,1);
36253752 // Uses DPL2Include::includeHeading() from LabeledSectionTransclusion extension to include headings from the page
36263753 $secPieces = DPL2Include::includeHeading($this->mParser, $article->mTitle->getPrefixedText(), substr($sSecLabel, 1),'',
36273754 $sectionHeading,false,$maxlen,$cutLink,$bIncludeTrim);
@@ -3636,9 +3763,15 @@
36373764 }
36383765 }
36393766 $this->formatSingleItems($secPieces,$s);
3640 - $secPiece[$s] = implode(isset($mode->aMultiSecSeparators[$s])?
3641 - $this->substTagParm($mode->aMultiSecSeparators[$s], $pagename, $article,
3642 - $this->filteredCount, $iTitleMaxLen):'',$secPieces);
 3767+ $secPiece[$s] = $secPieces[0];
 3768+ for ($sp=1;$sp<count($secPieces);$sp++) {
 3769+ if (isset($mode->aMultiSecSeparators[$s])) {
 3770+ $secPiece[$s] .= str_replace('%SECTION%',$sectionHeading[$sp],
 3771+ $this->substTagParm($mode->aMultiSecSeparators[$s], $pagename, $article,
 3772+ $this->filteredCount, $iTitleMaxLen));
 3773+ }
 3774+ $secPiece[$s] .= $secPieces[$sp];
 3775+ }
36433776 if ($mode->iDominantSection>=0 && $s==$mode->iDominantSection && count($secPieces)>1) $dominantPieces=$secPieces;
36443777 if (($mustMatch!='' || $mustNotMatch!='') && count($secPieces)<=0) {
36453778 $matchFailed=true; // NOTHING MATCHED
@@ -3650,7 +3783,8 @@
36513784 $template1 = substr($sSecLabel,1,strpos($sSecLabel,'}')-1);
36523785 $template2 = str_replace('}','',substr($sSecLabel,1));
36533786 $secPieces = DPL2Include::includeTemplate($this->mParser, $this, $s, $article, $template1,
3654 - $template2, $template2.$defaultTemplateSuffix,$mustMatch,$mustNotMatch,$this->mIncParsed);
 3787+ $template2, $template2.$defaultTemplateSuffix,$mustMatch,
 3788+ $mustNotMatch,$this->mIncParsed,$iTitleMaxLen);
36553789 $secPiece[$s] = implode(isset($mode->aMultiSecSeparators[$s])?
36563790 $this->substTagParm($mode->aMultiSecSeparators[$s], $pagename, $article, $this->filteredCount, $iTitleMaxLen):'',$secPieces);
36573791 if ($mode->iDominantSection>=0 && $s==$mode->iDominantSection && count($secPieces)>1) $dominantPieces=$secPieces;
@@ -3674,14 +3808,14 @@
36753809 // separator tags
36763810 if (count($mode->sSectionTags)==1) {
36773811 // If there is only one separator tag use it always
3678 - $septag[$s*2] = str_replace('%SECTION%',$sectionHeading,$this->substTagParm($mode->sSectionTags[0], $pagename, $article, $this->filteredCount, $iTitleMaxLen));
 3812+ $septag[$s*2] = str_replace('%SECTION%',$sectionHeading[0],$this->substTagParm($mode->sSectionTags[0], $pagename, $article, $this->filteredCount, $iTitleMaxLen));
36793813 }
36803814 else if (isset($mode->sSectionTags[$s*2])) {
3681 - $septag[$s*2] = str_replace('%SECTION%',$sectionHeading,$this->substTagParm($mode->sSectionTags[$s*2], $pagename, $article, $this->filteredCount, $iTitleMaxLen));
 3815+ $septag[$s*2] = str_replace('%SECTION%',$sectionHeading[0],$this->substTagParm($mode->sSectionTags[$s*2], $pagename, $article, $this->filteredCount, $iTitleMaxLen));
36823816 }
36833817 else $septag[$s*2] = '';
36843818 if (isset($mode->sSectionTags[$s*2+1])) {
3685 - $septag[$s*2+1] = str_replace('%SECTION%',$sectionHeading,$this->substTagParm($mode->sSectionTags[$s*2+1], $pagename, $article, $this->filteredCount, $iTitleMaxLen));
 3819+ $septag[$s*2+1] = str_replace('%SECTION%',$sectionHeading[0],$this->substTagParm($mode->sSectionTags[$s*2+1], $pagename, $article, $this->filteredCount, $iTitleMaxLen));
36863820 }
36873821 else $septag[$s*2+1]='';
36883822
@@ -3712,61 +3846,87 @@
37133847 $this->filteredCount = $this->filteredCount + 1;
37143848 }
37153849
3716 - if($i > $iStart) $r .= $mode->sInline; //If mode is not 'inline', sInline attribute is empty, so does nothing
 3850+ if($i > $iStart) $rBody .= $mode->sInline; //If mode is not 'inline', sInline attribute is empty, so does nothing
37173851
37183852 // symbolic substitution of %PAGE% by the current article's name
37193853 if ($mode->name == 'userformat') {
3720 - $r .= $this->substTagParm($mode->sItemStart, $pagename, $article,$this->filteredCount, $iTitleMaxLen);
 3854+ $rBody .= $this->substTagParm($mode->sItemStart, $pagename, $article,$this->filteredCount, $iTitleMaxLen);
37213855 }
37223856 else {
3723 - $r .= $mode->sItemStart;
 3857+ $rBody .= $mode->sItemStart;
37243858 if($article->mDate != '') {
37253859 if ($article->myDate != '') {
3726 - if($article->mRevision != '') $r .= ' <html><a href="'.$pagename.'?oldid='.$article->mRevision.'">'
3727 - . $article->myDate.'</a></html>';
3728 - else $r .= $article->myDate;
 3860+ if($article->mRevision != '') $rBody .= ' <html><a href="'.$pagename.'?oldid='.$article->mRevision.'">'
 3861+ . $article->myDate.'</a></html>';
 3862+ else $rBody .= $article->myDate;
37293863 } else {
3730 - if($article->mRevision != '') $r .= ' <html><a href="'.$pagename.'?oldid='.$article->mRevision.'">'
3731 - . $wgLang->timeanddate($article->mDate, true).'</a></html> : ';
3732 - else $r .= $wgLang->timeanddate($article->mDate, true) . ': ';
 3864+ if($article->mRevision != '') $rBody .= ' <html><a href="'.$pagename.'?oldid='.$article->mRevision.'">'
 3865+ . $wgLang->timeanddate($article->mDate, true).'</a></html> : ';
 3866+ else $rBody .= $wgLang->timeanddate($article->mDate, true) . ': ';
37333867 }
37343868 }
37353869 // output the link to the article
3736 - $r .= $article->mLink;
 3870+ $rBody .= $article->mLink;
37373871 if($article->mSize != '' && $mode->name != 'userformat') {
3738 - if (strlen($article->mSize) > 3) $r .= ' [' . substr($article->mSize,0,strlen($article->mSize)-3) . ' kB]';
3739 - else $r .= ' [' . $article->mSize . ' B]';
 3872+ if (strlen($article->mSize) > 3) $rBody .= ' [' . substr($article->mSize,0,strlen($article->mSize)-3) . ' kB]';
 3873+ else $rBody .= ' [' . $article->mSize . ' B]';
37403874 }
37413875 if($article->mCounter != '' && $mode->name != 'userformat') {
37423876 // Adapted from SpecialPopularPages::formatResult()
37433877 $nv = $this->msgExt( 'nviews', array( 'parsemag', 'escape'), $wgLang->formatNum( $article->mCounter ) );
3744 - $r .= ' ' . $wgContLang->getDirMark() . '(' . $nv . ')';
 3878+ $rBody .= ' ' . $wgContLang->getDirMark() . '(' . $nv . ')';
37453879 }
3746 - if($article->mUserLink != '') $r .= ' . . [[User:' . $article->mUser .'|'.$article->mUser.']]';
3747 - if($article->mContributor != '')$r .= ' . . [[User:' . $article->mContributor .'|'.$article->mContributor." $article->mContrib]]";
 3880+ if($article->mUserLink != '') $rBody .= ' . . [[User:' . $article->mUser .'|'.$article->mUser.']]';
 3881+ if($article->mContributor != '')$rBody .= ' . . [[User:' . $article->mContributor .'|'.$article->mContributor." $article->mContrib]]";
37483882
3749 - if( !empty($article->mCategoryLinks) ) $r .= ' . . <SMALL>' . wfMsg('categories') . ': ' . implode(' | ', $article->mCategoryLinks) . '</SMALL>';
 3883+ if( !empty($article->mCategoryLinks) ) $rBody .= ' . . <SMALL>' . wfMsg('categories') . ': ' . implode(' | ', $article->mCategoryLinks) . '</SMALL>';
37503884 }
37513885
37523886 // add included contents
37533887
37543888 if ($this->mIncPage) {
37553889 DPL2Include::open($this->mParser, $this->mParserTitle->getPrefixedText());
3756 - $r .= $incwiki;
 3890+ $rBody .= $incwiki;
37573891 DPL2Include::close($this->mParser, $this->mParserTitle->getPrefixedText());
37583892 }
37593893
37603894 if ($mode->name == 'userformat') {
3761 - $r .= $this->substTagParm($mode->sItemEnd, $pagename, $article, $this->filteredCount, $iTitleMaxLen);
 3895+ $rBody .= $this->substTagParm($mode->sItemEnd, $pagename, $article, $this->filteredCount, $iTitleMaxLen);
37623896 }
3763 - else
3764 - $r .= $mode->sItemEnd;
 3897+ else {
 3898+ $rBody .= $mode->sItemEnd;
 3899+ }
37653900 }
3766 - $r .= $mode->sListEnd;
3767 -
3768 - return $r;
 3901+ // if requested we sort the table by the contents of a given column
 3902+ if ($iTableSortCol!=0) {
 3903+ $sortcol = abs($iTableSortCol) + 1;
 3904+ $rows=explode("\n|-",$rBody);
 3905+ foreach($rows as $row) {
 3906+ if (($word = explode("\n|",$row,$sortcol))!==false && count($word)>=$sortcol) {
 3907+ $rowsKey[] = $word[$sortcol - 1];
 3908+ } else {
 3909+ $rowsKey[] = $row;
 3910+ }
 3911+ }
 3912+ if ($iTableSortCol<0) krsort($rowsKey);
 3913+ else ksort ($rowsKey);
 3914+ $rows=array_combine(array_values($rowsKey),$rows);
 3915+ ksort($rows);
 3916+ $rBody="\n|-".join("\n|-",$rows)."\n|-";
 3917+ }
 3918+ return $mode->sListStart . $rBody . $mode->sListEnd;
37693919 }
37703920
 3921+ // generate a hyperlink to the article
 3922+ function articleLink($tag,$article,$iTitleMaxLen) {
 3923+ $pagename = $article->mTitle->getPrefixedText();
 3924+ if ($this->mEscapeLinks && ($article->mNamespace==14 || $article->mNamespace==6) ) {
 3925+ // links to categories or images need an additional ":"
 3926+ $pagename = ':'.$pagename;
 3927+ }
 3928+ return $this->substTagParm($tag, $pagename, $article, $this->filteredCount, $iTitleMaxLen);
 3929+ }
 3930+
37713931 //format one item of an entry in the output list (i.e. the collection of occurences of one item from the include parameter)
37723932 function formatItem($piece, $tagStart, $tagEnd) {
37733933 return $tagStart.$piece.$tagEnd;
Index: trunk/extensions/DynamicPageList/DynamicPageList2Include.php
@@ -78,6 +78,11 @@
7979 * changed call time by reference in extract Heading
8080 * @version 1.6.9
8181 * added include trimming
 82+ * @version 1.7.1
 83+ * allow % within included template parameters
 84+ * @version 1.7.3
 85+ * %SECTION% can now be used within multiseseparators (see includeHeading)
 86+
8287 */
8388
8489 class DPL2Include
@@ -380,10 +385,10 @@
381386 }
382387
383388 if (isset($m[0][0])) {
384 - $sectionHeading=preg_replace("/^=+\s*/","",$m[0][0]);
385 - $sectionHeading=preg_replace("/\s*=+\s*$/","",$sectionHeading);
 389+ $sectionHeading[$n]=preg_replace("/^=+\s*/","",$m[0][0]);
 390+ $sectionHeading[$n]=preg_replace("/\s*=+\s*$/","",$sectionHeading[$n]);
386391 }
387 - else $sectionHeading = '';
 392+ else $sectionHeading[$n] = '';
388393 if ($nr==1) {
389394 // output n-th section and done
390395 $output[0] = self::parse($parser,$title,$piece, "#lsth:${page}|${sec}", $nhead, $recursionCheck, $maxLength, $link, $trim);
@@ -411,7 +416,7 @@
412417 // and do NOT match the condition "$mustNotMatch" (if specified)
413418 // we use a callback function to format retrieved parameters, accessible via $dpl->formatTemplateArg()
414419 public static function includeTemplate($parser, $dpl, $dplNr, $article, $template1='', $template2='', $defaultTemplate,
415 - $mustMatch, $mustNotMatch, $matchParsed)
 420+ $mustMatch, $mustNotMatch, $matchParsed, $iTitleMaxLen)
416421 {
417422 $page = $article->mTitle->getPrefixedText();
418423 $date = $article->myDate;
@@ -526,14 +531,22 @@
527532 $output[$n] .= "|"; // \n";
528533 }
529534 $found=false;
530 - // named parameter
531 - $exParmQuote = str_replace('/','\/',$exParm);
532 - foreach ($parms as $parm) {
533 - if (!preg_match("/^\s*$exParmQuote\s*=/",$parm)) continue;
534 - $found=true;
535 - $output[$n] .= $dpl->formatTemplateArg(preg_replace("/^$exParmQuote\s*=\s*/","",$parm),$dplNr,$exParmKey,$firstCall,$maxlen);
536 - break;
 535+ // % in parameter name
 536+ if (strpos($exParm,'%')!==FALSE) {
 537+ // %% is a short form for inclusion of %PAGE% and %TITLE%
 538+ $found=true;
 539+ $output[$n] .= $dpl->formatTemplateArg($dpl->articleLink($exParm,$article,$iTitleMaxLen),$dplNr,$exParmKey,$firstCall,$maxlen);
537540 }
 541+ if (!$found) {
 542+ // named parameter
 543+ $exParmQuote = str_replace('/','\/',$exParm);
 544+ foreach ($parms as $parm) {
 545+ if (!preg_match("/^\s*$exParmQuote\s*=/",$parm)) continue;
 546+ $found=true;
 547+ $output[$n] .= $dpl->formatTemplateArg(preg_replace("/^$exParmQuote\s*=\s*/","",$parm),$dplNr,$exParmKey,$firstCall,$maxlen);
 548+ break;
 549+ }
 550+ }
538551 if (!$found && is_numeric($exParm) && intval($exParm) == $exParm) {
539552 // numeric parameter
540553 $np=0;