Index: trunk/extensions/CategoryTests/CategoryTests.i18n.magic.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | 4 | * Magic word localization for the CategoryTests extension |
5 | | -*/ |
| 5 | + */ |
6 | 6 | |
7 | 7 | $magicWords = array(); |
8 | 8 | |
Index: trunk/extensions/CategoryTests/CategoryTests.i18n.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * Internationalization file for the CategoryTests extension |
5 | 5 | */ |
6 | 6 | |
7 | | -require_once( dirname(__FILE__) . '/CategoryTests.i18n.magic.php' ); |
| 7 | +require_once( dirname( __FILE__ ) . '/CategoryTests.i18n.magic.php' ); |
8 | 8 | |
9 | 9 | $messages = array(); |
10 | 10 | |
Index: trunk/extensions/CategoryTests/CategoryTests.php |
— | — | @@ -11,11 +11,11 @@ |
12 | 12 | } |
13 | 13 | |
14 | 14 | // credits and hooks |
15 | | -$wgExtensionFunctions[] = 'wfCategoryTests'; |
| 15 | +$wgHooks['ParserFirstCallInit'][] = 'wfCategoryTests'; |
16 | 16 | $wgExtensionCredits['parserhook'][] = array( |
17 | 17 | 'path' => __FILE__, |
18 | 18 | 'name' => 'Category Tests', |
19 | | - 'version' => '1.4', |
| 19 | + 'version' => '1.5', |
20 | 20 | 'url' => 'http://www.mediawiki.org/wiki/Extension:CategoryTests', |
21 | 21 | 'author' => 'Ryan Schmidt', |
22 | 22 | 'descriptionmsg' => 'categorytests-desc', |
— | — | @@ -23,17 +23,16 @@ |
24 | 24 | |
25 | 25 | $wgExtensionMessagesFiles['CategoryTests'] = dirname( __FILE__ ) . '/CategoryTests.i18n.php'; |
26 | 26 | |
27 | | -function wfCategoryTests() { |
28 | | - global $wgParser, $wgExtCategoryTests; |
| 27 | +function wfCategoryTests( $parser ) { |
| 28 | + global $wgExtCategoryTests; |
29 | 29 | |
30 | 30 | $wgExtCategoryTests = new ExtCategoryTests(); |
31 | | - $wgParser->setFunctionHook( 'ifcategory', array( &$wgExtCategoryTests, 'ifcategory' ) ); |
32 | | - $wgParser->setFunctionHook( 'ifnocategories', array( &$wgExtCategoryTests, 'ifnocategories' ) ); |
33 | | - $wgParser->setFunctionHook( 'switchcategory', array( &$wgExtCategoryTests, 'switchcategory' ) ); |
| 31 | + $parser->setFunctionHook( 'ifcategory', array( &$wgExtCategoryTests, 'ifcategory' ) ); |
| 32 | + $parser->setFunctionHook( 'ifnocategories', array( &$wgExtCategoryTests, 'ifnocategories' ) ); |
| 33 | + $parser->setFunctionHook( 'switchcategory', array( &$wgExtCategoryTests, 'switchcategory' ) ); |
34 | 34 | } |
35 | 35 | |
36 | | -Class ExtCategoryTests { |
37 | | - |
| 36 | +class ExtCategoryTests { |
38 | 37 | function ifcategory( &$parser, $category = '', $then = '', $else = '', $pagename = '' ) { |
39 | 38 | if ( $category === '' ) { |
40 | 39 | return $then; |
— | — | @@ -44,13 +43,13 @@ |
45 | 44 | $ns = $title->getNamespace(); |
46 | 45 | } else { |
47 | 46 | $title = Title::newFromText( $pagename ); |
48 | | - if ( !($title instanceOf Title) || !$title->exists() ) |
| 47 | + if ( !( $title instanceOf Title ) || !$title->exists() ) |
49 | 48 | return $else; |
50 | 49 | $page = $title->getDBkey(); |
51 | 50 | $ns = $title->getNamespace(); |
52 | 51 | } |
53 | 52 | $cattitle = Title::makeTitleSafe( NS_CATEGORY, $category ); |
54 | | - if(!($cattitle instanceOf Title)) { |
| 53 | + if ( !( $cattitle instanceOf Title ) ) { |
55 | 54 | return $else; |
56 | 55 | } |
57 | 56 | $catkey = $cattitle->getDBkey(); |
— | — | @@ -73,7 +72,7 @@ |
74 | 73 | $ns = $title->getNamespace(); |
75 | 74 | } else { |
76 | 75 | $title = Title::newFromText( $pagename ); |
77 | | - if ( !($title instanceOf Title) || !$title->exists() ) |
| 76 | + if ( !( $title instanceOf Title ) || !$title->exists() ) |
78 | 77 | return $then; |
79 | 78 | $page = $title->getDBkey(); |
80 | 79 | $ns = $title->getNamespace(); |