Index: trunk/extensions/ArrayExtension/ArrayExtension.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | die( 'This file is a MediaWiki extension, it is not a valid entry point' ); |
44 | 44 | } |
45 | 45 | |
46 | | -$wgExtensionFunctions[] = 'efSetupArrayExtension'; |
| 46 | +$wgHooks['ParserFirstCallInit'][] = 'efArrayExtensionParserFirstCallInit'; |
47 | 47 | |
48 | 48 | $wgExtensionCredits['parserhook'][] = array( |
49 | 49 | 'path' => __FILE__, |
— | — | @@ -748,33 +748,35 @@ |
749 | 749 | } |
750 | 750 | } |
751 | 751 | |
752 | | -function efSetupArrayExtension() { |
753 | | - global $wgParser, $wgArrayExtension; |
| 752 | +function efArrayExtensionParserFirstCallInit( $parser ) { |
| 753 | + global $wgArrayExtension; |
754 | 754 | |
755 | 755 | $wgArrayExtension = new ArrayExtension; |
756 | | - $wgParser->setFunctionHook( 'arraydefine', array( &$wgArrayExtension, 'arraydefine' ) ); |
| 756 | + $parser->setFunctionHook( 'arraydefine', array( &$wgArrayExtension, 'arraydefine' ) ); |
757 | 757 | |
758 | | - if ( defined( get_class( $wgParser ) . '::SFH_OBJECT_ARGS' ) ) { |
759 | | - $wgParser->setFunctionHook( 'arrayprint', array( &$wgArrayExtension, 'arrayprintObj' ), SFH_OBJECT_ARGS ); |
| 758 | + if ( defined( get_class( $parser ) . '::SFH_OBJECT_ARGS' ) ) { |
| 759 | + $parser->setFunctionHook( 'arrayprint', array( &$wgArrayExtension, 'arrayprintObj' ), SFH_OBJECT_ARGS ); |
760 | 760 | } else { |
761 | | - $wgParser->setFunctionHook( 'arrayprint', array( &$wgArrayExtension, 'arrayprint' ) ); |
| 761 | + $parser->setFunctionHook( 'arrayprint', array( &$wgArrayExtension, 'arrayprint' ) ); |
762 | 762 | } |
763 | 763 | |
764 | | - $wgParser->setFunctionHook( 'arraysize', array( &$wgArrayExtension, 'arraysize' ) ); |
765 | | - $wgParser->setFunctionHook( 'arrayindex', array( &$wgArrayExtension, 'arrayindex' ) ); |
766 | | - $wgParser->setFunctionHook( 'arraysearch', array( &$wgArrayExtension, 'arraysearch' ) ); |
| 764 | + $parser->setFunctionHook( 'arraysize', array( &$wgArrayExtension, 'arraysize' ) ); |
| 765 | + $parser->setFunctionHook( 'arrayindex', array( &$wgArrayExtension, 'arrayindex' ) ); |
| 766 | + $parser->setFunctionHook( 'arraysearch', array( &$wgArrayExtension, 'arraysearch' ) ); |
767 | 767 | |
768 | | - $wgParser->setFunctionHook( 'arraysort', array( &$wgArrayExtension, 'arraysort' ) ); |
769 | | - $wgParser->setFunctionHook( 'arrayunique', array( &$wgArrayExtension, 'arrayunique' ) ); |
770 | | - $wgParser->setFunctionHook( 'arrayreset', array( &$wgArrayExtension, 'arrayreset' ) ); |
| 768 | + $parser->setFunctionHook( 'arraysort', array( &$wgArrayExtension, 'arraysort' ) ); |
| 769 | + $parser->setFunctionHook( 'arrayunique', array( &$wgArrayExtension, 'arrayunique' ) ); |
| 770 | + $parser->setFunctionHook( 'arrayreset', array( &$wgArrayExtension, 'arrayreset' ) ); |
771 | 771 | |
772 | | - $wgParser->setFunctionHook( 'arraymerge', array( &$wgArrayExtension, 'arraymerge' ) ); |
773 | | - $wgParser->setFunctionHook( 'arrayslice', array( &$wgArrayExtension, 'arrayslice' ) ); |
| 772 | + $parser->setFunctionHook( 'arraymerge', array( &$wgArrayExtension, 'arraymerge' ) ); |
| 773 | + $parser->setFunctionHook( 'arrayslice', array( &$wgArrayExtension, 'arrayslice' ) ); |
774 | 774 | |
775 | | - $wgParser->setFunctionHook( 'arrayunion', array( &$wgArrayExtension, 'arrayunion' ) ); |
776 | | - $wgParser->setFunctionHook( 'arrayintersect', array( &$wgArrayExtension, 'arrayintersect' ) ); |
777 | | - $wgParser->setFunctionHook( 'arraydiff', array( &$wgArrayExtension, 'arraydiff' ) ); |
778 | | - $wgParser->setFunctionHook( 'arraysearcharray', array( &$wgArrayExtension, 'arraysearcharray' ) ); |
| 775 | + $parser->setFunctionHook( 'arrayunion', array( &$wgArrayExtension, 'arrayunion' ) ); |
| 776 | + $parser->setFunctionHook( 'arrayintersect', array( &$wgArrayExtension, 'arrayintersect' ) ); |
| 777 | + $parser->setFunctionHook( 'arraydiff', array( &$wgArrayExtension, 'arraydiff' ) ); |
| 778 | + $parser->setFunctionHook( 'arraysearcharray', array( &$wgArrayExtension, 'arraysearcharray' ) ); |
| 779 | + |
| 780 | + return true; |
779 | 781 | } |
780 | 782 | |
781 | 783 | function efArrayExtensionLanguageGetMagic( &$magicWords, $langCode ) { |