r75783 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75782‎ | r75783 | r75784 >
Date:12:24, 1 November 2010
Author:reedy
Status:reverted
Tags:
Comment:
Some basic code cleanup
Modified paths:
  • /trunk/extensions/FBConnect/FBConnectHooks.php (modified) (history)
  • /trunk/extensions/FBConnect/FBConnectPushEvent.php (modified) (history)
  • /trunk/extensions/FBConnect/PreferencesExtension.php (modified) (history)
  • /trunk/extensions/FBConnect/SpecialConnect.php (modified) (history)
  • /trunk/extensions/FBConnect/php-sdk/facebook.php (modified) (history)
  • /trunk/extensions/FBConnect/pushEvents/FBPush_OnAddImage.php (modified) (history)
  • /trunk/extensions/FBConnect/pushEvents/FBPush_OnLargeEdit.php (modified) (history)
  • /trunk/extensions/FBConnect/pushEvents/FBPush_OnWatchArticle.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FBConnect/SpecialConnect.php
@@ -39,7 +39,6 @@
4040 // Add this special page to the "login" group of special pages
4141 $wgSpecialPageGroups['Connect'] = 'login';
4242
43 - wfLoadExtensionMessages( 'FBConnect' );
4443 $this->userNamePrefix = wfMsg( 'fbconnect-usernameprefix' );
4544 }
4645
@@ -73,7 +72,7 @@
7473 global $wgUser, $facebook, $wgRequest;
7574
7675 if ( $wgRequest->getVal( 'action', '' ) == 'disconnect' ) {
77 - self::disconnectAction();
 76+ $this->disconnectAction();
7877 }
7978
8079 // Check to see if the user is already logged in
@@ -357,7 +356,6 @@
358357 if( !empty( $fbPushEventClasses ) ) {
359358 foreach( $fbPushEventClasses as $pushEventClassName ) {
360359 $pushObj = new $pushEventClassName;
361 - $className = get_class();
362360 $prefName = $pushObj->getUserPreferenceName();
363361
364362 $user->setOption( $prefName, ( $wgRequest->getCheck( $prefName ) ? '1' : '0' ) );
@@ -518,8 +516,6 @@
519517
520518 public function sendPage( $function, $arg = null ) {
521519 global $wgOut;
522 - // Setup the page for rendering
523 - wfLoadExtensionMessages( 'FBConnect' );
524520 $this->setHeaders();
525521 $wgOut->disallowUserJs(); # just in case...
526522 $wgOut->setRobotPolicy( 'noindex,nofollow' );
@@ -546,7 +542,7 @@
547543 }
548544
549545 private function displaySuccessLogin() {
550 - global $wgOut, $wgRequest;
 546+ global $wgOut, $wgRequest, $wgUser;
551547 $wgOut->setPageTitle(wfMsg('fbconnect-success'));
552548 $wgOut->addWikiMsg('fbconnect-successtext');
553549 // Run any hooks for UserLoginComplete
@@ -678,7 +674,7 @@
679675 * Displays the main connect form.
680676 */
681677 private function connectForm() {
682 - global $facebook, $wgOut, $wgUser, $wgSitename;
 678+ global $wgOut, $wgSitename;
683679 //$fbid = $facebook->getUser();
684680
685681 // Outputs the canonical name of the special page at the top of the page
Index: trunk/extensions/FBConnect/PreferencesExtension.php
@@ -159,8 +159,7 @@
160160 }
161161
162162 function mainPrefsForm( $status, $message = '' ) {
163 - global $wgOut, $wgRequest, $wgUser;
164 - global $wgExtensionPreferences;
 163+ global $wgOut, $wgUser, $wgExtensionPreferences;
165164 wfProfileIn( __METHOD__ );
166165
167166 // first get original form, then hack into it new options
Index: trunk/extensions/FBConnect/FBConnectPushEvent.php
@@ -75,7 +75,6 @@
7676 if( !empty( $fbPushEventClasses ) ) {
7777 foreach( $fbPushEventClasses as $pushEventClassName ) {
7878 $pushObj = new $pushEventClassName;
79 - $className = get_class();
8079 $prefName = $pushObj->getUserPreferenceName();
8180
8281 $preferences[$prefName] = array(
@@ -113,7 +112,6 @@
114113 if( !empty( $fbPushEventClasses ) ) {
115114 foreach( $fbPushEventClasses as $pushEventClassName ) {
116115 $pushObj = new $pushEventClassName;
117 - $className = get_class();
118116 $prefName = $pushObj->getUserPreferenceName();
119117
120118 $prefText = $wgLang->getUserToggle( $prefName );
Index: trunk/extensions/FBConnect/FBConnectHooks.php
@@ -30,7 +30,6 @@
3131 * out the Facebook ID of the user that the userpage belongs to.
3232 */
3333 public static function ArticleViewHeader( &$article, &$outputDone, &$pcache ) {
34 - global $wgOut;
3534 // Get the article title
3635 $nt = $article->getTitle();
3736 // If the page being viewed is a user page
@@ -85,7 +84,7 @@
8685 */
8786 public static function BeforePageDisplay( &$out, &$sk ) {
8887 global $wgVersion, $wgFbLogo, $wgFbScript, $wgFbExtensionScript, $wgFbIncludeJquery,
89 - $wgScriptPath, $wgJsMimeType, $wgStyleVersion;
 88+ $wgJsMimeType, $wgStyleVersion;
9089
9190 // Asynchronously load the Facebook Connect JavaScript SDK before the page's content
9291 if( !empty( $wgFbScript ) ) {
@@ -236,9 +235,8 @@
237236 * TODO: Better 'returnto' code
238237 */
239238 public static function PersonalUrls( &$personal_urls, &$wgTitle ) {
240 - global $facebook, $wgUser, $wgLang, $wgShowIPinHeader;
 239+ global $facebook, $wgUser;
241240 global $wgFbPersonalUrls, $wgFbConnectOnly;
242 - wfLoadExtensionMessages( 'FBConnect' );
243241
244242 /*
245243 * Personal URLs option: remove_user_talk_link
@@ -345,12 +343,11 @@
346344 * TODO!
347345 */
348346 public static function RenderPreferencesForm( $form, $output ) {
349 - global $facebook, $wgUser;
 347+ //global $facebook, $wgUser;
350348
351349 // This hook no longer seems to work...
352 - return true;
353350
354 - if( $facebook->getSession() ) {
 351+ /*if( $facebook->getSession() ) {
355352 $html = $output->getHTML();
356353 $name = $wgUser->getName();
357354 $i = strpos( $html, $name );
@@ -371,7 +368,9 @@
372369 }
373370 }
374371 }
375 - return true;
 372+ */
 373+
 374+ return true;
376375 }
377376
378377 /**
@@ -406,7 +405,7 @@
407406 * Special:ListUsers.
408407 */
409408 static function SpecialListusersHeaderForm( &$pager, &$out ) {
410 - global $wgFbUserRightsFromGroup, $facebook, $wgFbLogo;
 409+ global $wgFbUserRightsFromGroup, $facebook;
411410 if ( empty( $wgFbUserRightsFromGroup ) ) {
412411 return true;
413412 }
Index: trunk/extensions/FBConnect/pushEvents/FBPush_OnWatchArticle.php
@@ -17,7 +17,6 @@
1818 wfProfileIn( __METHOD__ );
1919
2020 $wgHooks['ArticleSaveComplete'][] = 'FBPush_OnWatchArticle::articleCountPagesAddedInLastHour';
21 - wfLoadExtensionMessages( 'FBPush_OnWatchArticle' );
2221
2322 wfProfileOut( __METHOD__ );
2423 }
@@ -26,7 +25,7 @@
2726 global $wgContentNamespaces;
2827 wfProfileIn( __METHOD__ );
2928 if( in_array( $article->getTitle()->getNamespace(), $wgContentNamespaces ) ) {
30 - self::pushEvent( $article->getTitle()->getText(), $article->getTitle()->getFullURL(), 'Read more' );
 29+ $this->pushEvent( $article->getTitle()->getText(), $article->getTitle()->getFullURL(), 'Read more' );
3130 }
3231 wfProfileOut( __METHOD__ );
3332 return true;
Index: trunk/extensions/FBConnect/pushEvents/FBPush_OnAddImage.php
@@ -11,12 +11,4 @@
1212
1313 class FBPush_OnAddImage extends FBConnectPushEvent {
1414 protected $isAllowedUserPreferenceName = 'fbconnect-push-allow-OnAddImage'; // must correspond to an i18n message that is 'tog-[the value of the string on this line]'.
15 -
16 - public function init() {
17 - wfProfileIn( __METHOD__ );
18 -
19 - wfLoadExtensionMessages( 'FBPush_OnAddImage' );
20 -
21 - wfProfileOut( __METHOD__ );
22 - }
2315 }
Index: trunk/extensions/FBConnect/pushEvents/FBPush_OnLargeEdit.php
@@ -16,12 +16,4 @@
1717 static public function getMinCharsToPush() {
1818 return self::$MIN_CHARS_TO_PUSH;
1919 }
20 -
21 - public function init() {
22 - wfProfileIn( __METHOD__ );
23 -
24 - wfLoadExtensionMessages( 'FBPush_OnLargeEdit' );
25 -
26 - wfProfileOut( __METHOD__ );
27 - }
2820 }
Index: trunk/extensions/FBConnect/php-sdk/facebook.php
@@ -690,7 +690,7 @@
691691 if (isset($READ_ONLY_CALLS[strtolower($method)])) {
692692 $name = 'api_read';
693693 }
694 - return self::getUrl($name, 'restserver.php');
 694+ return $this->getUrl($name, 'restserver.php');
695695 }
696696
697697 /**

Status & tagging log