| Index: trunk/extensions/LinkOpenID/LinkOpenID.i18n.php |
| — | — | @@ -6,37 +6,37 @@ |
| 7 | 7 | * @copyright 2008 Michael Holzt |
| 8 | 8 | * @license GNU General Public License 2.0 |
| 9 | 9 | */ |
| 10 | | - |
| | 10 | + |
| 11 | 11 | $messages = array(); |
| 12 | | - |
| | 12 | + |
| 13 | 13 | /** English |
| 14 | 14 | * @author Michael Holzt <kju@fqdn.org> |
| 15 | 15 | */ |
| 16 | 16 | $messages['en'] = array( |
| 17 | | - # for Special:Version |
| 18 | | - 'linkopenid-desc' => 'Allow users to link their account to an external OpenID', |
| 19 | | - |
| 20 | | - # for Special:Preferences |
| 21 | | - 'linkopenid-prefs' => 'OpenID', |
| 22 | | - 'linkopenid-prefstext-pre' => 'If you have a OpenID from an external provider you can specify it here. This allows you to use your userpage as a OpenID as well.', |
| 23 | | - 'linkopenid-prefstext-openid' => 'Your OpenID:', |
| 24 | | - 'linkopenid-prefstext-v1url' => 'Server-URL for OpenID Version 1.1:', |
| 25 | | - 'linkopenid-prefstext-v2url' => 'Server-URL for OpenID Version 2:' |
| | 17 | + # for Special:Version |
| | 18 | + 'linkopenid-desc' => 'Allow users to link their account to an external OpenID', |
| | 19 | + |
| | 20 | + # for Special:Preferences |
| | 21 | + 'linkopenid-prefs' => 'OpenID', |
| | 22 | + 'linkopenid-prefstext-pre' => 'If you have a OpenID from an external provider you can specify it here. |
| | 23 | +This allows you to use your userpage as an OpenID as well.', |
| | 24 | + 'linkopenid-prefstext-openid' => 'Your OpenID:', |
| | 25 | + 'linkopenid-prefstext-v1url' => 'Server-URL for OpenID Version 1.1:', |
| | 26 | + 'linkopenid-prefstext-v2url' => 'Server-URL for OpenID Version 2:' |
| 26 | 27 | ); |
| 27 | | - |
| | 28 | + |
| 28 | 29 | /** German |
| 29 | 30 | * @author Michael Holzt <kju@fqdn.org> |
| 30 | 31 | */ |
| 31 | | - |
| 32 | 32 | $messages['de'] = array( |
| 33 | | - # for Special:Version |
| 34 | | - 'linkopenid-desc' => 'Erlaubt Benutzern eine externe OpenID ihrem Account zuzuordnen', |
| 35 | | - |
| 36 | | - # for Special:Preferences |
| 37 | | - 'linkopenid-prefs' => 'OpenID', |
| 38 | | - 'linkopenid-prefstext-pre' => 'Wenn Sie eine OpenID bei einem externen Anbieter besitzen, können Sie diese hier angeben. Dies ermöglicht Ihnen die alternative Nutzung Ihrer Benutzerseite als OpenID.', |
| 39 | | - 'linkopenid-prefstext-openid' => 'Ihre OpenID:', |
| 40 | | - 'linkopenid-prefstext-v1url' => 'Server-URL für OpenID Version 1.1:', |
| 41 | | - 'linkopenid-prefstext-v2url' => 'Server-URL für OpenID Version 2:' |
| | 33 | + # for Special:Version |
| | 34 | + 'linkopenid-desc' => 'Erlaubt Benutzern eine externe OpenID ihrem Account zuzuordnen', |
| | 35 | + |
| | 36 | + # for Special:Preferences |
| | 37 | + 'linkopenid-prefs' => 'OpenID', |
| | 38 | + 'linkopenid-prefstext-pre' => 'Wenn Sie eine OpenID bei einem externen Anbieter besitzen, können Sie diese hier angeben. |
| | 39 | +Dies ermöglicht Ihnen die alternative Nutzung Ihrer Benutzerseite als OpenID.', |
| | 40 | + 'linkopenid-prefstext-openid' => 'Ihre OpenID:', |
| | 41 | + 'linkopenid-prefstext-v1url' => 'Server-URL für OpenID Version 1.1:', |
| | 42 | + 'linkopenid-prefstext-v2url' => 'Server-URL für OpenID Version 2:' |
| 42 | 43 | ); |
| 43 | | -?> |
| Index: trunk/extensions/LinkOpenID/LinkOpenID.php |
| — | — | @@ -6,122 +6,113 @@ |
| 7 | 7 | * @copyright 2008 Michael Holzt |
| 8 | 8 | * @license GNU General Public License 2.0 |
| 9 | 9 | */ |
| 10 | | - |
| | 10 | + |
| 11 | 11 | if ( !defined('MEDIAWIKI')) { |
| 12 | | - echo('This file is an extension for the MediaWiki software and cannot be used standalone.\n'); |
| 13 | | - die(1); |
| | 12 | + echo('This file is an extension for the MediaWiki software and cannot be used standalone.\n'); |
| | 13 | + die(1); |
| 14 | 14 | } |
| 15 | | - |
| | 15 | + |
| 16 | 16 | $wgExtensionCredits['other'][] = array( |
| 17 | | - 'name' => 'LinkOpenID', |
| 18 | | - 'author' => 'Michael Holzt', |
| 19 | | - 'description' => 'allow users to link their account to an external OpenID', |
| 20 | | - 'descriptionmsg' => 'linkopenid-desc' |
| | 17 | + 'name' => 'LinkOpenID', |
| | 18 | + 'author' => 'Michael Holzt', |
| | 19 | + 'description' => 'allow users to link their account to an external OpenID', |
| | 20 | + 'descriptionmsg' => 'linkopenid-desc', |
| | 21 | + 'svn-date' => '$LastChangedDate$', |
| | 22 | + 'svn-revision' => '$LastChangedRevision$', |
| | 23 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:LinkOpenID', |
| 21 | 24 | ); |
| 22 | | - |
| | 25 | + |
| 23 | 26 | $wgHooks['ArticleViewHeader'][] = 'wfLinkOpenIDViewHeader'; |
| 24 | 27 | $wgHooks['InitPreferencesForm'][] = 'wfLinkOpenIDInitPrefs'; |
| 25 | 28 | $wgHooks['RenderPreferencesForm'][] = 'wfLinkOpenIDRenderPrefs'; |
| 26 | 29 | $wgHooks['SavePreferences'][] = 'wfLinkOpenIDSavePrefs'; |
| 27 | 30 | $wgHooks['ResetPreferences'][] = 'wfLinkOpenIDResetprefs'; |
| 28 | | - |
| | 31 | + |
| 29 | 32 | $dir = dirname(__FILE__) . '/'; |
| 30 | 33 | $wgExtensionMessagesFiles['LinkOpenID'] = $dir . 'LinkOpenID.i18n.php'; |
| 31 | | - |
| 32 | | -/* --- */ |
| 33 | | - |
| | 34 | + |
| 34 | 35 | function wfLinkOpenIDViewHeader($article) |
| 35 | 36 | { |
| 36 | | - global $wgOut; |
| 37 | | - |
| 38 | | - /* We only care about the main page of any user */ |
| 39 | | - $nt = $article->getTitle(); |
| 40 | | - if ( $nt && $nt->getNamespace() == NS_USER && |
| 41 | | - strpos($nt->getText(), '/') === false ) { |
| 42 | | - |
| 43 | | - $user = User::newFromName($nt->getText()); |
| 44 | | - if ( $user && $user->getID() != 0) { |
| 45 | | - |
| 46 | | - $openid = $user->getOption('wflinkopenid_openid'); |
| 47 | | - |
| 48 | | - if ( $openid != '' ) { |
| 49 | | - $v1url = $user->getOption('wflinkopenid_v1url'); |
| 50 | | - $v2url = $user->getOption('wflinkopenid_v2url'); |
| 51 | | - |
| 52 | | - if ( $v1url != '' ) { |
| 53 | | - $wgOut->addLink( array('rel' => 'openid.server', 'href' => $v1url) ); |
| 54 | | - $wgOut->addLink( array('rel' => 'openid.delegate', 'href' => $openid) ); |
| 55 | | - } |
| 56 | | - |
| 57 | | - if ( $v2url != '' ) { |
| 58 | | - $wgOut->addLink( array('rel' => 'openid2.provider', 'href' => $v2url) ); |
| 59 | | - $wgOut->addLink( array('rel' => 'openid2.local_id', 'href' => $openid) ); |
| 60 | | - } |
| 61 | | - } |
| 62 | | - } |
| 63 | | - } |
| 64 | | - |
| 65 | | - return TRUE; |
| 66 | | -} |
| 67 | | - |
| 68 | | -/* --- */ |
| 69 | | - |
| | 37 | + global $wgOut; |
| | 38 | + |
| | 39 | + /* We only care about the main page of any user */ |
| | 40 | + $nt = $article->getTitle(); |
| | 41 | + if ( $nt && $nt->getNamespace() == NS_USER && |
| | 42 | + strpos($nt->getText(), '/') === false ) { |
| | 43 | + |
| | 44 | + $user = User::newFromName($nt->getText()); |
| | 45 | + if ( $user && $user->getID() != 0) { |
| | 46 | + |
| | 47 | + $openid = $user->getOption('wflinkopenid_openid'); |
| | 48 | + |
| | 49 | + if ( $openid != '' ) { |
| | 50 | + $v1url = $user->getOption('wflinkopenid_v1url'); |
| | 51 | + $v2url = $user->getOption('wflinkopenid_v2url'); |
| | 52 | + |
| | 53 | + if ( $v1url != '' ) { |
| | 54 | + $wgOut->addLink( array('rel' => 'openid.server', 'href' => $v1url) ); |
| | 55 | + $wgOut->addLink( array('rel' => 'openid.delegate', 'href' => $openid) ); |
| | 56 | + } |
| | 57 | + |
| | 58 | + if ( $v2url != '' ) { |
| | 59 | + $wgOut->addLink( array('rel' => 'openid2.provider', 'href' => $v2url) ); |
| | 60 | + $wgOut->addLink( array('rel' => 'openid2.local_id', 'href' => $openid) ); |
| | 61 | + } |
| | 62 | + } |
| | 63 | + } |
| | 64 | + } |
| | 65 | + |
| | 66 | + return TRUE; |
| | 67 | +} |
| | 68 | + |
| 70 | 69 | function wfLinkOpenIDInitPrefs($prefs, $request) { |
| 71 | | - $prefs->wfLinkOpenID = Array(); |
| 72 | | - $prefs->wfLinkOpenID['openid'] = $request->getVal('wflinkopenid_openid'); |
| 73 | | - $prefs->wfLinkOpenID['v1url'] = $request->getVal('wflinkopenid_v1url'); |
| 74 | | - $prefs->wfLinkOpenID['v2url'] = $request->getVal('wflinkopenid_v2url'); |
| 75 | | - return TRUE; |
| | 70 | + $prefs->wfLinkOpenID = Array(); |
| | 71 | + $prefs->wfLinkOpenID['openid'] = $request->getVal('wflinkopenid_openid'); |
| | 72 | + $prefs->wfLinkOpenID['v1url'] = $request->getVal('wflinkopenid_v1url'); |
| | 73 | + $prefs->wfLinkOpenID['v2url'] = $request->getVal('wflinkopenid_v2url'); |
| | 74 | + return TRUE; |
| 76 | 75 | } |
| 77 | | - |
| 78 | | -/* --- */ |
| 79 | | - |
| | 76 | + |
| 80 | 77 | function wfLinkOpenIDRenderPrefs($prefs, $out) { |
| 81 | | - wfLoadExtensionMessages( 'LinkOpenID' ); |
| 82 | | - |
| 83 | | - $out->addHTML( "<fieldset><legend>" . |
| 84 | | - wfMsgHtml( 'linkopenid-prefs' ) . |
| 85 | | - "</legend>"); |
| 86 | | - |
| 87 | | - $out->addWikiMsg( 'linkopenid-prefstext-pre' ); |
| 88 | | - |
| 89 | | - $out->addHTML( |
| 90 | | - "<table>" . |
| 91 | | - |
| 92 | | - "<tr><td>" . wfMsgHtml( 'linkopenid-prefstext-openid' ) . "</td><td>" . |
| 93 | | - "<input type='text' name='wflinkopenid_openid' size='60' value='" . |
| 94 | | - htmlentities($prefs->wfLinkOpenID['openid']) . "'></td></tr>" . |
| 95 | | - |
| 96 | | - "<tr><td>" . wfMsgHtml( 'linkopenid-prefstext-v1url' ) . "</td><td>" . |
| 97 | | - "<input type='text' name='wflinkopenid_v1url' size='60' value='" . |
| 98 | | - htmlentities($prefs->wfLinkOpenID['v1url']) . "'></td></tr>" . |
| 99 | | - |
| 100 | | - "<tr><td>" . wfMsgHtml( 'linkopenid-prefstext-v2url' ) . "</td><td>" . |
| 101 | | - "<input type='text' name='wflinkopenid_v2url' size='60' value='" . |
| 102 | | - htmlentities($prefs->wfLinkOpenID['v2url']) . "'></td></tr>" . |
| 103 | | - "</table></fieldset>" |
| 104 | | - ); |
| 105 | | - |
| 106 | | - return TRUE; |
| | 78 | + wfLoadExtensionMessages( 'LinkOpenID' ); |
| | 79 | + |
| | 80 | + $out->addHTML( "<fieldset><legend>" . |
| | 81 | + wfMsgHtml( 'linkopenid-prefs' ) . |
| | 82 | + "</legend>"); |
| | 83 | + |
| | 84 | + $out->addWikiMsg( 'linkopenid-prefstext-pre' ); |
| | 85 | + |
| | 86 | + $out->addHTML( |
| | 87 | + "<table>" . |
| | 88 | + |
| | 89 | + "<tr><td>" . wfMsgHtml( 'linkopenid-prefstext-openid' ) . "</td><td>" . |
| | 90 | + "<input type='text' name='wflinkopenid_openid' size='60' value='" . |
| | 91 | + htmlentities($prefs->wfLinkOpenID['openid']) . "'></td></tr>" . |
| | 92 | + |
| | 93 | + "<tr><td>" . wfMsgHtml( 'linkopenid-prefstext-v1url' ) . "</td><td>" . |
| | 94 | + "<input type='text' name='wflinkopenid_v1url' size='60' value='" . |
| | 95 | + htmlentities($prefs->wfLinkOpenID['v1url']) . "'></td></tr>" . |
| | 96 | + |
| | 97 | + "<tr><td>" . wfMsgHtml( 'linkopenid-prefstext-v2url' ) . "</td><td>" . |
| | 98 | + "<input type='text' name='wflinkopenid_v2url' size='60' value='" . |
| | 99 | + htmlentities($prefs->wfLinkOpenID['v2url']) . "'></td></tr>" . |
| | 100 | + "</table></fieldset>" |
| | 101 | + ); |
| | 102 | + |
| | 103 | + return TRUE; |
| 107 | 104 | } |
| 108 | | - |
| 109 | | -/* --- */ |
| 110 | | - |
| | 105 | + |
| 111 | 106 | function wfLinkOpenIDSavePrefs($form, $user, &$message) { |
| 112 | | - $user->setOption('wflinkopenid_openid', $form->wfLinkOpenID['openid'] ); |
| 113 | | - $user->setOption('wflinkopenid_v1url', $form->wfLinkOpenID['v1url'] ); |
| 114 | | - $user->setOption('wflinkopenid_v2url', $form->wfLinkOpenID['v2url'] ); |
| 115 | | - return TRUE; |
| | 107 | + $user->setOption('wflinkopenid_openid', $form->wfLinkOpenID['openid'] ); |
| | 108 | + $user->setOption('wflinkopenid_v1url', $form->wfLinkOpenID['v1url'] ); |
| | 109 | + $user->setOption('wflinkopenid_v2url', $form->wfLinkOpenID['v2url'] ); |
| | 110 | + return TRUE; |
| 116 | 111 | } |
| 117 | | - |
| 118 | | -/* --- */ |
| 119 | | - |
| | 112 | + |
| 120 | 113 | function wfLinkOpenIDResetPrefs($prefs, $user) { |
| 121 | | - $prefs->wfLinkOpenID = Array(); |
| 122 | | - $prefs->wfLinkOpenID['openid'] = $user->getOption('wflinkopenid_openid'); |
| 123 | | - $prefs->wfLinkOpenID['v1url'] = $user->getOption('wflinkopenid_v1url'); |
| 124 | | - $prefs->wfLinkOpenID['v2url'] = $user->getOption('wflinkopenid_v2url'); |
| 125 | | - return TRUE; |
| | 114 | + $prefs->wfLinkOpenID = Array(); |
| | 115 | + $prefs->wfLinkOpenID['openid'] = $user->getOption('wflinkopenid_openid'); |
| | 116 | + $prefs->wfLinkOpenID['v1url'] = $user->getOption('wflinkopenid_v1url'); |
| | 117 | + $prefs->wfLinkOpenID['v2url'] = $user->getOption('wflinkopenid_v2url'); |
| | 118 | + return TRUE; |
| 126 | 119 | } |
| 127 | | - |
| 128 | | -?> |
| Property changes on: trunk/extensions/LinkOpenID/LinkOpenID.php |
| ___________________________________________________________________ |
| Name: svn:keywords |
| 129 | 120 | + LastChangedRevision LastChangedDate |