Index: trunk/extensions/SemanticSignup/SemanticSignup.php |
— | — | @@ -54,33 +54,16 @@ |
55 | 55 | $wgExtensionMessagesFiles['SemanticSignup'] = dirname( __FILE__ ) . '/SemanticSignup.i18n.php'; |
56 | 56 | $wgExtensionAliasesFiles['SemanticSignup'] = dirname( __FILE__ ) . '/SemanticSignup.i18n.aliases.php'; |
57 | 57 | |
| 58 | +$wgAutoloadClasses['SemanticSignupHooks'] = dirname( __FILE__ ) . '/SemanticSignup.hooks.php'; |
58 | 59 | $wgAutoloadClasses['SemanticSignup'] = dirname( __FILE__ ) . '/includes/SES_Special.php'; |
59 | 60 | $wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_Special.php'; |
60 | | - |
61 | 61 | $wgAutoloadClasses['SES_DataChecker'] = dirname( __FILE__ ) . '/includes/SES_Utils.php'; |
62 | | - |
63 | 62 | $wgAutoloadClasses['SES_SignupFields'] = dirname( __FILE__ ) . '/includes/SES_SignupFields.php'; |
64 | 63 | $wgAutoloadClasses['CreateUserFieldsTemplate'] = dirname( __FILE__ ) . '/includes/SES_SignupFields.php'; |
65 | 64 | |
66 | 65 | $wgSpecialPages['SemanticSignup'] = 'SemanticSignup'; |
67 | 66 | |
68 | | -if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
69 | | - $wgHooks['ParserFirstCallInit'][] = 'SES_SignupFields::setup'; |
70 | | -} else { |
71 | | - $wgExtensionFunctions[] = 'SES_SignupFields::setup'; |
72 | | -} |
| 67 | +$wgHooks['UserCreateForm'][] = 'SemanticSignupHooks::onUserCreateForm'; |
| 68 | +$wgHooks['ParserFirstCallInit'][] = 'SemanticSignupHooks::onParserFirstCallInit'; |
73 | 69 | |
74 | | -function sesCreateUserRedirect($template) |
75 | | -{ |
76 | | - $semantic_signup_title = SemanticSignup::getTitleFor('SemanticSignup'); |
77 | | - $url = $semantic_signup_title->escapeFullURL(); |
78 | | - |
79 | | - global $wgOut; |
80 | | - $wgOut->redirect($url); |
81 | | - |
82 | | - return false; |
83 | | -} |
84 | | - |
85 | | -$wgHooks['UserCreateForm'][] = 'sesCreateUserRedirect'; |
86 | | - |
87 | 70 | require_once 'SemanticSignup.settings.php'; |
Index: trunk/extensions/SemanticSignup/SemanticSignup.hooks.php |
— | — | @@ -0,0 +1,44 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Static class for hooks handled by the SemanticSignup extension. |
| 6 | + * |
| 7 | + * @since 0.3 |
| 8 | + * |
| 9 | + * @file SemanticSignup.hooks.php |
| 10 | + * @ingroup SemanticSignup |
| 11 | + * |
| 12 | + * @licence GNU GPL v3+ |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +final class SemanticSignupHooks { |
| 16 | + |
| 17 | + /** |
| 18 | + * @since 0.3 |
| 19 | + * |
| 20 | + * @param $template |
| 21 | + * |
| 22 | + * @return false |
| 23 | + */ |
| 24 | + public static function onUserCreateForm( $template ) { |
| 25 | + $semantic_signup_title = SemanticSignup::getTitleFor( 'SemanticSignup' ); |
| 26 | + $url = $semantic_signup_title->escapeFullURL(); |
| 27 | + |
| 28 | + global $wgOut; |
| 29 | + $wgOut->redirect( $url ); |
| 30 | + |
| 31 | + return false; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @since 0.3 |
| 36 | + * |
| 37 | + * @return true |
| 38 | + */ |
| 39 | + public static function onParserFirstCallInit() { |
| 40 | + global $wgParser; |
| 41 | + $wgParser->setHook( 'signupfields', 'SES_SignupFields::render' ); |
| 42 | + return true; |
| 43 | + } |
| 44 | + |
| 45 | +} |
Property changes on: trunk/extensions/SemanticSignup/SemanticSignup.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 46 | + native |
Index: trunk/extensions/SemanticSignup/includes/SES_SignupFields.php |
— | — | @@ -184,10 +184,4 @@ |
185 | 185 | return $text; |
186 | 186 | } |
187 | 187 | |
188 | | - public static function setup() |
189 | | - { |
190 | | - global $wgParser; |
191 | | - $wgParser->setHook( 'signupfields', 'SES_SignupFields::render' ); |
192 | | - return true; |
193 | | - } |
194 | 188 | } |