r67460 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67459‎ | r67460 | r67461 >
Date:13:10, 6 June 2010
Author:liangent
Status:deferred
Tags:
Comment:
Integrate {{DEFAULTSORT: }}
Modified paths:
  • /trunk/extensions/CategoryMultisort/CategoryMultisort.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryMultisort/CategoryMultisort.hooks.php
@@ -54,6 +54,9 @@
5555 $this->coreCategoryLinkHook = $parser->setLinkHook(
5656 NS_CATEGORY, array( $this, 'parserCategoryLink' )
5757 );
 58+ $this->coreDefaultSortHook = $parser->setFunctionHook(
 59+ 'defaultsort', array( $this, 'parserDefaultSort' ), SFH_NO_HASH
 60+ );
5861 }
5962 return true;
6063 }
@@ -270,6 +273,25 @@
271274 return '';
272275 }
273276
 277+ function parserDefaultSort() {
 278+ $args = func_get_args();
 279+ $parser = array_shift( $args );
 280+ $defaultSort = array_shift( $args );
 281+ $categoryDefaultMultisorts = &$parser->getOutput()->mCategoryDefaultMultisorts;
 282+
 283+ foreach ( $this->parseMultisortArgs( $args ) as $skn => $skv ) {
 284+ $categoryDefaultMultisorts[$skn] = $skv;
 285+ }
 286+
 287+ if ( is_callable( $this->coreDefaultSortHook ) ) {
 288+ return call_user_func_array( $this->coreDefaultSortHook, array(
 289+ $parser, $defaultSort
 290+ ) );
 291+ } else {
 292+ return '';
 293+ }
 294+ }
 295+
274296 function parserCategoryMultisort() {
275297 $args = func_get_args();
276298 $parser = array_shift( $args );

Status & tagging log