Index: trunk/extensions/CategoryMultisort/CategoryMultisort.hooks.php |
— | — | @@ -54,6 +54,9 @@ |
55 | 55 | $this->coreCategoryLinkHook = $parser->setLinkHook( |
56 | 56 | NS_CATEGORY, array( $this, 'parserCategoryLink' ) |
57 | 57 | ); |
| 58 | + $this->coreDefaultSortHook = $parser->setFunctionHook( |
| 59 | + 'defaultsort', array( $this, 'parserDefaultSort' ), SFH_NO_HASH |
| 60 | + ); |
58 | 61 | } |
59 | 62 | return true; |
60 | 63 | } |
— | — | @@ -270,6 +273,25 @@ |
271 | 274 | return ''; |
272 | 275 | } |
273 | 276 | |
| 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 | + |
274 | 296 | function parserCategoryMultisort() { |
275 | 297 | $args = func_get_args(); |
276 | 298 | $parser = array_shift( $args ); |