http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94257
Revision: 94257
Author: jeroendedauw
Date: 2011-08-11 17:18:17 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
work on v0.3
Modified Paths:
--------------
trunk/extensions/SemanticSignup/INSTALL
trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php
trunk/extensions/SemanticSignup/SemanticSignup.i18n.php
trunk/extensions/SemanticSignup/SemanticSignup.php
trunk/extensions/SemanticSignup/SemanticSignup.settings.php
trunk/extensions/SemanticSignup/includes/SES_Special.php
trunk/extensions/SemanticSignup/release-notes
Modified: trunk/extensions/SemanticSignup/INSTALL
===================================================================
--- trunk/extensions/SemanticSignup/INSTALL 2011-08-11 16:29:22 UTC (rev
94256)
+++ trunk/extensions/SemanticSignup/INSTALL 2011-08-11 17:18:17 UTC (rev
94257)
@@ -10,6 +10,7 @@
* MediaWiki 1.16 or above
* Semantic MediaWiki 1.6 or above
+* Semantic Forms 2.0 or above
* PHP 5.2 or above
== Download ==
Modified: trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php
===================================================================
--- trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php
2011-08-11 16:29:22 UTC (rev 94256)
+++ trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php
2011-08-11 17:18:17 UTC (rev 94257)
@@ -7,5 +7,5 @@
$aliases = array();
$aliases['en'] = array(
- 'Semantic Signup' => array('Semantic Signup')
+ 'SemanticSignup' => array( 'SemanticSignup', 'Semantic Signup' )
);
Modified: trunk/extensions/SemanticSignup/SemanticSignup.i18n.php
===================================================================
--- trunk/extensions/SemanticSignup/SemanticSignup.i18n.php 2011-08-11
16:29:22 UTC (rev 94256)
+++ trunk/extensions/SemanticSignup/SemanticSignup.i18n.php 2011-08-11
17:18:17 UTC (rev 94257)
@@ -18,4 +18,4 @@
'createforbidden' => 'Current user is not allowed to create accounts',
'throttlehit' => 'New user accounts number maximum per day has been
exceeded for this IP',
'ses_userexists' => 'User already exists'
-);
\ No newline at end of file
+);
Modified: trunk/extensions/SemanticSignup/SemanticSignup.php
===================================================================
--- trunk/extensions/SemanticSignup/SemanticSignup.php 2011-08-11 16:29:22 UTC
(rev 94256)
+++ trunk/extensions/SemanticSignup/SemanticSignup.php 2011-08-11 17:18:17 UTC
(rev 94257)
@@ -25,18 +25,22 @@
}
if ( version_compare( $wgVersion, '1.16', '<' ) ) {
- die( '<b>Error:</b> Semantic Signup requires MediaWiki 1.16 or above.'
);
+ die( '<b>Error:</b> SemanticSignup requires MediaWiki 1.16 or above.' );
}
// Show a warning if Semantic MediaWiki is not loaded.
-if ( ! defined( 'SMW_VERSION' ) ) {
- die( '<b>Error:</b> You need to have <a
href="http://semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic
MediaWiki</a> installed in order to use Semantic Watchlist.' );
+if ( !defined( 'SMW_VERSION' ) ) {
+ die( '<b>Error:</b> You need to have <a
href="http://semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic
MediaWiki</a> installed in order to use SemanticSignup.' );
}
if ( version_compare( SMW_VERSION, '1.6 alpha', '<' ) ) {
die( '<b>Error:</b> Semantic Signup requires Semantic MediaWiki 1.6 or
above.' );
}
+if ( !defined( 'SF_VERSION' ) ) {
+ die( '<b>Error:</b> You need to have <a
href="http://semantic-mediawiki.org/wiki/Semantic_Forms">Semantic Forms</a>
installed in order to use SemanticSignup.' );
+}
+
define( 'SemanticSignup_VERSION', '0.3 alpha' );
$wgExtensionCredits[defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' :
'specialpage'][] = array(
@@ -54,6 +58,7 @@
$wgExtensionMessagesFiles['SemanticSignup'] = dirname( __FILE__ ) .
'/SemanticSignup.i18n.php';
$wgExtensionAliasesFiles['SemanticSignup'] = dirname( __FILE__ ) .
'/SemanticSignup.i18n.aliases.php';
+$wgAutoloadClasses['SemanticSignupSettings'] = dirname( __FILE__ ) .
'/SemanticSignup.settings.php';
$wgAutoloadClasses['SemanticSignupHooks'] = dirname( __FILE__ ) .
'/SemanticSignup.hooks.php';
$wgAutoloadClasses['SemanticSignup'] = dirname( __FILE__ ) .
'/includes/SES_Special.php';
$wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) .
'/includes/SES_Special.php';
@@ -63,7 +68,13 @@
$wgSpecialPages['SemanticSignup'] = 'SemanticSignup';
-$wgHooks['UserCreateForm'][] = 'SemanticSignupHooks::onUserCreateForm';
-$wgHooks['ParserFirstCallInit'][] =
'SemanticSignupHooks::onParserFirstCallInit';
+$egSemanticSignupSettings = array();
-require_once 'SemanticSignup.settings.php';
+$wgExtensionFunctions[] = 'efSemanticSignupSetup';
+
+function efSemanticSignupSetup() {
+ if ( !is_null( Title::newFromText( SemanticSignupSettings::get(
'formName' ), SF_NS_FORM ) ) ) {
+ $wgHooks['UserCreateForm'][] =
'SemanticSignupHooks::onUserCreateForm';
+ $wgHooks['ParserFirstCallInit'][] =
'SemanticSignupHooks::onParserFirstCallInit';
+ }
+}
Modified: trunk/extensions/SemanticSignup/SemanticSignup.settings.php
===================================================================
--- trunk/extensions/SemanticSignup/SemanticSignup.settings.php 2011-08-11
16:29:22 UTC (rev 94256)
+++ trunk/extensions/SemanticSignup/SemanticSignup.settings.php 2011-08-11
17:18:17 UTC (rev 94257)
@@ -12,18 +12,35 @@
* @ingroup SemanticSignup
*
* @licence GNU GPL v3+
- * @author Serg Kutny
* @author Jeroen De Dauw < [email protected] >
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 'Not an entry point.' );
+class SemanticSignupSettings {
+
+ protected static function getDefaultSettings() {
+ return array(
+ 'requireName' => false,
+ 'formName' => '',
+ 'botName' => '',
+ );
+ }
+
+ public static function getSettings() {
+ static $settings = false;
+
+ if ( $settings === false ) {
+ $settings = array_merge(
+ self::getDefaultSettings(),
+ $GLOBALS['egSemanticSignupSettings']
+ );
+ }
+
+ return $settings;
+ }
+
+ public static function get( $settingName ) {
+ $settings = self::getSettings();
+ return array_key_exists( $settingName, $settings ) ?
$settings[$settingName] : null;
+ }
+
}
-
-/*
- * I need real name to be required on user signup for my purposes
- * so I make this feature configurable
- */
-$sesRealNameRequired = false;
-$sesSignupFormName = '';
-$sesSignupBotName = '';
\ No newline at end of file
Modified: trunk/extensions/SemanticSignup/includes/SES_Special.php
===================================================================
--- trunk/extensions/SemanticSignup/includes/SES_Special.php 2011-08-11
16:29:22 UTC (rev 94256)
+++ trunk/extensions/SemanticSignup/includes/SES_Special.php 2011-08-11
17:18:17 UTC (rev 94257)
@@ -194,8 +194,7 @@
$user->setOption( 'language', $language );
global $wgEmailAuthentication;
- if( $wgEmailAuthentication &&
User::isValidEmailAddr($user->getEmail()) )
- {
+ if( $wgEmailAuthentication && User::isValidEmailAddr(
$user->getEmail() ) ){
$err = $user->sendConfirmationMail();
if (WikiError::isError($err))
throw new Exception(wfMsg('emailfailed'));
@@ -205,11 +204,8 @@
wfRunHooks('AddNewAccount', array($user));
}
- private function createUserPage()
- {
- global $sesSignupFormName;
-
- $form_title = Title::newFromText($sesSignupFormName,
SF_NS_FORM);
+ private function createUserPage() {
+ $form_title = Title::newFromText( SemanticSignupSettings::get(
'formName' ), SF_NS_FORM );
$form = new Article($form_title);
$form_definition = $form->getContent();
@@ -224,12 +220,10 @@
global $wgUser;
$wgUser = $this->mUserDataChecker->mUser;
- $user_page->doEdit($data_text, '', EDIT_FORCE_BOT);
+ $user_page->doEdit( $data_text, '', EDIT_FORCE_BOT );
}
- private function printForm()
- {
- global $sesSignupFormName;
+ private function printForm() {
global $sesSignupBotName;
global $wgUser;
@@ -245,7 +239,7 @@
$wgUser = User::newFromName($sesSignupBotName);
}
- $form_title = Title::newFromText($sesSignupFormName,
SF_NS_FORM);
+ $form_title = Title::newFromText( SemanticSignupSettings::get(
'formName' ), SF_NS_FORM );
$form = new Article($form_title);
$form_definition = $form->getContent();
Modified: trunk/extensions/SemanticSignup/release-notes
===================================================================
--- trunk/extensions/SemanticSignup/release-notes 2011-08-11 16:29:22 UTC
(rev 94256)
+++ trunk/extensions/SemanticSignup/release-notes 2011-08-11 17:18:17 UTC
(rev 94257)
@@ -1,6 +1,21 @@
-SemanticSignup
+These are the release notes for the SemanticSignup extension.
+
+Extension page on mediawiki.org:
http://www.mediawiki.org/wiki/Extension:SemanticSignup
+Latest version of the release notes:
http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticSignup/RELEASE-NOTES?view=co
-Version 0.2.0:
-- a new configuration setting $sesSignupBotName added;
-- README sections 3 and 4 updated.
+=== Version 0.3 ===
+2011-0x-xx
+
+* Added compatibility with MediaWiki 1.16 and above, removed compatibility
with MediaWiki below 1.16.
+* Added compatibility with Semantic MediaWiki 1.6 and above.
+* Added INSTALL file.
+* Rewrote setting handling.
+* Moved entry point to SemanticSignup.php.
+* Moved code to standard i18n, hooks and settings files.
+* Stylized code.
+
+=== Version 0.2 ===
+
+* a new configuration setting $sesSignupBotName added;
+* README sections 3 and 4 updated.
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs