r65345 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65344‎ | r65345 | r65346 >
Date:21:37, 20 April 2010
Author:siebrand
Status:deferred
Tags:
Comment:
* changed $wgExtensionFunctions to $wgHooks['ParserFirstCallInit'][]
* stylize.php, trailing whitespace removed
* bumped version
Modified paths:
  • /trunk/extensions/CategoryTests/CategoryTests.i18n.magic.php (modified) (history)
  • /trunk/extensions/CategoryTests/CategoryTests.i18n.php (modified) (history)
  • /trunk/extensions/CategoryTests/CategoryTests.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTests/CategoryTests.i18n.magic.php
@@ -1,7 +1,7 @@
22 <?php
33 /**
44 * Magic word localization for the CategoryTests extension
5 -*/
 5+ */
66
77 $magicWords = array();
88
Index: trunk/extensions/CategoryTests/CategoryTests.i18n.php
@@ -3,7 +3,7 @@
44 * Internationalization file for the CategoryTests extension
55 */
66
7 -require_once( dirname(__FILE__) . '/CategoryTests.i18n.magic.php' );
 7+require_once( dirname( __FILE__ ) . '/CategoryTests.i18n.magic.php' );
88
99 $messages = array();
1010
Index: trunk/extensions/CategoryTests/CategoryTests.php
@@ -11,11 +11,11 @@
1212 }
1313
1414 // credits and hooks
15 -$wgExtensionFunctions[] = 'wfCategoryTests';
 15+$wgHooks['ParserFirstCallInit'][] = 'wfCategoryTests';
1616 $wgExtensionCredits['parserhook'][] = array(
1717 'path' => __FILE__,
1818 'name' => 'Category Tests',
19 - 'version' => '1.4',
 19+ 'version' => '1.5',
2020 'url' => 'http://www.mediawiki.org/wiki/Extension:CategoryTests',
2121 'author' => 'Ryan Schmidt',
2222 'descriptionmsg' => 'categorytests-desc',
@@ -23,17 +23,16 @@
2424
2525 $wgExtensionMessagesFiles['CategoryTests'] = dirname( __FILE__ ) . '/CategoryTests.i18n.php';
2626
27 -function wfCategoryTests() {
28 - global $wgParser, $wgExtCategoryTests;
 27+function wfCategoryTests( $parser ) {
 28+ global $wgExtCategoryTests;
2929
3030 $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' ) );
3434 }
3535
36 -Class ExtCategoryTests {
37 -
 36+class ExtCategoryTests {
3837 function ifcategory( &$parser, $category = '', $then = '', $else = '', $pagename = '' ) {
3938 if ( $category === '' ) {
4039 return $then;
@@ -44,13 +43,13 @@
4544 $ns = $title->getNamespace();
4645 } else {
4746 $title = Title::newFromText( $pagename );
48 - if ( !($title instanceOf Title) || !$title->exists() )
 47+ if ( !( $title instanceOf Title ) || !$title->exists() )
4948 return $else;
5049 $page = $title->getDBkey();
5150 $ns = $title->getNamespace();
5251 }
5352 $cattitle = Title::makeTitleSafe( NS_CATEGORY, $category );
54 - if(!($cattitle instanceOf Title)) {
 53+ if ( !( $cattitle instanceOf Title ) ) {
5554 return $else;
5655 }
5756 $catkey = $cattitle->getDBkey();
@@ -73,7 +72,7 @@
7473 $ns = $title->getNamespace();
7574 } else {
7675 $title = Title::newFromText( $pagename );
77 - if ( !($title instanceOf Title) || !$title->exists() )
 76+ if ( !( $title instanceOf Title ) || !$title->exists() )
7877 return $then;
7978 $page = $title->getDBkey();
8079 $ns = $title->getNamespace();

Status & tagging log