Index: trunk/extensions/Storyboard/Storyboard.php |
— | — | @@ -33,33 +33,21 @@ |
34 | 34 | // Include the settings file. |
35 | 35 | require_once( $egStoryboardDir . 'Storyboard_Settings.php' ); |
36 | 36 | |
37 | | -// Register the initialization function of Storyboard. |
38 | | -$wgExtensionFunctions[] = 'efStoryboardSetup'; |
| 37 | +// Load classes |
| 38 | +$wgAutoloadClasses['SpecialStoryReview'] = $egStoryboardDir . 'specials/StoryReview/StoryReview_body.php'; |
| 39 | +$wgAutoloadClasses['TagStoryboard'] = $egStoryboardDir . 'tags/Storyboard/Storyboard_body.php'; |
| 40 | +$wgAutoloadClasses['TagStorysubmission'] = $egStoryboardDir . 'tags/Storysubmission/Storysubmission_body.php'; |
39 | 41 | |
40 | 42 | // Register the initernationalization and aliasing files of Storyboard. |
41 | 43 | $wgExtensionMessagesFiles['Storyboard'] = $egStoryboardDir . 'Storyboard.i18n.php'; |
42 | 44 | $wgExtensionAliasesFiles['Storyboard'] = $egStoryboardDir . 'Storyboard.alias.php'; |
43 | 45 | |
44 | 46 | // Load and register the StoryReview special page and register it's group. |
45 | | -$wgAutoloadClasses['SpecialStoryReview'] = $egStoryboardDir . 'specials/StoryReview/StoryReview_body.php'; |
46 | 47 | $wgSpecialPages['StoryReview'] = 'SpecialStoryReview'; |
47 | 48 | $wgSpecialPageGroups['StoryReview'] = 'contribution'; |
48 | 49 | |
49 | | -// Load the tag extension classes. |
50 | | -$wgAutoloadClasses['TagStoryboard'] = $egStoryboardDir . 'tags/Storyboard/Storyboard_body.php'; |
51 | | -$wgAutoloadClasses['TagStorysubmission'] = $egStoryboardDir . 'tags/Storysubmission/Storysubmission_body.php'; |
52 | | - |
53 | | -// Register the tag extensions. |
54 | | -// Avoid unstubbing $wgParser on setHook() too early on modern (1.12+) MW versions, as per r35980. |
55 | | -if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
56 | | - $wgHooks['ParserFirstCallInit'][] = 'efStoryboardStoryboardSetup'; |
57 | | - $wgHooks['ParserFirstCallInit'][] = 'efStoryboardStorysubmissionSetup'; |
58 | | -} else { // Otherwise do things the old fashioned way. |
59 | | - $wgExtensionFunctions[] = 'efStoryboardStoryboardSetup'; |
60 | | - $wgExtensionFunctions[] = 'efStoryboardStorysubmissionSetup'; |
61 | | -} |
62 | | - |
63 | | -// Hook for db updates. |
| 50 | +// Hooks |
| 51 | +$wgHooks['ParserFirstCallInit'][] = 'efStoryboardParserFirstCallInit'; |
64 | 52 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'efStoryboardSchemaUpdate'; |
65 | 53 | |
66 | 54 | /** |
— | — | @@ -71,25 +59,16 @@ |
72 | 60 | $wgAvailableRights[] = 'storyreview'; |
73 | 61 | $wgGroupPermissions['sysop' ]['storyreview'] = true; |
74 | 62 | |
75 | | -/** |
76 | | - * Initialization function for the Storyboard extension. |
77 | | - */ |
78 | | -function efStoryboardSetup() { |
79 | | - global $wgExtensionCredits; |
| 63 | +$wgExtensionCredits['parserhook'][] = array( |
| 64 | + 'path' => __FILE__, |
| 65 | + 'name' => wfMsg( 'storyboard-name' ), |
| 66 | + 'version' => Storyboard_VERSION, |
| 67 | + 'author' => array( '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' ), |
| 68 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Storyboard', |
| 69 | + 'description' => wfMsg( 'storyboard-desc' ), |
| 70 | + 'descriptionmsg' => 'storyboard-desc', |
| 71 | +); |
80 | 72 | |
81 | | - wfLoadExtensionMessages( 'Storyboard' ); |
82 | | - |
83 | | - $wgExtensionCredits['parserhook'][] = array( |
84 | | - 'path' => __FILE__, |
85 | | - 'name' => wfMsg( 'storyboard-name' ), |
86 | | - 'version' => Storyboard_VERSION, |
87 | | - 'author' => array( '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' ), |
88 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:Storyboard', |
89 | | - 'description' => wfMsg( 'storyboard-desc' ), |
90 | | - 'descriptionmsg' => 'storyboard-desc', |
91 | | - ); |
92 | | -} |
93 | | - |
94 | 73 | function efStoryboardSchemaUpdate() { |
95 | 74 | global $wgExtNewTables, $egStoryboardDir; |
96 | 75 | |
— | — | @@ -101,14 +80,8 @@ |
102 | 81 | return true; |
103 | 82 | } |
104 | 83 | |
105 | | -function efStoryboardStoryboardSetup() { |
106 | | - global $wgParser; |
107 | | - $wgParser->setHook( 'storyboard', array('TagStoryboard', 'render') ); |
| 84 | +function efStoryboardParserFirstCallInit( &$parser ) { |
| 85 | + $parser->setHook( 'storyboard', array('TagStoryboard', 'render') ); |
| 86 | + $parser->setHook( 'storysubmission', array('TagStorysubmission', 'render') ); |
108 | 87 | return true; |
109 | 88 | } |
110 | | - |
111 | | -function efStoryboardStorysubmissionSetup() { |
112 | | - global $wgParser; |
113 | | - $wgParser->setHook( 'storysubmission', array('TagStorysubmission', 'render') ); |
114 | | - return true; |
115 | | -} |