r108714 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108713‎ | r108714 | r108715 >
Date:09:08, 12 January 2012
Author:siebrand
Status:ok
Tags:
Comment:
stylize.php
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.hooks.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/INSTALL (modified) (history)
  • /trunk/extensions/EducationProgram/README (modified) (history)
  • /trunk/extensions/EducationProgram/api/ApiDeleteEducation.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCoursePager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPDBObject.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPMentor.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPMentorPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrg.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudent.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudentPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPTerm.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPTermPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.api.js (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialAmbassador.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialAmbassadors.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourses.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPPage.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEditCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEditInstitution.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEditTerm.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEnroll.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitution.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitutions.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialStudent.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialTerm.php (modified) (history)
  • /trunk/extensions/MobileFrontend/ApplicationTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/ApplicationWmlTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/DisableTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/FooterTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/LeaveFeedbackTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontendTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/OptInTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/OptOutTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/SearchTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/ThanksNoticeTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/tests/DeviceDetectionTest.php (modified) (history)
  • /trunk/extensions/ShortUrl/README (modified) (history)
  • /trunk/extensions/ShortUrl/populateShortUrlTable.php (modified) (history)
  • /trunk/extensions/SwiftMedia/SwiftMedia.body.php (modified) (history)
  • /trunk/extensions/SwiftMedia/SwiftMedia.i18n.php (modified) (history)
  • /trunk/extensions/SwiftMedia/TODO (modified) (history)
  • /trunk/extensions/SwiftMedia/php-fakecloudfiles/fake_cloudfiles.php (modified) (history)
  • /trunk/extensions/SwiftMedia/smtest.py (modified) (history)
  • /trunk/extensions/SwiftMedia/test_rewrite.py (modified) (history)
  • /trunk/extensions/SwiftMedia/wmf/swift.php (modified) (history)
  • /trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php (modified) (history)
  • /trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccessTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php
@@ -76,11 +76,11 @@
7777
7878 if ( self::$isFilePage && self::$acceptBilling !== 'yes' ) {
7979 $acceptBillingYes = Html::rawElement( 'a',
80 - array('href' => $wgRequest->appendQuery( 'renderZeroRatedBanner=true&acceptbilling=yes' ) ),
 80+ array( 'href' => $wgRequest->appendQuery( 'renderZeroRatedBanner=true&acceptbilling=yes' ) ),
8181 wfMsg( 'zero-rated-mobile-access-banner-text-data-charges-yes' ) );
8282 $referrer = $wgRequest->getHeader( 'referer' );
8383 $acceptBillingNo = Html::rawElement( 'a',
84 - array('href' => $wgRequest->appendQuery( 'acceptbilling=no&returnto=' . urlencode( $referrer ) ) ),
 84+ array( 'href' => $wgRequest->appendQuery( 'acceptbilling=no&returnto=' . urlencode( $referrer ) ) ),
8585 wfMsg( 'zero-rated-mobile-access-banner-text-data-charges-no' ) );
8686 $bannerText = Html::rawElement( 'h3',
8787 array( 'id' => 'zero-rated-banner-text' ),
@@ -93,11 +93,11 @@
9494 } elseif ( self::$renderZeroRatedRedirect === true ) {
9595 $returnto = $wgRequest->getVal( 'returnto' );
9696 $acceptBillingYes = Html::rawElement( 'a',
97 - array('href' => $wgRequest->appendQuery( 'renderZeroRatedBanner=true&acceptbilling=yes&returnto=' . urlencode( $returnto ) ) ),
 97+ array( 'href' => $wgRequest->appendQuery( 'renderZeroRatedBanner=true&acceptbilling=yes&returnto=' . urlencode( $returnto ) ) ),
9898 wfMsg( 'zero-rated-mobile-access-banner-text-data-charges-yes' ) );
9999 $referrer = $wgRequest->getHeader( 'referer' );
100100 $acceptBillingNo = Html::rawElement( 'a',
101 - array('href' => $wgRequest->appendQuery( 'acceptbilling=no&returnto=' . urlencode( $referrer ) ) ),
 101+ array( 'href' => $wgRequest->appendQuery( 'acceptbilling=no&returnto=' . urlencode( $referrer ) ) ),
102102 wfMsg( 'zero-rated-mobile-access-banner-text-data-charges-no' ) );
103103 $bannerText = Html::rawElement( 'h3',
104104 array( 'id' => 'zero-rated-banner-text' ),
@@ -147,7 +147,7 @@
148148 self::addDebugOutput( $country );
149149 }
150150 $languageOptions = self::createLanguageOptionsFromWikiText();
151 - //self::$displayDebugOutput = true;
 151+ // self::$displayDebugOutput = true;
152152 $languagesForCountry = ( isset( $languageOptions[self::getFullCountryNameFromCode( $country )] ) ) ?
153153 $languageOptions[self::getFullCountryNameFromCode( $country )] : null;
154154 self::addDebugOutput( self::getFullCountryNameFromCode( $country ) );
@@ -206,7 +206,7 @@
207207
208208 /**
209209 * Returns information about carrier
210 - *
 210+ *
211211 * @param String $carrier: Name of carrier e.g., "Verizon Wireless"
212212 * @return Array
213213 */
@@ -229,7 +229,7 @@
230230
231231 /**
232232 * Returns the Html of a page with the various links appended with zeropartner parameter
233 - *
 233+ *
234234 * @param String $html: Html of current page
235235 * @return String
236236 */
@@ -283,7 +283,7 @@
284284 $zeroPartnerUrl = wfAppendQuery( $zeroRatedLinkHref,
285285 array( 'zeropartner' => $partnerId, 'renderZeroRatedBanner' => 'true' ) );
286286 if ( $zeroPartnerUrl ) {
287 - $zeroRatedExternalLink->setAttribute( 'href', '?renderZeroRatedRedirect=true&returnto=' . urlencode($zeroRatedExternalLinkHref) );
 287+ $zeroRatedExternalLink->setAttribute( 'href', '?renderZeroRatedRedirect=true&returnto=' . urlencode( $zeroRatedExternalLinkHref ) );
288288 }
289289 }
290290 }
@@ -295,7 +295,7 @@
296296
297297 /**
298298 * Adds object to debugOutput Array
299 - *
 299+ *
300300 * @param Object $object: any valid PHP object
301301 * @return bool
302302 */
@@ -317,7 +317,7 @@
318318 wfProfileIn( __METHOD__ );
319319 if ( self::$debugOutput && self::$displayDebugOutput === true ) {
320320 echo "<pre>";
321 - foreach( self::$debugOutput as $debugOutput ) {
 321+ foreach ( self::$debugOutput as $debugOutput ) {
322322 var_dump( $debugOutput );
323323 }
324324 echo "</pre>";
@@ -328,7 +328,7 @@
329329
330330 /**
331331 * Returns the carrier options array parsed from a valid wiki page
332 - *
 332+ *
333333 * @return Array
334334 */
335335 private static function createCarrierOptionsFromWikiText() {
@@ -365,7 +365,7 @@
366366 if ( $i % 3 === 1 ) {
367367 $carrierOptions[$carrierName]['url'] = trim( str_replace( '** ', '', $line ) );
368368 $carrierLink = Html::rawElement( 'a',
369 - array('href' => $carrierOptions[$carrierName]['url'] ),
 369+ array( 'href' => $carrierOptions[$carrierName]['url'] ),
370370 $carrierOptions[$carrierName]['name'] );
371371 $carrierOptions[$carrierName]['link'] = $carrierLink;
372372 } elseif ( $i % 3 === 2 ) {
@@ -382,7 +382,7 @@
383383
384384 /**
385385 * Returns the foreign wiki options array from a valid wiki page
386 - *
 386+ *
387387 * @return Array
388388 */
389389 private static function getOptionsFromForeignWiki( $pageName ) {
@@ -421,7 +421,7 @@
422422 $key = null;
423423 }
424424
425 - foreach( $jsonData['query']['pages'] as $pages ) {
 425+ foreach ( $jsonData['query']['pages'] as $pages ) {
426426 if ( isset( $pages['revisions'][0]['*'] ) ) {
427427 $rev = $pages['revisions'][0]['*'];
428428 }
@@ -473,7 +473,7 @@
474474 $countryName = strtoupper( str_replace( '* ', '', $line ) );
475475 $languageOptions[$countryName] = '';
476476 } elseif ( strpos( $line, '**' ) === 0 && $i > 0 ) {
477 - $lineParts = explode('#', $line);
 477+ $lineParts = explode( '#', $line );
478478 $language = ( isset( $lineParts[0] ) ) ?
479479 trim( str_replace( '** ', '', $lineParts[0] ) ) :
480480 trim( str_replace( '** ', '', $line ) ) ;
Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccessTemplate.php
@@ -24,7 +24,7 @@
2525 * @param $options array
2626 */
2727 public function setByArray( $options ) {
28 - foreach ($options as $name => $value ) {
 28+ foreach ( $options as $name => $value ) {
2929 $this->set( $name, $value );
3030 }
3131 }
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -225,7 +225,7 @@
226226 * Bucket 1: Share Your Feedback
227227 */
228228 '1': {
229 -
 229+
230230 /**
231231 * Currently displayed placeholder text. This is a workaround for Chrome/FF
232232 * automatic focus in overlays.
@@ -1912,10 +1912,10 @@
19131913
19141914 return $block;
19151915 },
1916 -
 1916+
19171917 // }}}
19181918 // {{{ afterBuild
1919 -
 1919+
19201920 /**
19211921 * Perform adjustments after build
19221922 */
@@ -1982,7 +1982,7 @@
19831983
19841984 // }}}
19851985 // {{{ afterBuild
1986 -
 1986+
19871987 /**
19881988 * Perform adjustments after build
19891989 */
@@ -2657,7 +2657,7 @@
26582658 if ( 'afterBuild' in cta ) {
26592659 cta.afterBuild();
26602660 }
2661 -
 2661+
26622662 // The close element needs to be created anyway, to serve as an anchor. However, it needs
26632663 // to be hidden when the CTA is not displayed in a dialog
26642664 if( !$.articleFeedbackv5.inDialog ) {
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js
@@ -15,7 +15,7 @@
1616
1717 /*** Main entry point ***/
1818 jQuery( function( $ ) {
19 -
 19+
2020 var ua = navigator.userAgent.toLowerCase();
2121 // Rule out MSIE 6, iPhone, iPod, iPad, Android
2222 if(
@@ -29,8 +29,8 @@
3030 (ua.indexOf( 'ipad' ) != -1)
3131 ) {
3232 return;
33 - }
34 -
 33+ }
 34+
3535 // Load check, is this page ArticleFeedbackv5-enabled ?
3636 // Keep in sync with ApiArticleFeedbackv5.php
3737 if (
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php
@@ -257,11 +257,11 @@
258258 $wgHooks['ArticleSaveComplete'][] = 'ArticleFeedbackv5Hooks::trackEditSuccess';
259259
260260 // API Registration
261 -//$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5';
262 -//$wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5';
263 -//$wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5';
 261+// $wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5';
 262+// $wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5';
 263+// $wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5';
264264 $wgAPIModules['articlefeedbackv5'] = 'ApiArticleFeedbackv5';
265265
266266 // Special Page
267 -//$wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5';
268 -//$wgSpecialPageGroups['ArticleFeedbackv5'] = 'other';
 267+// $wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5';
 268+// $wgSpecialPageGroups['ArticleFeedbackv5'] = 'other';
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php
@@ -8,7 +8,7 @@
99 */
1010
1111 /**
12 - * This class pulls the individual ratings/comments for the feedback page.
 12+ * This class pulls the individual ratings/comments for the feedback page.
1313 *
1414 * @package ArticleFeedback
1515 * @subpackage Api
@@ -91,7 +91,7 @@
9292 'flagtype' => array(
9393 ApiBase::PARAM_REQUIRED => true,
9494 ApiBase::PARAM_ISMULTI => false,
95 - ApiBase::PARAM_TYPE => array(
 95+ ApiBase::PARAM_TYPE => array(
9696 'abuse', 'hide' )
9797 ),
9898 );
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
@@ -206,7 +206,7 @@
207207 # Not actually a requirement, but I can see this being a thing,
208208 # not letting people post the entire text of 1984 in a comment
209209 # or something like that.
210 - if( $wgArticleFeedbackv5MaxCommentLength > 0
 210+ if ( $wgArticleFeedbackv5MaxCommentLength > 0
211211 && strlen( $value ) > $wgArticleFeedbackv5MaxCommentLength ) {
212212 $length_error = 1;
213213 }
@@ -224,7 +224,7 @@
225225 * @param $data array the user's validated feedback answers
226226 */
227227 public function updateRollupTables( $page, $revision, $data ) {
228 - foreach( array( 'rating', 'boolean', 'option_id' ) as $type ) {
 228+ foreach ( array( 'rating', 'boolean', 'option_id' ) as $type ) {
229229 $this->updateRollup( $page, $revision, $type, $data );
230230 }
231231 }
@@ -237,7 +237,7 @@
238238 * @return int the oldest revision to still count
239239 */
240240 public function getRevisionLimit( $pageId ) {
241 - if( $this->revision_limit === null ) {
 241+ if ( $this->revision_limit === null ) {
242242 $this->revision_limit = ApiArticleFeedbackv5Utils::getRevisionLimit( $pageId );
243243 }
244244 return $this->revision_limit;
@@ -292,7 +292,7 @@
293293 $field = $row['aa_field_id'];
294294 $value = $row["aa_response_$type"];
295295
296 - if( $type == 'option_id' ) {
 296+ if ( $type == 'option_id' ) {
297297 // Selects are kind of a odd bird. We store one row
298298 // per option per field, and each one has the number
299299 // of times that option was chosen, and the number of
@@ -312,7 +312,7 @@
313313 // For each option this field has, make sure we have
314314 // a row by inserting one - will fail silently if the
315315 // row already exists.
316 - foreach( $options as $option ) {
 316+ foreach ( $options as $option ) {
317317 // These inserts could possibly fail or succeed
318318 // individually, so we can't use the multiple-
319319 // insert functionality of the insert class.
@@ -399,7 +399,7 @@
400400
401401 // Select rollup data for revisions, grouped up by field, so we
402402 // can drop it into the page rollups.
403 - if( $type == 'option_id' ) {
 403+ if ( $type == 'option_id' ) {
404404 $table = 'aft_article_feedback_select_rollup';
405405 $prefix = 'afsr_';
406406 $rows = $dbr->select(
@@ -419,7 +419,7 @@
420420 );
421421
422422 $page_data = array();
423 - foreach( $rows as $row ) {
 423+ foreach ( $rows as $row ) {
424424 $page_data[] = array(
425425 'afsr_page_id' => $pageId,
426426 'afsr_field_id' => $field,
@@ -517,7 +517,7 @@
518518 // Find the link ID using the order of the link buckets ('-' = 0, 'A' = 1,
519519 // 'B' = 2, etc.)
520520 $links = array_flip( array_keys( $wgArticleFeedbackv5LinkBuckets['buckets'] ) );
521 - $linkId = isset($links[$linkName]) ? $links[$linkName] : 0;
 521+ $linkId = isset( $links[$linkName] ) ? $links[$linkName] : 0;
522522
523523 $dbw->begin();
524524
@@ -534,7 +534,7 @@
535535
536536 $feedbackId = $dbw->insertID();
537537
538 - foreach($data as $key => $item) {
 538+ foreach ( $data as $key => $item ) {
539539 $data[$key]['aa_feedback_id'] = $feedbackId;
540540 }
541541
@@ -548,8 +548,8 @@
549549 $dbw->commit();
550550
551551 return array(
552 - 'cta_id' => ($ctaId ? $ctaId : 0),
553 - 'feedback_id' => ($feedbackId ? $feedbackId : 0)
 552+ 'cta_id' => ( $ctaId ? $ctaId : 0 ),
 553+ 'feedback_id' => ( $feedbackId ? $feedbackId : 0 )
554554 );
555555 }
556556
@@ -564,7 +564,7 @@
565565 $rows = array();
566566
567567 // Only save data for logged-in users.
568 - if( !$wgUser->isLoggedIn() ) {
 568+ if ( !$wgUser->isLoggedIn() ) {
569569 return null;
570570 }
571571
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
@@ -42,7 +42,7 @@
4343 );
4444
4545 foreach ( $feedback as $record ) {
46 - $html .= $this->renderFeedback($record);
 46+ $html .= $this->renderFeedback( $record );
4747 $length++;
4848 }
4949
@@ -58,7 +58,7 @@
5959 $where['af_page_id'] = $pageId;
6060
6161 # Until this is done properly, just don't do anything.
62 - return 0;
 62+ return 0;
6363
6464 # return $dbr->selectField(
6565 # array( 'aft_article_feedback' ),
@@ -77,8 +77,8 @@
7878 $order;
7979
8080 # Newest first is the only option right now.
81 - switch($order) {
82 - case 'oldest':
 81+ switch( $order ) {
 82+ case 'oldest':
8383 $order = 'af_id ASC';
8484 break;
8585 case 'newest':
@@ -102,11 +102,11 @@
103103 'ORDER BY' => $order
104104 )
105105 );
106 - foreach($id_query as $id) {
 106+ foreach ( $id_query as $id ) {
107107 $ids[] = $id->af_id;
108108 }
109109
110 - if( !count( $ids ) ) {
 110+ if ( !count( $ids ) ) {
111111 return array();
112112 }
113113
@@ -118,7 +118,7 @@
119119 array( 'af_id', 'af_bucket_id', 'afi_name', 'afo_name',
120120 'aa_response_text', 'aa_response_boolean',
121121 'aa_response_rating', 'aa_response_option_id',
122 - 'afi_data_type', 'af_created', 'user_name',
 122+ 'afi_data_type', 'af_created', 'user_name',
123123 'af_user_ip', 'af_hide_count', 'af_abuse_count'
124124 ),
125125 array( 'af_id' => $ids ),
@@ -141,15 +141,15 @@
142142 )
143143 );
144144
145 - foreach( $rows as $row ) {
146 - if( !array_key_exists( $row->af_id, $rv ) ) {
 145+ foreach ( $rows as $row ) {
 146+ if ( !array_key_exists( $row->af_id, $rv ) ) {
147147 $rv[$row->af_id] = array();
148148 $rv[$row->af_id][0] = $row;
149149 $rv[$row->af_id][0]->user_name = $row->user_name ? $row->user_name : $row->af_user_ip;
150150 }
151151 $rv[$row->af_id][$row->afi_name] = $row;
152152 }
153 -
 153+
154154 return $rv;
155155 }
156156
@@ -188,37 +188,37 @@
189189
190190 # TODO: permalinks
191191 return Html::openElement( 'div', array( 'id' => 'aft5-feedback' ) )
192 - .Html::openElement( 'p' )
193 - .Html::element( 'a', array( 'class' => 'aft5-comment-name', 'href' => 'profilepage or whatever' ), $id )
194 - .Html::element( 'span', array( 'class' => 'aft5-comment-timestamp' ), $record[0]->af_created )
195 - .Html::closeElement( 'p' )
196 - .wfMessage( 'articlefeedbackv5-form-optionid', $record[0]->af_bucket_id )->escaped()
197 - .$content
198 - .wfMessage( 'articlefeedbackv5-form-helpful-label' )->escaped()
199 - .Html::openElement( 'div', array( 'id' => 'aft5-feedback-tools' ) )
200 - .Html::element( 'h3', array(), wfMessage( 'articlefeedbackv5-form-tools-label' )->text() )
201 - .Html::openElement( 'ul' )
202 - .($can_flag ? Html::rawElement( 'li', array(), Html::element( 'a', array(
 192+ . Html::openElement( 'p' )
 193+ . Html::element( 'a', array( 'class' => 'aft5-comment-name', 'href' => 'profilepage or whatever' ), $id )
 194+ . Html::element( 'span', array( 'class' => 'aft5-comment-timestamp' ), $record[0]->af_created )
 195+ . Html::closeElement( 'p' )
 196+ . wfMessage( 'articlefeedbackv5-form-optionid', $record[0]->af_bucket_id )->escaped()
 197+ . $content
 198+ . wfMessage( 'articlefeedbackv5-form-helpful-label' )->escaped()
 199+ . Html::openElement( 'div', array( 'id' => 'aft5-feedback-tools' ) )
 200+ . Html::element( 'h3', array(), wfMessage( 'articlefeedbackv5-form-tools-label' )->text() )
 201+ . Html::openElement( 'ul' )
 202+ . ( $can_flag ? Html::rawElement( 'li', array(), Html::element( 'a', array(
203203 'id' => "aft5-hide-link-$id",
204204 'class' => 'aft5-hide-link'
205205 ), wfMessage( 'articlefeedbackv5-form-hide', $record[0]->af_hide_count )->text() ) ) : '' )
206 - .($can_hide ? Html::rawElement( 'li', array(), Html::element( 'a', array(
 206+ . ( $can_hide ? Html::rawElement( 'li', array(), Html::element( 'a', array(
207207 'id' => "aft5-abuse-link-$id",
208208 'class' => 'aft5-abuse-link'
209209 ), wfMessage( 'articlefeedbackv5-form-abuse', $record[0]->af_abuse_count )->text() ) ) : '' )
210 - .($can_delete ? Html::rawElement( 'li', array(), Html::element( 'a', array(
 210+ . ( $can_delete ? Html::rawElement( 'li', array(), Html::element( 'a', array(
211211 'id' => "aft5-delete-link-$id",
212212 'class' => 'aft5-delete-link'
213213 ), wfMessage( 'articlefeedbackv5-form-delete' )->text() ) ) : '' )
214 - .Html::closeElement( 'ul' )
215 - .Html::closeElement( 'div' )
216 - .Html::closeElement( 'div' )
217 - .Html::element( 'hr' );
 214+ . Html::closeElement( 'ul' )
 215+ . Html::closeElement( 'div' )
 216+ . Html::closeElement( 'div' )
 217+ . Html::element( 'hr' );
218218 }
219219
220220 private function renderBucket1( $record ) {
221221 $name = htmlspecialchars( $record[0]->user_name );
222 - if( $record['found']->aa_response_boolean ) {
 222+ if ( $record['found']->aa_response_boolean ) {
223223 $found = wfMessage(
224224 'articlefeedbackv5-form1-header-found',
225225 $name
@@ -230,8 +230,8 @@
231231 )->escaped();
232232 }
233233 return "$found
234 - <blockquote>".htmlspecialchars( $record['comment']->aa_response_text )
235 - .'</blockquote>';
 234+ <blockquote>" . htmlspecialchars( $record['comment']->aa_response_text )
 235+ . '</blockquote>';
236236 }
237237
238238 private function renderBucket2( $record ) {
@@ -243,16 +243,16 @@
244244 // * articlefeedbackv5-form2-header-question
245245 // * articlefeedbackv5-form2-header-suggestion
246246 return wfMessage( 'articlefeedbackv5-form2-header-' . $type, $name )->escaped()
247 - .'<blockquote>'.htmlspecialchars( $record['comment']->aa_response_text )
248 - .'</blockquote>';
 247+ . '<blockquote>' . htmlspecialchars( $record['comment']->aa_response_text )
 248+ . '</blockquote>';
249249 }
250250
251251 private function renderBucket3( $record ) {
252252 $name = htmlspecialchars( $record[0]->user_name );
253253 $rating = htmlspecialchars( $record['rating']->aa_response_rating );
254254 return wfMessage( 'articlefeedbackv5-form3-header', $name, $rating )->escaped()
255 - .'<blockquote>'.htmlspecialchars( $record['comment']->aa_response_text )
256 - .'</blockquote>';
 255+ . '<blockquote>' . htmlspecialchars( $record['comment']->aa_response_text )
 256+ . '</blockquote>';
257257 }
258258
259259 private function renderBucket4( $record ) {
@@ -263,13 +263,13 @@
264264 $name = htmlspecialchars( $record[0]->user_name );
265265 $rv = wfMessage( 'articlefeedbackv5-form5-header', $name )->escaped();
266266 $rv .= '<ul>';
267 - foreach( $record as $key => $answer ) {
268 - if( $answer->afi_data_type == 'rating' && $key != '0' ) {
 267+ foreach ( $record as $key => $answer ) {
 268+ if ( $answer->afi_data_type == 'rating' && $key != '0' ) {
269269 $rv .= "<li>"
270 - .htmlspecialchars( $answer->afi_name )
271 - .': '
272 - .htmlspecialchars( $answer->aa_response_rating )
273 - ."</li>";
 270+ . htmlspecialchars( $answer->afi_name )
 271+ . ': '
 272+ . htmlspecialchars( $answer->aa_response_rating )
 273+ . "</li>";
274274 }
275275 }
276276 $rv .= "</ul>";
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php
@@ -67,9 +67,9 @@
6868 $where['arr_page_id'] = $pageId;
6969 $where[] = 'arr_field_id = afi_id';
7070 $rows = $dbr->select(
71 - array(
72 - 'aft_article_feedback_ratings_rollup',
73 - 'aft_article_field'
 71+ array(
 72+ 'aft_article_feedback_ratings_rollup',
 73+ 'aft_article_field'
7474 ),
7575 array(
7676 'afi_name AS field_name',
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php
@@ -52,10 +52,10 @@
5353 # TODO: Fix links.
5454 $out->addHTML(
5555 Html::openElement(
56 - 'div',
 56+ 'div',
5757 array( 'id' => 'aft5-header-links' )
5858 )
59 - .Linker::link(
 59+ . Linker::link(
6060 Title::newFromText( $param ),
6161 $this->msg( 'articlefeedbackv5-go-to-article' )->escaped()
6262 )
@@ -69,30 +69,30 @@
7070 Title::newFromText( $param ),
7171 $this->msg( 'articlefeedbackv5-whats-this' )->escaped()
7272 )
73 - .Html::closeElement( 'div' )
 73+ . Html::closeElement( 'div' )
7474 );
7575 }
7676
77 - $out->addHTML(
 77+ $out->addHTML(
7878 Html::openElement(
79 - 'div',
 79+ 'div',
8080 array( 'id' => 'aft5-showing-count-wrap' )
8181 )
82 - .$this->msg(
 82+ . $this->msg(
8383 'articlefeedbackv5-special-showing',
8484 Html::element( 'span', array( 'id' => 'aft-feedback-count-total' ), '0' )
8585 )
86 - .Html::closeElement( 'div' )
 86+ . Html::closeElement( 'div' )
8787 );
8888
8989 if ( $found ) {
9090 $out->addHtml(
9191 Html::openElement(
92 - 'div',
 92+ 'div',
9393 array( 'id' => 'aft5-percent-found-wrap' )
9494 )
95 - .$this->msg( 'articlefeedbackv5-percent-found', $found )->escaped()
96 - .Html::closeElement( 'div' )
 95+ . $this->msg( 'articlefeedbackv5-percent-found', $found )->escaped()
 96+ . Html::closeElement( 'div' )
9797 );
9898 }
9999
@@ -108,15 +108,15 @@
109109
110110 $sortLabels = array();
111111 $sortOpts = array( 'newest', 'oldest' );
112 - foreach( $sortOpts as $sort ) {
113 - $sortLabels[] = Html::element(
 112+ foreach ( $sortOpts as $sort ) {
 113+ $sortLabels[] = Html::element(
114114 'a',
115115 array(
116116 'href' => '#',
117 - 'id' => 'articlefeedbackv5-special-sort-'.$sort,
118 - 'class' => 'aft5-sort-link'
 117+ 'id' => 'articlefeedbackv5-special-sort-' . $sort,
 118+ 'class' => 'aft5-sort-link'
119119 ),
120 - $this->msg( 'articlefeedbackv5-special-sort-'.$sort )->text()
 120+ $this->msg( 'articlefeedbackv5-special-sort-' . $sort )->text()
121121 );
122122 }
123123
@@ -125,21 +125,21 @@
126126 'articlefeedbackv5-special-filter-visible' => 'visible',
127127 'articlefeedbackv5-special-filter-invisible' => 'invisible',
128128 'articlefeedbackv5-special-filter-all' => 'all',
129 - )));
 129+ ) ) );
130130
131131 $out->addHTML(
132132 Html::openElement(
133 - 'div',
 133+ 'div',
134134 array( 'id' => 'aft5-sort-filter-controls' )
135135 )
136 - .$this->msg( 'articlefeedbackv5-special-sort-label-before' )->escaped()
137 - .implode( $this->msg( 'pipe-separator' )->escaped(), $sortLabels )
138 - .$this->msg( 'articlefeedbackv5-special-sort-label-after' )->escaped()
 136+ . $this->msg( 'articlefeedbackv5-special-sort-label-before' )->escaped()
 137+ . implode( $this->msg( 'pipe-separator' )->escaped(), $sortLabels )
 138+ . $this->msg( 'articlefeedbackv5-special-sort-label-after' )->escaped()
139139
140 - .$this->msg( 'articlefeedbackv5-special-filter-label-before' )->escaped()
141 - .$filterSelect->getHTML()
142 - .$this->msg( 'articlefeedbackv5-special-filter-label-after' )->escaped()
143 - .Html::element(
 140+ . $this->msg( 'articlefeedbackv5-special-filter-label-before' )->escaped()
 141+ . $filterSelect->getHTML()
 142+ . $this->msg( 'articlefeedbackv5-special-filter-label-after' )->escaped()
 143+ . Html::element(
144144 'a',
145145 array(
146146 'href' => '#',
@@ -147,22 +147,22 @@
148148 ),
149149 $this->msg( 'articlefeedbackv5-special-add-feedback' )->text()
150150 )
151 - .Html::closeElement( 'div' )
 151+ . Html::closeElement( 'div' )
152152 );
153153
154154 $out->addHTML(
155155 Html::element(
156 - 'div',
 156+ 'div',
157157 array(
158158 'id' => 'aft5-show-feedback',
159159 'style' => 'border:1px solid red;'
160160 ), ''
161161 )
162 - .Html::element(
163 - 'a',
164 - array(
165 - 'href' => '#',
166 - 'id' => 'aft5-show-more'
 162+ . Html::element(
 163+ 'a',
 164+ array(
 165+ 'href' => '#',
 166+ 'id' => 'aft5-show-more'
167167 ),
168168 $this->msg( 'articlefeedbackv5-special-more' )->text()
169169 )
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -282,7 +282,7 @@
283283 */
284284 public static function getPreferences( $user, &$preferences ) {
285285 // need to check for existing key, if deployed simultaneously with AFTv4
286 - if( !array_key_exists( 'articlefeedback-disable', $preferences ) ) {
 286+ if ( !array_key_exists( 'articlefeedback-disable', $preferences ) ) {
287287 $preferences['articlefeedback-disable'] = array(
288288 'type' => 'check',
289289 'section' => 'rendering/advancedrendering',
Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php
@@ -32,20 +32,20 @@
3333 */
3434 public function execute( $subPage ) {
3535 parent::execute( $subPage );
36 -
 36+
3737 $out = $this->getOutput();
38 -
 38+
3939 if ( trim( $subPage ) === '' ) {
4040 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Institutions' )->getLocalURL() );
4141 }
4242 else {
4343 $out->setPageTitle( wfMsgExt( 'ep-institution-title', 'parsemag', $this->subPage ) );
44 -
 44+
4545 $org = EPOrg::selectRow( null, array( 'name' => $this->subPage ) );
46 -
 46+
4747 if ( $org === false ) {
4848 $this->displayNavigation();
49 -
 49+
5050 if ( $this->getUser()->isAllowed( 'epadmin' ) ) {
5151 $out->addWikiMsg( 'ep-institution-create', $this->subPage );
5252 EPOrg::displayAddNewControl( $this->getContext(), array( 'name' => $this->subPage ) );
@@ -56,17 +56,17 @@
5757 }
5858 else {
5959 $links = array();
60 -
 60+
6161 if ( $this->getUser()->isAllowed( 'epadmin' ) ) {
6262 $links[wfMsg( 'ep-institution-nav-edit' )] = SpecialPage::getTitleFor( 'EditInstitution', $this->subPage );
6363 }
64 -
 64+
6565 $this->displayNavigation( $links );
66 -
 66+
6767 $this->displaySummary( $org );
68 -
 68+
6969 $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-institution-courses' ) ) );
70 -
 70+
7171 EPCourse::displayPager( $this->getContext(), array( 'org_id' => $org->getId() ) );
7272
7373 if ( $this->getUser()->isAllowed( 'epadmin' ) ) {
@@ -77,7 +77,7 @@
7878 }
7979 }
8080 }
81 -
 81+
8282 /**
8383 * Gets the summary data.
8484 *
@@ -92,7 +92,7 @@
9393
9494 $stats['name'] = $org->getField( 'name' );
9595 $stats['city'] = $org->getField( 'city' );
96 -
 96+
9797 $countries = CountryNames::getNames( $this->getLanguage()->getCode() );
9898 $stats['country'] = $countries[$org->getField( 'country' )];
9999
@@ -102,5 +102,5 @@
103103
104104 return $stats;
105105 }
106 -
 106+
107107 }
Index: trunk/extensions/EducationProgram/specials/SpecialEnroll.php
@@ -39,7 +39,7 @@
4040 parent::execute( $subPage );
4141
4242 $args = explode( '/', $this->subPage, 2 );
43 -
 43+
4444 if ( !ctype_digit( $args[0] ) ) {
4545 $this->showWarning( wfMessage( $args[0] === '' ? 'ep-enroll-no-id' : 'ep-enroll-invalid-id' ) );
4646 }
@@ -52,7 +52,7 @@
5353 'id' => $args[0],
5454 'token' => $args[1]
5555 ) );
56 -
 56+
5757 if ( $term === false ) {
5858 $this->showWarning( wfMessage( 'ep-enroll-invalid-token' ) );
5959 }
@@ -103,12 +103,12 @@
104104
105105 /**
106106 * Show links to signup.
107 - *
 107+ *
108108 * @since 0.1
109109 */
110110 protected function showSignupLink() {
111111 $out = $this->getOutput();
112 -
 112+
113113 $out->addWikiMsg( 'ep-enroll-login-first' );
114114
115115 $out->addHTML( '<ul><li>' );
@@ -174,12 +174,12 @@
175175
176176 return $success;
177177 }
178 -
 178+
179179 /**
180180 * Create and display the enrollment form.
181 - *
 181+ *
182182 * @since 0.1
183 - *
 183+ *
184184 * @param EPTerm $term
185185 */
186186 protected function showEnrollmentForm( EPTerm $term ) {
@@ -232,7 +232,7 @@
233233 'label-message' => 'ep-enroll-gender',
234234 'validation-callback' => function( $value, array $alldata = null ) {
235235 return in_array( $value, array( 'male', 'female', 'unknown' ) ) ? true : wfMsg( 'ep-enroll-invalid-gender' );
236 - },
 236+ } ,
237237 'options' => array(
238238 wfMsg( 'gender-male' ) => 'male',
239239 wfMsg( 'gender-female' ) => 'female',
Index: trunk/extensions/EducationProgram/specials/SpecialAmbassadors.php
@@ -38,7 +38,7 @@
3939 }
4040 else {
4141 // TODO
42 - //$this->getOutput()->redirect( SpecialPage::getTitleFor( 'Institution', $this->subPage )->getLocalURL() );
 42+ // $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Institution', $this->subPage )->getLocalURL() );
4343 }
4444 }
4545
Index: trunk/extensions/EducationProgram/specials/SpecialEditInstitution.php
@@ -37,18 +37,18 @@
3838 'required' => true,
3939 'validation-callback' => function ( $value, array $alldata = null ) {
4040 return strlen( $value ) < 2 ? wfMsg( 'educationprogram-org-invalid-name' ) : true;
41 - },
 41+ } ,
4242 );
43 -
 43+
4444 $fields['city'] = array (
4545 'type' => 'text',
4646 'label-message' => 'educationprogram-org-edit-city',
4747 'required' => true,
4848 'validation-callback' => function ( $value, array $alldata = null ) {
4949 return strlen( $value ) < 2 ? wfMsg( 'educationprogram-org-invalid-city' ) : true;
50 - },
 50+ } ,
5151 );
52 -
 52+
5353 $fields['country'] = array (
5454 'type' => 'select',
5555 'label-message' => 'educationprogram-org-edit-country',
@@ -60,24 +60,24 @@
6161
6262 return $this->processFormFields( $fields );
6363 }
64 -
 64+
6565 /**
6666 * Returns true if the country value is valid or an error message if it's not.
67 - *
 67+ *
6868 * @since 0.1
69 - *
 69+ *
7070 * @param string $value
7171 * @param array $alldata
72 - *
 72+ *
7373 * @return string|true
7474 */
7575 public function countryIsValid( $value, array $alldata = null ) {
7676 $countries = array_keys( CountryNames::getNames( $this->getLanguage()->getCode() ) );
77 -
 77+
7878 if ( $this->isNew() ) {
7979 array_unshift( $countries, '' );
8080 }
81 -
 81+
8282 return in_array( $value, $countries ) ? true : wfMsg( 'educationprogram-org-invalid-country' );
8383 }
8484
Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php
@@ -34,18 +34,18 @@
3535 parent::execute( $subPage );
3636
3737 $out = $this->getOutput();
38 -
 38+
3939 if ( trim( $subPage ) === '' ) {
4040 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Courses' )->getLocalURL() );
4141 }
4242 else {
4343 $out->setPageTitle( wfMsgExt( 'ep-course-title', 'parsemag', $this->subPage ) );
44 -
 44+
4545 $course = EPCourse::selectRow( null, array( 'name' => $this->subPage ) );
46 -
 46+
4747 if ( $course === false ) {
4848 $this->displayNavigation();
49 -
 49+
5050 if ( $this->getUser()->isAllowed( 'epadmin' ) || $this->getUser()->isAllowed( 'epmentor' ) ) {
5151 $out->addWikiMsg( 'ep-course-create', $this->subPage );
5252 EPCourse::displayAddNewRegion( $this->getContext(), array( 'name' => $this->subPage ) );
@@ -56,21 +56,21 @@
5757 }
5858 else {
5959 $links = array();
60 -
 60+
6161 if ( $course->useCanManage( $this->getUser() ) ) {
6262 $links[wfMsg( 'ep-course-nav-edit' )] = SpecialPage::getTitleFor( 'EditCourse', $this->subPage );
6363 }
64 -
 64+
6565 $this->displayNavigation( $links );
66 -
 66+
6767 $this->displaySummary( $course );
68 -
 68+
6969 $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-course-description' ) ) );
70 -
 70+
7171 $out->addHTML( $this->getOutput()->parse( $course->getField( 'description' ) ) );
72 -
 72+
7373 $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-course-terms' ) ) );
74 -
 74+
7575 EPTerm::displayPager( $this->getContext(), array( 'course_id' => $course->getId() ) );
7676
7777 if ( $course->useCanManage( $this->getUser() ) ) {
@@ -81,7 +81,7 @@
8282 }
8383 }
8484 }
85 -
 85+
8686 /**
8787 * Gets the summary data.
8888 *
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
@@ -17,7 +17,7 @@
1818 /**
1919 * The subpage, ie the part after Special:PageName/
2020 * Empty string if none is provided.
21 - *
 21+ *
2222 * @since 0.1
2323 * @var string
2424 */
@@ -122,37 +122,37 @@
123123 public function getLanguage() {
124124 return method_exists( get_parent_class(), 'getLanguage' ) ? parent::getLanguage() : $this->getLang();
125125 }
126 -
 126+
127127 /**
128128 * Adds a navigation menu with the provided links.
129129 * Links should be provided in an array with:
130130 * label => Title (object)
131 - *
 131+ *
132132 * @since 0.1
133 - *
 133+ *
134134 * @param array $items
135135 */
136136 protected function displayNavigation( array $items = array() ) {
137137 $links = array();
138138 $items = array_merge( $this->getDefaultNavigationItems(), $items );
139 -
 139+
140140 foreach ( $items as $label => $target ) {
141141 $links[] = Linker::linkKnown(
142142 $target,
143143 htmlspecialchars( $label )
144144 );
145145 }
146 -
 146+
147147 $this->getOutput()->addHTML(
148148 Html::rawElement( 'p', array(), $this->getLanguage()->pipeList( $links ) )
149149 );
150150 }
151 -
 151+
152152 /**
153153 * Returns the default nav items for @see displayNavigation.
154 - *
 154+ *
155155 * @since 0.1
156 - *
 156+ *
157157 * @return array
158158 */
159159 protected function getDefaultNavigationItems() {
@@ -166,34 +166,34 @@
167167 $items[wfMsg( 'ep-nav-students' )] = SpecialPage::getTitleFor( 'Students' );
168168 $items[wfMsg( 'ep-nav-mentors' )] = SpecialPage::getTitleFor( 'Ambassadors' );
169169 }
170 -
 170+
171171 if ( $this->getUser()->isAllowed( 'epmentor' ) || EPStudent::has( array( 'user_id' => $this->getUser()->getId() ) ) ) {
172172 $items[wfMsg( 'ep-nav-mycourses' )] = SpecialPage::getTitleFor( 'MyCourses' );
173173 }
174 -
 174+
175175 return $items;
176176 }
177 -
 177+
178178 /**
179179 * Display the summary data.
180 - *
 180+ *
181181 * @since 0.1
182 - *
 182+ *
183183 * @param EPDBObject $item
184184 * @param boolean $collapsed
185185 * @param array $summaryData
186186 */
187187 protected function displaySummary( EPDBObject $item, $collapsed = false, array $summaryData = null ) {
188188 $out = $this->getOutput();
189 -
 189+
190190 $class = 'wikitable ep-summary mw-collapsible';
191 -
 191+
192192 if ( $collapsed ) {
193 - $class.= ' mw-collapsed';
 193+ $class .= ' mw-collapsed';
194194 }
195 -
 195+
196196 $out->addHTML( Html::openElement( 'table', array( 'class' => $class ) ) );
197 -
 197+
198198 $out->addHTML( '<tr>' . Html::element( 'th', array( 'colspan' => 2 ), wfMsg( 'ep-item-summary' ) ) . '</tr>' );
199199
200200 $summaryData = is_null( $summaryData ) ? $this->getSummaryData( $item ) : $summaryData;
@@ -218,7 +218,7 @@
219219
220220 $out->addHTML( Html::closeElement( 'table' ) );
221221 }
222 -
 222+
223223 /**
224224 * Gets the summary data.
225225 * Returned values must be escaped.
Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
@@ -1,8 +1,8 @@
22 <?php
33
44 /**
5 - *
65 *
 6+ *
77 * @since 0.1
88 *
99 * @file SpecialEducationProgram.php
Index: trunk/extensions/EducationProgram/specials/SpecialEditCourse.php
@@ -37,11 +37,11 @@
3838 'required' => true,
3939 'validation-callback' => function ( $value, array $alldata = null ) {
4040 return strlen( $value ) < 5 ? wfMsgExt( 'ep-course-invalid-name', 'parsemag', 5 ) : true;
41 - },
 41+ } ,
4242 );
43 -
 43+
4444 $orgOptions = EPOrg::getOrgOptions( EPOrg::getEditableOrgs( $this->getUser() ) );
45 -
 45+
4646 $fields['org_id'] = array (
4747 'type' => 'select',
4848 'label-message' => 'ep-course-edit-org',
@@ -49,22 +49,22 @@
5050 'options' => $orgOptions,
5151 'validation-callback' => function ( $value, array $alldata = null ) use ( $orgOptions ) {
5252 return in_array( (int)$value, array_values( $orgOptions ) ) ? true : wfMsg( 'ep-course-invalid-org' );
53 - },
 53+ } ,
5454 );
55 -
 55+
5656 $fields['description'] = array (
5757 'type' => 'textarea',
5858 'label-message' => 'ep-course-edit-description',
5959 'required' => true,
6060 'validation-callback' => function ( $value, array $alldata = null ) {
6161 return strlen( $value ) < 10 ? wfMsgExt( 'ep-course-invalid-description', 'parsemag', 10 ) : true;
62 - },
 62+ } ,
6363 'rows' => 10
6464 );
6565
6666 return $this->processFormFields( $fields );
6767 }
68 -
 68+
6969 /**
7070 * (non-PHPdoc)
7171 * @see SpecialEPFormPage::getNewData()
@@ -75,5 +75,5 @@
7676 'name' => $this->getRequest()->getVal( 'newname' ),
7777 );
7878 }
79 -
 79+
8080 }
Index: trunk/extensions/EducationProgram/specials/SpecialTerm.php
@@ -34,18 +34,18 @@
3535 parent::execute( $subPage );
3636
3737 $out = $this->getOutput();
38 -
 38+
3939 if ( trim( $subPage ) === '' ) {
4040 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Terms' )->getLocalURL() );
4141 }
4242 else {
4343 $out->setPageTitle( wfMsgExt( 'ep-term-title', 'parsemag', $this->subPage ) );
44 -
 44+
4545 $term = EPTerm::selectRow( null, array( 'id' => $this->subPage ) );
46 -
 46+
4747 if ( $term === false ) {
4848 $this->displayNavigation();
49 -
 49+
5050 if ( $this->getUser()->isAllowed( 'epadmin' ) || $this->getUser()->isAllowed( 'epmentor' ) ) {
5151 $out->addWikiMsg( 'ep-term-create', $this->subPage );
5252 EPTerm::displayAddNewRegion( $this->getContext(), array( 'id' => $this->subPage ) );
@@ -56,26 +56,26 @@
5757 }
5858 else {
5959 $links = array();
60 -
 60+
6161 if ( $term->useCanManage( $this->getUser() ) ) {
6262 $links[wfMsg( 'ep-term-nav-edit' )] = SpecialPage::getTitleFor( 'EditTerm', $this->subPage );
6363 }
64 -
 64+
6565 $this->displayNavigation( $links );
66 -
 66+
6767 $this->displaySummary( $term );
68 -
 68+
6969 $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-term-description' ) ) );
70 -
 70+
7171 $out->addHTML( $this->getOutput()->parse( $term->getField( 'description' ) ) );
72 -
 72+
7373 $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-term-students' ) ) );
74 -
 74+
7575 // TODO: students
7676 }
7777 }
7878 }
79 -
 79+
8080 /**
8181 * Gets the summary data.
8282 *
@@ -112,7 +112,7 @@
113113 htmlspecialchars( $term->getField( 'token' ) )
114114 );
115115 }
116 -
 116+
117117 return $stats;
118118 }
119119
Index: trunk/extensions/EducationProgram/specials/SpecialAmbassador.php
@@ -33,7 +33,7 @@
3434 parent::execute( $subPage );
3535
3636 $out = $this->getOutput();
37 -
 37+
3838 if ( trim( $subPage ) === '' ) {
3939 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Ambassadors' )->getLocalURL() );
4040 }
@@ -42,8 +42,8 @@
4343
4444 $this->displayNavigation();
4545
46 - $mentor = false; //EPMentor::selectRow( null, array( 'id' => $this->subPage ) );
47 -
 46+ $mentor = false; // EPMentor::selectRow( null, array( 'id' => $this->subPage ) );
 47+
4848 if ( $mentor === false ) {
4949 $this->showWarning( wfMessage( 'ep-ambassador-does-not-exist', $this->subPage ) );
5050 }
@@ -52,7 +52,7 @@
5353 }
5454 }
5555 }
56 -
 56+
5757 /**
5858 * Gets the summary data.
5959 *
Index: trunk/extensions/EducationProgram/specials/SpecialInstitutions.php
@@ -42,5 +42,5 @@
4343 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Institution', $this->subPage )->getLocalURL() );
4444 }
4545 }
46 -
 46+
4747 }
Index: trunk/extensions/EducationProgram/specials/SpecialEditTerm.php
@@ -20,7 +20,7 @@
2121 */
2222 public function __construct() {
2323 parent::__construct( 'EditTerm', 'epmentor', 'EPTerm', 'Terms' );
24 -
 24+
2525 $this->getOutput()->addModules( 'ep.datepicker' );
2626 }
2727
@@ -31,9 +31,9 @@
3232 */
3333 protected function getFormFields() {
3434 $fields = parent::getFormFields();
35 -
 35+
3636 $courseOptions = EPCourse::getCourseOptions( EPCourse::getEditableCourses( $this->getUser() ) );
37 -
 37+
3838 $fields['course_id'] = array (
3939 'type' => 'select',
4040 'label-message' => 'ep-term-edit-course',
@@ -41,9 +41,9 @@
4242 'options' => $courseOptions,
4343 'validation-callback' => function ( $value, array $alldata = null ) use ( $courseOptions ) {
4444 return in_array( (int)$value, array_values( $courseOptions ) ) ? true : wfMsg( 'ep-term-invalid-course' );
45 - },
 45+ } ,
4646 );
47 -
 47+
4848 $fields['token'] = array (
4949 'type' => 'text',
5050 'label-message' => 'ep-term-edit-token',
@@ -52,9 +52,9 @@
5353 'size' => 20,
5454 'validation-callback' => function ( $value, array $alldata = null ) {
5555 return strlen( $value ) < 2 ? wfMsgExt( 'ep-term-invalid-token', 'parsemag', 2 ) : true;
56 - },
 56+ } ,
5757 );
58 -
 58+
5959 $fields['year'] = array (
6060 'type' => 'int',
6161 'label-message' => 'ep-term-edit-year',
@@ -63,32 +63,32 @@
6464 'max' => 9001,
6565 'size' => 15,
6666 );
67 -
 67+
6868 $fields['start'] = array (
6969 'class' => 'EPHTMLDateField',
7070 'label-message' => 'ep-term-edit-start',
7171 'required' => true,
7272 );
73 -
 73+
7474 $fields['end'] = array (
7575 'class' => 'EPHTMLDateField',
7676 'label-message' => 'ep-term-edit-end',
7777 'required' => true,
7878 );
79 -
 79+
8080 $fields['description'] = array (
8181 'type' => 'textarea',
8282 'label-message' => 'ep-term-edit-description',
8383 'required' => true,
8484 'validation-callback' => function ( $value, array $alldata = null ) {
8585 return strlen( $value ) < 10 ? wfMsgExt( 'ep-term-invalid-description', 'parsemag', 10 ) : true;
86 - },
 86+ } ,
8787 'rows' => 10
8888 );
89 -
 89+
9090 return $this->processFormFields( $fields );
9191 }
92 -
 92+
9393 /**
9494 * (non-PHPdoc)
9595 * @see SpecialEPFormPage::getTitleConditions()
@@ -96,7 +96,7 @@
9797 protected function getTitleConditions() {
9898 return array( 'id' => $this->subPage );
9999 }
100 -
 100+
101101 /**
102102 * (non-PHPdoc)
103103 * @see SpecialEPFormPage::getNewData()
@@ -107,7 +107,7 @@
108108 'year' => $this->getRequest()->getVal( 'newyear' ),
109109 );
110110 }
111 -
 111+
112112 /**
113113 * (non-PHPdoc)
114114 * @see SpecialEPFormPage::handleKnownField()
@@ -116,31 +116,31 @@
117117 if ( in_array( $name, array( 'end', 'start' ) ) ) {
118118 $value = wfTimestamp( TS_MW, strtotime( $value ) );
119119 }
120 -
 120+
121121 return $value;
122122 }
123 -
 123+
124124 }
125125
126126 class EPHTMLDateField extends HTMLTextField {
127 -
 127+
128128 public function __construct( $params ) {
129129 parent::__construct( $params );
130 -
 130+
131131 $this->mClass .= " ep-datepicker-tr";
132132 }
133 -
 133+
134134 function getSize() {
135135 return isset( $this->mParams['size'] )
136136 ? $this->mParams['size']
137137 : 20;
138138 }
139 -
 139+
140140 function getInputHTML( $value ) {
141141 $value = explode( 'T', wfTimestamp( TS_ISO_8601, strtotime( $value ) ) );
142142 return parent::getInputHTML( $value[0] );
143143 }
144 -
 144+
145145 function validate( $value, $alldata ) {
146146 $p = parent::validate( $value, $alldata );
147147
@@ -149,9 +149,9 @@
150150 }
151151
152152 $value = trim( $value );
153 -
 153+
154154 // TODO: further validation
155 -
 155+
156156 return true;
157157 }
158158 }
Index: trunk/extensions/EducationProgram/specials/SpecialCourses.php
@@ -42,5 +42,5 @@
4343 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Course', $this->subPage )->getLocalURL() );
4444 }
4545 }
46 -
 46+
4747 }
Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php
@@ -15,35 +15,35 @@
1616
1717 /**
1818 * Instance of the object being edited or created.
19 - *
 19+ *
2020 * @since 0.1
2121 * @var EPDBObject|false
2222 */
23 - protected $item = false;
 23+ protected $item = false;
2424
2525 /**
2626 * Name of the class of the object being edited or created.
27 - *
 27+ *
2828 * @since 0.1
2929 * @var string
3030 */
3131 protected $itemClass;
32 -
 32+
3333 /**
3434 * Name of the special page listing the items.
3535 * For example, for "EditLolcat", it could be "Lolcats".
36 - *
 36+ *
3737 * @since 0.1
3838 * @var string
3939 */
4040 protected $listPage;
41 -
 41+
4242 /**
4343 * Constructor.
4444 *
4545 * @since 0.1
46 - *
47 - * @param string $name Name of the page
 46+ *
 47+ * @param string $name Name of the page
4848 * @param string $right Right needed to access the page
4949 * @param string $itemClass Name of the item class
5050 * @param string $listPage Name of the page listing the items
@@ -51,12 +51,12 @@
5252 public function __construct( $name, $right, $itemClass, $listPage ) {
5353 $this->itemClass = $itemClass;
5454 $this->listPage = $listPage;
55 -
 55+
5656 parent::__construct( $name, $right, false );
57 -
 57+
5858 $this->getOutput()->addModules( 'ep.formpage' );
5959 }
60 -
 60+
6161 /**
6262 * @see SpecialPage::getDescription
6363 *
@@ -90,7 +90,7 @@
9191 */
9292 public function execute( $subPage ) {
9393 parent::execute( $subPage );
94 -
 94+
9595 if ( $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
9696 $this->showForm();
9797 }
@@ -98,7 +98,7 @@
9999 $this->showContent();
100100 }
101101 }
102 -
 102+
103103 /**
104104 * Display the form and set the item field, or redirect the user.
105105 *
@@ -106,7 +106,7 @@
107107 */
108108 protected function showContent() {
109109 $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_>
110 -
 110+
111111 if ( $this->isNew() ) {
112112 $data = $this->getNewData();
113113
@@ -137,22 +137,22 @@
138138 $this->showForm();
139139 }
140140 }
141 -
 141+
142142 /**
143143 * Returns if the page should work in insertion mode rather then modification mode.
144 - *
 144+ *
145145 * @since 0.1
146 - *
 146+ *
147147 * @return boolean
148148 */
149149 protected function isNew() {
150150 static $isNew = null;
151 -
 151+
152152 if ( is_null( $isNew ) ) {
153153 $isNew = $this->getRequest()->wasPosted() &&
154154 ( $this->getRequest()->getCheck( 'isnew' ) || $this->getRequest()->getCheck( 'wpisnew' ) );
155155 }
156 -
 156+
157157 return $isNew;
158158 }
159159
@@ -174,25 +174,25 @@
175175 }
176176 }
177177 }
178 -
 178+
179179 /**
180180 * Returns the data to use as condition for selecting the object,
181181 * or in case nothing matches the selection, the data to initialize
182182 * it with. This is typically an identifier such as name or id.
183 - *
 183+ *
184184 * @since 0.1
185 - *
 185+ *
186186 * @return array
187187 */
188188 protected function getNewData() {
189189 return array( 'name' => $this->getRequest()->getVal( 'newname' ) );
190190 }
191 -
 191+
192192 /**
193193 * Get the query conditions to obtain the item based on the page title.
194 - *
 194+ *
195195 * @since 0.1
196 - *
 196+ *
197197 * @return array
198198 */
199199 protected function getTitleConditions() {
@@ -221,7 +221,7 @@
222222
223223 $action = $this->isNew() ? 'add' : 'edit';
224224 $form->setWrapperLegend( $this->msg( strtolower( $this->getName() ) . '-' . $action . '-legend' ) );
225 -
 225+
226226 $form->addButton(
227227 'cancelEdit',
228228 wfMsg( 'cancel' ),
@@ -239,7 +239,7 @@
240240
241241 return $form;
242242 }
243 -
 243+
244244 /**
245245 * (non-PHPdoc)
246246 * @see FormSpecialPage::getFormFields()
@@ -258,16 +258,16 @@
259259 && $req->getCheck( 'wpitem-id' ) ) {
260260 $fields['id']['default'] = $req->getInt( 'wpitem-id' );
261261 }
262 -
 262+
263263 return $fields;
264264 }
265 -
 265+
266266 /**
267267 * Populates the form fields with the data of the item
268268 * and prefixes their names.
269 - *
 269+ *
270270 * @since 0.1
271 - *
 271+ *
272272 * @param array $fields
273273 *
274274 * @return array
@@ -280,7 +280,7 @@
281281 }
282282 }
283283 }
284 -
 284+
285285 $mappedFields = array();
286286
287287 foreach ( $fields as $name => $field ) {
@@ -290,36 +290,36 @@
291291 unset( $field['validation-callback'] );
292292 unset( $field['required'] );
293293 }
294 -
 294+
295295 $mappedFields['item-' . $name] = $field;
296296 }
297297
298298 return $mappedFields;
299299 }
300 -
 300+
301301 /**
302302 * Gets the default value for a field from the item.
303 - *
 303+ *
304304 * @since 0.1
305 - *
 305+ *
306306 * @param EPDBObject $item
307307 * @param string $name
308 - *
 308+ *
309309 * @return mixed
310310 */
311311 protected function getDefaultFromItem( EPDBObject $item, $name ) {
312312 return $item->getField( $name );
313313 }
314 -
 314+
315315 /**
316316 * Gets called after the form is saved.
317 - *
 317+ *
318318 * @since 0.1
319319 */
320320 public function onSuccess() {
321321 $this->getOutput()->redirect( SpecialPage::getTitleFor( $this->listPage )->getLocalURL() );
322322 }
323 -
 323+
324324 /**
325325 * Process the form. At this point we know that the user passes all the criteria in
326326 * userCanExecute().
@@ -341,7 +341,7 @@
342342 if ( $matches[1] === 'id' && ( $value === '' || $value === '0' ) ) {
343343 $value = null;
344344 }
345 -
 345+
346346 if ( $c::canHasField( $matches[1] ) ) {
347347 $fields[$matches[1]] = $value;
348348 }
@@ -353,7 +353,7 @@
354354
355355 $keys = array_keys( $fields );
356356 $fields = array_combine( $keys, array_map( array( $this, 'handleKnownField' ), $keys, $fields ) );
357 -
 357+
358358 /* EPDBObject */ $item = new $c( $fields, is_null( $fields['id'] ) );
359359
360360 foreach ( $unknownValues as $name => $value ) {
@@ -369,12 +369,12 @@
370370 return array(); // TODO
371371 }
372372 }
373 -
 373+
374374 /**
375375 * Gets called for evey unknown submitted value, so they can be dealt with if needed.
376 - *
 376+ *
377377 * @since 0.1
378 - *
 378+ *
379379 * @param EPDBObject $item
380380 * @param string $name
381381 * @param string $value This is a string, since it comes from request data, but might be a number or other type.
@@ -382,20 +382,20 @@
383383 protected function handleUnknownField( EPDBObject $item, $name, $value ) {
384384 // Override to use.
385385 }
386 -
 386+
387387 /**
388388 * Gets called for evey known submitted value, so they can be dealt with if needed.
389 - *
 389+ *
390390 * @since 0.1
391 - *
 391+ *
392392 * @param string $name
393393 * @param string $value This is a string, since it comes from request data, but might be a number or other type.
394 - *
 394+ *
395395 * @return mixed The new value
396396 */
397397 protected function handleKnownField( $name, $value ) {
398398 // Override to use.
399399 return $value;
400400 }
401 -
 401+
402402 }
Index: trunk/extensions/EducationProgram/specials/SpecialStudent.php
@@ -1,8 +1,8 @@
22 <?php
33
44 /**
5 - *
65 *
 6+ *
77 * @since 0.1
88 *
99 * @file SpecialStudent.php
Index: trunk/extensions/EducationProgram/INSTALL
@@ -1,5 +1,5 @@
22 These is the install file for the Education Program extension.
3 -
 3+
44 Extension page on mediawiki.org: https://www.mediawiki.org/wiki/Extension:Education_Program
55 Latest version of the install file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/EducationProgram/INSTALL?view=co
66
Index: trunk/extensions/EducationProgram/includes/EPMentor.php
@@ -15,12 +15,12 @@
1616
1717 /**
1818 * Cached array of the linked EPOrg objects.
19 - *
 19+ *
2020 * @since 0.1
2121 * @var array|false
2222 */
2323 protected $orgs = false;
24 -
 24+
2525 /**
2626 * @see parent::getFieldTypes
2727 *
@@ -34,26 +34,26 @@
3535 'user_id' => 'id',
3636 );
3737 }
38 -
 38+
3939 /**
4040 * Returns the orgs this mentor is part of.
4141 * Caches the result when no conditions are provided and all fields are selected.
42 - *
 42+ *
4343 * @since 0.1
44 - *
 44+ *
4545 * @param array|null $fields
4646 * @param array $conditions
47 - *
 47+ *
4848 * @return array of EPOrg
4949 */
5050 public function getOrgs( array $fields = null, array $conditions = array() ) {
5151 if ( count( $conditions ) !== 0 ) {
5252 return $this->doGetOrgs( $fields, $conditions );
5353 }
54 -
 54+
5555 if ( $this->orgs === false ) {
5656 $orgs = $this->doGetOrgs( $fields, $conditions );
57 -
 57+
5858 if ( is_null( $fields ) ) {
5959 $this->orgs = $orgs;
6060 }
@@ -64,15 +64,15 @@
6565 return $this->orgs;
6666 }
6767 }
68 -
 68+
6969 /**
7070 * Returns the orgs this mentor is part of.
71 - *
 71+ *
7272 * @since 0.1
73 - *
 73+ *
7474 * @param array|null $fields
7575 * @param array $conditions
76 - *
 76+ *
7777 * @return array of EPOrg
7878 */
7979 protected function doGetOrgs( $fields, array $conditions ) {
@@ -80,7 +80,7 @@
8181 array( array( 'ep_mentors', 'id' ), $this->getId() ),
8282 $conditions
8383 );
84 -
 84+
8585 return EPOrg::select(
8686 $fields,
8787 $conditions,
@@ -91,15 +91,15 @@
9292 )
9393 );
9494 }
95 -
 95+
9696 /**
97 - * Retruns the courses this mentor can manage.
98 - *
 97+ * Retruns the courses this mentor can manage.
 98+ *
9999 * @since 0.1
100 - *
 100+ *
101101 * @param array|null $fields
102102 * @param array $conditions
103 - *
 103+ *
104104 * @return array of EPCourse
105105 */
106106 public function getCourses( array $fields = null, array $conditions = array() ) {
@@ -107,19 +107,19 @@
108108 $this->getOrgs( $fields, $conditions ),
109109 function( array $courses, EPOrg $org ) use ( $fields ) {
110110 return array_merge( $courses, $org->getCourses( $fields ) );
111 - },
 111+ } ,
112112 array()
113113 );
114114 }
115 -
 115+
116116 /**
117 - * Retruns the terms this mentor can manage.
118 - *
 117+ * Retruns the terms this mentor can manage.
 118+ *
119119 * @since 0.1
120 - *
 120+ *
121121 * @param array|null $fields
122122 * @param array $conditions
123 - *
 123+ *
124124 * @return array of EPTerm
125125 */
126126 public function getTerms( array $fields = null, array $conditions = array() ) {
@@ -127,31 +127,31 @@
128128 $this->getOrgs( $fields, $conditions ),
129129 function( array $terms, EPOrg $org ) use ( $fields ) {
130130 return array_merge( $terms, $org->getTerms( $fields ) );
131 - },
 131+ } ,
132132 array()
133133 );
134134 }
135 -
 135+
136136 /**
137 - * Retruns if the mentor has any course matching the provided contitions.
138 - *
 137+ * Retruns if the mentor has any course matching the provided contitions.
 138+ *
139139 * @since 0.1
140 - *
 140+ *
141141 * @param array $conditions
142 - *
 142+ *
143143 * @return boolean
144144 */
145145 public function hasCourse( array $conditions = array() ) {
146146 return count( $this->getCourses( 'id', $conditions ) ) > 0;
147147 }
148 -
 148+
149149 /**
150150 * Retruns if the mentor has any term matching the provided conditions.
151 - *
 151+ *
152152 * @since 0.1
153 - *
 153+ *
154154 * @param array $conditions
155 - *
 155+ *
156156 * @return boolean
157157 */
158158 public function hasTerm( array $conditions = array() ) {
Index: trunk/extensions/EducationProgram/includes/EPStudentPager.php
@@ -39,7 +39,7 @@
4040 'active_enroll',
4141 );
4242 }
43 -
 43+
4444 /**
4545 * (non-PHPdoc)
4646 * @see TablePager::getRowClass()
@@ -47,12 +47,12 @@
4848 function getRowClass( $row ) {
4949 return 'ep-student-row';
5050 }
51 -
 51+
5252 /**
5353 * (non-PHPdoc)
5454 * @see TablePager::getTableClass()
5555 */
56 - public function getTableClass(){
 56+ public function getTableClass() {
5757 return 'TablePager ep-students';
5858 }
5959
@@ -81,7 +81,7 @@
8282 $value = $this->getLanguage()->pipeList( array_map(
8383 function( EPCourse $course ) {
8484 return $course->getLink();
85 - },
 85+ } ,
8686 $this->currentObject->getCurrentCourses( 'name' )
8787 ) );
8888 break;
Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php
@@ -39,7 +39,7 @@
4040 'active',
4141 );
4242 }
43 -
 43+
4444 /**
4545 * (non-PHPdoc)
4646 * @see TablePager::getRowClass()
@@ -47,12 +47,12 @@
4848 function getRowClass( $row ) {
4949 return 'ep-org-row';
5050 }
51 -
 51+
5252 /**
5353 * (non-PHPdoc)
5454 * @see TablePager::getTableClass()
5555 */
56 - public function getTableClass(){
 56+ public function getTableClass() {
5757 return 'TablePager ep-orgs';
5858 }
5959
@@ -138,28 +138,28 @@
139139 ),
140140 );
141141 }
142 -
 142+
143143 /**
144144 * (non-PHPdoc)
145145 * @see EPPager::getControlLinks()
146146 */
147147 protected function getControlLinks( EPDBObject $item ) {
148148 $links = parent::getControlLinks( $item );
149 -
 149+
150150 $links[] = $value = Linker::linkKnown(
151151 SpecialPage::getTitleFor( 'Institution', $item->getField( 'name' ) ),
152152 wfMsgHtml( 'view' )
153153 );
154 -
 154+
155155 if ( $this->getUser()->isAllowed( 'epadmin' ) ) {
156156 $links[] = $value = Linker::linkKnown(
157157 SpecialPage::getTitleFor( 'EditInstitution', $item->getField( 'name' ) ),
158158 wfMsgHtml( 'edit' )
159159 );
160 -
 160+
161161 $links[] = $this->getDeletionLink( 'org', $item->getId() );
162162 }
163 -
 163+
164164 return $links;
165165 }
166166
Index: trunk/extensions/EducationProgram/includes/EPStudent.php
@@ -39,15 +39,15 @@
4040 'active_enroll' => 'bool',
4141 );
4242 }
43 -
 43+
4444 /**
4545 * Get the student object of a user, or false if there is none.
46 - *
 46+ *
4747 * @since 0.1
48 - *
 48+ *
4949 * @param User $user
5050 * @param string|array|null $fields
51 - *
 51+ *
5252 * @return EPStudent|false
5353 */
5454 public static function newFromUser( User $user, $fields = null ) {
@@ -137,7 +137,7 @@
138138 function( array $ids, EPTerm $term ) {
139139 $ids[] = $term->getField( 'course_id' );
140140 return $ids;
141 - },
 141+ } ,
142142 array()
143143 );
144144
@@ -244,5 +244,5 @@
245245 $context->getOutput()->addWikiMsg( 'ep-students-noresults' );
246246 }
247247 }
248 -
 248+
249249 }
Index: trunk/extensions/EducationProgram/includes/EPTermPager.php
@@ -36,7 +36,7 @@
3737 'end',
3838 );
3939 }
40 -
 40+
4141 /**
4242 * (non-PHPdoc)
4343 * @see TablePager::getRowClass()
@@ -44,12 +44,12 @@
4545 function getRowClass( $row ) {
4646 return 'ep-term-row';
4747 }
48 -
 48+
4949 /**
5050 * (non-PHPdoc)
5151 * @see TablePager::getTableClass()
5252 */
53 - public function getTableClass(){
 53+ public function getTableClass() {
5454 return 'TablePager ep-terms';
5555 }
5656
@@ -67,7 +67,7 @@
6868 break;
6969 case 'course_id':
7070 $value = EPCourse::selectRow( 'name', array( 'id' => $value ) )->getField( 'name' );
71 -
 71+
7272 $value = Linker::linkKnown(
7373 SpecialPage::getTitleFor( 'Course', $value ),
7474 htmlspecialchars( $value )
@@ -114,7 +114,7 @@
115115
116116 return $fields;
117117 }
118 -
 118+
119119 /**
120120 * (non-PHPdoc)
121121 * @see EPPager::getFilterOptions()
@@ -166,31 +166,31 @@
167167
168168 return $options;
169169 }
170 -
 170+
171171 /**
172172 * (non-PHPdoc)
173173 * @see EPPager::getControlLinks()
174174 */
175175 protected function getControlLinks( EPDBObject $item ) {
176176 $links = parent::getControlLinks( $item );
177 -
 177+
178178 $links[] = $value = Linker::linkKnown(
179179 SpecialPage::getTitleFor( 'Term', $item->getId() ),
180180 wfMsgHtml( 'view' )
181181 );
182 -
 182+
183183 if ( $this->getUser()->isAllowed( 'epadmin' ) ) {
184184 $links[] = $value = Linker::linkKnown(
185185 SpecialPage::getTitleFor( 'EditTerm', $item->getId() ),
186186 wfMsgHtml( 'edit' )
187187 );
188 -
 188+
189189 $links[] = $this->getDeletionLink( 'term', $item->getId() );
190190 }
191 -
 191+
192192 return $links;
193193 }
194 -
 194+
195195 /**
196196 * (non-PHPdoc)
197197 * @see EPPager::getMultipleItemActions()
Index: trunk/extensions/EducationProgram/includes/EPOrg.php
@@ -15,20 +15,20 @@
1616
1717 /**
1818 * Cached array of the linked EPCourse objects.
19 - *
 19+ *
2020 * @since 0.1
2121 * @var array|false
2222 */
2323 protected $courses = false;
24 -
 24+
2525 /**
2626 * Cached array of the linked EPTerm objects.
27 - *
 27+ *
2828 * @since 0.1
2929 * @var array|false
3030 */
3131 protected $terms = false;
32 -
 32+
3333 /**
3434 * @see parent::getFieldTypes
3535 *
@@ -39,7 +39,7 @@
4040 protected static function getFieldTypes() {
4141 return array(
4242 'id' => 'id',
43 -
 43+
4444 'name' => 'str',
4545 'city' => 'str',
4646 'country' => 'str',
@@ -133,54 +133,54 @@
134134
135135 $this->setFields( $fields );
136136 }
137 -
 137+
138138 /**
139139 * (non-PHPdoc)
140140 * @see EPDBObject::removeFromDB()
141141 */
142142 public function removeFromDB() {
143143 $id = $this->getId();
144 -
 144+
145145 $success = parent::removeFromDB();
146 -
 146+
147147 if ( $success ) {
148148 $success = wfGetDB( DB_MASTER )->delete( 'ep_mentors_per_org', array( 'mpo_org_id' => $id ) ) && $success;
149 -
 149+
150150 foreach ( EPCourse::select( 'id', array( 'org_id' => $id ) ) as /* EPCourse */ $course ) {
151151 $success = $course->removeFromDB() && $success;
152152 }
153153 }
154 -
 154+
155155 return $success;
156156 }
157 -
 157+
158158 /**
159159 * Returns a list of orgs in an array that can be fed to select inputs.
160 - *
 160+ *
161161 * @since 0.1
162 - *
 162+ *
163163 * @param array $orgs
164 - *
 164+ *
165165 * @return array
166166 */
167167 public static function getOrgOptions( array /* EPOrg */ $orgs ) {
168168 $options = array();
169 -
 169+
170170 foreach ( $orgs as /* EPOrg */ $org ) {
171171 $options[$org->getField( 'name' )] = $org->getId();
172172 }
173 -
 173+
174174 return $options;
175175 }
176 -
 176+
177177 /**
178178 * Returns the list of orgs that the specified user can edit.
179 - *
 179+ *
180180 * @since 0.1
181 - *
 181+ *
182182 * @param User|int $user
183183 * @param array|null $fields
184 - *
 184+ *
185185 * @return array of EPOrg
186186 */
187187 public static function getEditableOrgs( $user, array $fields = null ) {
@@ -191,7 +191,7 @@
192192 else {
193193 $userId = $user->getId();
194194 }
195 -
 195+
196196 if ( $user->isAllowed( 'epadmin' ) ) {
197197 return self::select( $fields );
198198 }
@@ -203,25 +203,25 @@
204204 return array();
205205 }
206206 }
207 -
 207+
208208 /**
209209 * Adds a control to add a new org to the provided context.
210210 * Adittional arguments can be provided to set the default values for the control fields.
211 - *
 211+ *
212212 * @since 0.1
213 - *
 213+ *
214214 * @param IContextSource $context
215215 * @param array $args
216 - *
 216+ *
217217 * @return boolean
218218 */
219219 public static function displayAddNewControl( IContextSource $context, array $args = array() ) {
220220 if ( !$context->getUser()->isAllowed( 'epadmin' ) ) {
221221 return false;
222222 }
223 -
 223+
224224 $out = $context->getOutput();
225 -
 225+
226226 $out->addHTML( Html::openElement(
227227 'form',
228228 array(
@@ -253,21 +253,21 @@
254254 $out->addHTML( Html::hidden( 'isnew', 1 ) );
255255
256256 $out->addHTML( '</fieldset></form>' );
257 -
 257+
258258 return true;
259259 }
260 -
 260+
261261 /**
262262 * Display a pager with courses.
263 - *
 263+ *
264264 * @since 0.1
265 - *
 265+ *
266266 * @param IContextSource $context
267267 * @param array $conditions
268268 */
269269 public static function displayPager( IContextSource $context, array $conditions = array() ) {
270270 $pager = new EPOrgPager( $context, $conditions );
271 -
 271+
272272 if ( $pager->getNumRows() ) {
273273 $context->getOutput()->addHTML(
274274 $pager->getFilterControl() .
@@ -282,38 +282,38 @@
283283 $context->getOutput()->addWikiMsg( 'ep-institutions-noresults' );
284284 }
285285 }
286 -
 286+
287287 /**
288 - * Retruns the courses linked to this org.
289 - *
 288+ * Retruns the courses linked to this org.
 289+ *
290290 * @since 0.1
291 - *
 291+ *
292292 * @param array|null $fields
293 - *
 293+ *
294294 * @return array of EPCourse
295295 */
296296 public function getCourses( array $fields = null ) {
297297 if ( $this->courses === false ) {
298298 $this->courses = EPCourse::select( $fields, array( 'org_id' => $this->getId() ) );
299299 }
300 -
 300+
301301 return $this->courses;
302302 }
303 -
 303+
304304 /**
305 - * Retruns the terms linked to this org.
306 - *
 305+ * Retruns the terms linked to this org.
 306+ *
307307 * @since 0.1
308 - *
 308+ *
309309 * @param array|null $fields
310 - *
 310+ *
311311 * @return array of EPTerm
312312 */
313313 public function getTerms( array $fields = null ) {
314314 if ( $this->terms === false ) {
315315 $this->terms = EPTerm::select( $fields, array( 'org_id' => $this->getId() ) );
316316 }
317 -
 317+
318318 return $this->terms;
319319 }
320320
@@ -330,5 +330,5 @@
331331 htmlspecialchars( $this->getField( 'name' ) )
332332 );
333333 }
334 -
 334+
335335 }
Index: trunk/extensions/EducationProgram/includes/EPTerm.php
@@ -16,15 +16,15 @@
1717
1818 /**
1919 * Field for caching the linked course.
20 - *
 20+ *
2121 * @since 0.1
2222 * @var EPCourse|false
2323 */
2424 protected $course = false;
25 -
 25+
2626 /**
2727 * Field for caching the linked org.
28 - *
 28+ *
2929 * @since 0.1
3030 * @var EPOrg|false
3131 */
@@ -77,7 +77,7 @@
7878 'id' => 'id',
7979 'course_id' => 'id',
8080 'org_id' => 'id',
81 -
 81+
8282 'year' => 'int',
8383 'start' => 'str', // TS_MW
8484 'end' => 'str', // TS_MW
@@ -85,7 +85,7 @@
8686 'token' => 'str',
8787 );
8888 }
89 -
 89+
9090 /**
9191 * (non-PHPdoc)
9292 * @see EPDBObject::getDefaults()
@@ -139,7 +139,7 @@
140140
141141 return $success;
142142 }
143 -
 143+
144144 /**
145145 * (non-PHPdoc)
146146 * @see EPDBObject::removeFromDB()
@@ -154,7 +154,7 @@
155155 }
156156
157157 $success = parent::removeFromDB();
158 -
 158+
159159 if ( $success && $this->updateSummaries ) {
160160 EPCourse::updateSummaryFields( 'students', array( 'id' => $courseId ) );
161161 EPOrg::updateSummaryFields( array( 'terms', 'students', 'active' ), array( 'id' => $orgId ) );
@@ -201,52 +201,52 @@
202202
203203 return $success;
204204 }
205 -
 205+
206206 /**
207207 * Returns the course associated with this term.
208 - *
 208+ *
209209 * @since 0.1
210 - *
 210+ *
211211 * @param string|array|null $fields
212 - *
 212+ *
213213 * @return EPCourse
214214 */
215215 public function getCourse( $fields = null ) {
216216 if ( $this->course === false ) {
217217 $this->course = EPCourse::selectRow( $fields, array( 'id' => $this->loadAndGetField( 'course_id' ) ) );
218218 }
219 -
 219+
220220 return $this->course;
221221 }
222 -
 222+
223223 /**
224224 * Returns the org associated with this term.
225 - *
 225+ *
226226 * @since 0.1
227 - *
 227+ *
228228 * @param string|array|null $fields
229 - *
 229+ *
230230 * @return EPOrg
231231 */
232232 public function getOrg( $fields = null ) {
233233 if ( $this->org === false ) {
234234 $this->org = EPOrg::selectRow( $fields, array( 'id' => $this->loadAndGetField( 'org_id' ) ) );
235235 }
236 -
 236+
237237 return $this->org;
238238 }
239 -
 239+
240240 /**
241241 * Display a pager with terms.
242 - *
 242+ *
243243 * @since 0.1
244 - *
 244+ *
245245 * @param IContextSource $context
246246 * @param array $conditions
247247 */
248248 public static function displayPager( IContextSource $context, array $conditions = array() ) {
249249 $pager = new EPTermPager( $context, $conditions );
250 -
 250+
251251 if ( $pager->getNumRows() ) {
252252 $context->getOutput()->addHTML(
253253 $pager->getFilterControl() .
@@ -261,23 +261,23 @@
262262 $context->getOutput()->addWikiMsg( 'ep-terms-noresults' );
263263 }
264264 }
265 -
 265+
266266 /**
267267 * Adds a control to add a term org to the provided context.
268268 * Additional arguments can be provided to set the default values for the control fields.
269 - *
 269+ *
270270 * @since 0.1
271 - *
 271+ *
272272 * @param IContextSource $context
273273 * @param array $args
274 - *
 274+ *
275275 * @return boolean
276276 */
277277 public static function displayAddNewControl( IContextSource $context, array $args ) {
278278 if ( !$context->getUser()->isAllowed( 'epmentor' ) ) {
279279 return false;
280280 }
281 -
 281+
282282 $out = $context->getOutput();
283283
284284 $out->addHTML( Html::openElement(
@@ -295,16 +295,16 @@
296296 $out->addHTML( Html::element( 'p', array(), wfMsg( 'ep-terms-namedoc' ) ) );
297297
298298 $out->addHTML( Html::element( 'label', array( 'for' => 'newcourse' ), wfMsg( 'ep-terms-newcourse' ) ) );
299 -
 299+
300300 $select = new XmlSelect(
301301 'newcourse',
302302 'newcourse',
303303 array_key_exists( 'course', $args ) ? $args['course'] : false
304304 );
305 -
 305+
306306 $select->addOptions( EPCourse::getCourseOptions( EPCourse::getEditableCourses( $context->getUser() ) ) );
307307 $out->addHTML( $select->getHTML() );
308 -
 308+
309309 $out->addHTML( '&#160;' . Xml::inputLabel( wfMsg( 'ep-terms-newyear' ), 'newyear', 'newyear', 10 ) );
310310
311311 $out->addHTML( '&#160;' . Html::input(
@@ -314,24 +314,24 @@
315315 ) );
316316
317317 $out->addHTML( Html::hidden( 'isnew', 1 ) );
318 -
 318+
319319 $out->addHTML( '</fieldset></form>' );
320 -
 320+
321321 return true;
322322 }
323 -
 323+
324324 /**
325325 * Adds a control to add a new term to the provided context
326326 * or show a message if this is not possible for some reason.
327 - *
 327+ *
328328 * @since 0.1
329 - *
 329+ *
330330 * @param IContextSource $context
331331 * @param array $args
332332 */
333333 public static function displayAddNewRegion( IContextSource $context, array $args = array() ) {
334334 $courses = EPCourse::getEditableCourses( $context->getUser() );
335 -
 335+
336336 if ( count( $courses ) > 0 ) {
337337 EPTerm::displayAddNewControl( $context, $args );
338338 }
@@ -342,29 +342,29 @@
343343 $context->getOutput()->addWikiMsg( 'ep-terms-addcoursefirst' );
344344 }
345345 }
346 -
 346+
347347 /**
348348 * Returns if the provided user can manage the term or not.
349 - *
 349+ *
350350 * @since 0.1
351 - *
 351+ *
352352 * @param User $user
353 - *
 353+ *
354354 * @return boolean
355355 */
356356 public function useCanManage( User $user ) {
357357 if ( $user->isAllowed( 'epadmin' ) ) {
358358 return true;
359359 }
360 -
 360+
361361 if ( $user->isAllowed( 'epmentor' ) ) {
362362 $mentor = EPMentor::selectRow( 'id', array( 'user_id' => $user->getId() ) );
363 -
 363+
364364 if ( $mentor !== false ) {
365365 return $mentor->hasTerm( array( 'id' => $this->getId() ) );
366366 }
367367 }
368 -
 368+
369369 return false;
370370 }
371371
@@ -403,7 +403,7 @@
404404 if ( $this->getDaysLeft() <= 0 ) {
405405 $status = 'passed';
406406 }
407 - elseif( $this->getDaysPassed() <= 0 ) {
 407+ elseif ( $this->getDaysPassed() <= 0 ) {
408408 $status = 'planned';
409409 }
410410 else {
Index: trunk/extensions/EducationProgram/includes/EPDBObject.php
@@ -2,12 +2,12 @@
33
44 /**
55 * Abstract base class for representing objects that are stored in some DB table.
6 - *
 6+ *
77 * These methods must be implemented in deriving classes:
88 * * getDBTable
99 * * getFieldPrefix
1010 * * getFieldTypes
11 - *
 11+ *
1212 * These methods are likely candidates for overriding:
1313 * * getDefaults
1414 *
@@ -51,9 +51,9 @@
5252
5353 /**
5454 * Returns the name of the database table objects of this type are stored in.
55 - *
 55+ *
5656 * @since 0.1
57 - *
 57+ *
5858 * @throws MWException
5959 * @return string
6060 */
@@ -68,10 +68,10 @@
6969 }
7070
7171 /**
72 - * Gets the db field prefix.
73 - *
 72+ * Gets the db field prefix.
 73+ *
7474 * @since 0.1
75 - *
 75+ *
7676 * @throws MWException
7777 * @return string
7878 */
@@ -84,7 +84,7 @@
8585 throw new MWException( 'Class "' . get_called_class() . '" not found in $egEPDBObjects' );
8686 }
8787 }
88 -
 88+
8989 /**
9090 * Returns an array with the fields and their types this object contains.
9191 * This corresponds directly to the fields in the database, without prefix.
@@ -119,7 +119,7 @@
120120 public static function getDefaults() {
121121 return array();
122122 }
123 -
 123+
124124 /**
125125 * Constructor.
126126 *
@@ -515,7 +515,7 @@
516516 public static function newFromArray( array $data, $loadDefaults = false ) {
517517 return new static( $data, $loadDefaults );
518518 }
519 -
 519+
520520 /**
521521 * Get the database type used for read operations.
522522 *
@@ -583,13 +583,13 @@
584584 */
585585 public static function getPrefixedField( $field ) {
586586 static $prefixes = false;
587 -
 587+
588588 if ( $prefixes === false ) {
589589 foreach ( $GLOBALS['egEPDBObjects'] as $classInfo ) {
590590 $prefixes[$classInfo['table']] = $classInfo['prefix'];
591591 }
592592 }
593 -
 593+
594594 if ( is_array( $field ) && count( $field ) > 1 ) {
595595 if ( array_key_exists( $field[0], $prefixes ) ) {
596596 $prefix = $prefixes[$field[0]];
@@ -602,7 +602,7 @@
603603 else {
604604 $prefix = static::getFieldPrefix();
605605 }
606 -
 606+
607607 return $prefix . $field;
608608 }
609609
@@ -610,7 +610,7 @@
611611 * Takes in an associative array with field names as keys and
612612 * their values as value. The field names are prefixed with the
613613 * db field prefix.
614 - *
 614+ *
615615 * Field names can also be provided as an array with as first element a table name, such as
616616 * $conditions = array(
617617 * array( array( 'tablename', 'fieldname' ), $value ),
@@ -638,7 +638,7 @@
639639 continue;
640640 }
641641 }
642 -
 642+
643643 $prefixedValues[static::getPrefixedField( $field )] = $value;
644644 }
645645
@@ -663,27 +663,27 @@
664664 array_values( $result )
665665 );
666666 }
667 -
 667+
668668 /**
669669 * Takes a field name with prefix and returns the unprefixed equivalent.
670 - *
 670+ *
671671 * @since 0.1
672 - *
 672+ *
673673 * @param string $fieldName
674 - *
 674+ *
675675 * @return string
676676 */
677677 public static function unprefixFieldName( $fieldName ) {
678678 return substr( $fieldName, strlen( static::getFieldPrefix() ) );
679679 }
680 -
 680+
681681 /**
682682 * Takes an array of field names with prefix and returns the unprefixed equivalent.
683 - *
 683+ *
684684 * @since 0.1
685 - *
 685+ *
686686 * @param array $fieldNames
687 - *
 687+ *
688688 * @return array
689689 */
690690 public static function unprefixFieldNames( array $fieldNames ) {
@@ -783,13 +783,13 @@
784784
785785 return $objects;
786786 }
787 -
 787+
788788 /**
789789 * Selects the the specified fields of the records matching the provided
790790 * conditions and returns them as associative arrays.
791791 * Provided field names get prefixed.
792792 * Returned field names will not have a prefix.
793 - *
 793+ *
794794 * When $collapse is true:
795795 * If one field is selected, each item in the result array will be this field.
796796 * If two fields are selected, each item in the result array will have as key
@@ -830,46 +830,46 @@
831831 foreach ( $result as $record ) {
832832 $objects[] = static::getFieldsFromDBResult( $record );
833833 }
834 -
 834+
835835 if ( $collapse ) {
836836 if ( count( $fields ) === 1 ) {
837 - $objects = array_map( function( $object ) { return array_shift( $object ); }, $objects );
 837+ $objects = array_map( function( $object ) { return array_shift( $object ); } , $objects );
838838 }
839839 elseif ( count( $fields ) === 2 ) {
840840 $o = array();
841 -
 841+
842842 foreach ( $objects as $object ) {
843843 $o[array_shift( $object )] = array_shift( $object );
844844 }
845 -
 845+
846846 $objects = $o;
847847 }
848848 }
849849
850850 return $objects;
851851 }
852 -
 852+
853853 /**
854854 * Process the join conditions. This includes prefixing table and field names,
855 - * and adding of needed tables.
856 - *
 855+ * and adding of needed tables.
 856+ *
857857 * @since 0.1
858 - *
 858+ *
859859 * @param array $joinConds Join conditions without prefixes and fields in array rather then string with equals sign.
860860 * @param array $tables List of tables to which the extra needed ones get added.
861 - *
 861+ *
862862 * @return array Join conditions ready to be fed to MediaWikis native select function.
863863 */
864864 protected static function getProcessedJoinConds( array $joinConds, array &$tables ) {
865865 $conds = array();
866 -
 866+
867867 foreach ( $joinConds as $table => $joinCond ) {
868868 if ( !in_array( $table, $tables ) ) {
869869 $tables[] = $table;
870870 }
871 -
 871+
872872 $cond = array( $joinCond[0], array() );
873 -
 873+
874874 foreach ( $joinCond[1] as $joinCondPart ) {
875875 $parts = array(
876876 static::getPrefixedField( $joinCondPart[0] ),
@@ -884,9 +884,9 @@
885885 $tables[] = $joinCondPart[1][0];
886886 }
887887
888 - $cond[1][] = implode( '=', $parts );
 888+ $cond[1][] = implode( '=', $parts );
889889 }
890 -
 890+
891891 $conds[] = $cond;
892892 }
893893
@@ -992,7 +992,7 @@
993993 if ( is_null( $tables ) ) {
994994 $tables = static::getDBTable();
995995 }
996 -
 996+
997997 $dbr = wfGetDB( static::getReadDb() );
998998
999999 return $dbr->select(
Index: trunk/extensions/EducationProgram/includes/EPPager.php
@@ -20,7 +20,7 @@
2121 * @var array
2222 */
2323 protected $conds;
24 -
 24+
2525 /**
2626 * Name of the class deriving from EPDBObject.
2727 * @since 0.1
@@ -34,14 +34,14 @@
3535 * @var EPDBObject
3636 */
3737 protected $currentObject;
38 -
 38+
3939 /**
4040 * Context in which this pager is being shown.
4141 * @since 0.1
4242 * @var IContextSource
4343 */
4444 protected $context;
45 -
 45+
4646 /**
4747 * Constructor.
4848 *
@@ -53,16 +53,16 @@
5454 $this->conds = $conds;
5555 $this->className = $className;
5656 $this->context = $context;
57 -
 57+
5858 $this->mDefaultDirection = true;
59 -
 59+
6060 if ( method_exists( 'TablePager', 'getUser' ) ) {
6161 parent::__construct( $context );
6262 }
6363 else {
6464 parent::__construct();
6565 }
66 -
 66+
6767 $this->context->getOutput()->addModules( 'ep.pager' );
6868 }
6969
@@ -89,7 +89,7 @@
9090 public function getLanguage() {
9191 return method_exists( $this->context, 'getLanguage' ) ? $this->context->getLanguage() : $this->context->getLang();
9292 }
93 -
 93+
9494 /**
9595 * Get the User being used for this instance.
9696 * IndexPager extends ContextSource as of 1.19.
@@ -101,7 +101,7 @@
102102 public function getUser() {
103103 return $this->context->getUser();
104104 }
105 -
 105+
106106 /**
107107 * Get the WebRequest being used for this instance.
108108 * IndexPager extends ContextSource as of 1.19.
@@ -113,7 +113,7 @@
114114 public function getRequest() {
115115 return $this->context->getRequest();
116116 }
117 -
 117+
118118 /**
119119 * Get the Title being used for this instance.
120120 * IndexPager extends ContextSource as of 1.19.
@@ -125,7 +125,7 @@
126126 public function getTitle() {
127127 return $this->context->getTitle();
128128 }
129 -
 129+
130130 /**
131131 * (non-PHPdoc)
132132 * @see TablePager::formatRow()
@@ -133,7 +133,7 @@
134134 function formatRow( $row ) {
135135 $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
136136 $this->currentObject = $c::newFromDBResult( $row );
137 -
 137+
138138 $cells = array();
139139
140140 foreach ( $this->getFieldNames() as $field => $name ) {
@@ -157,13 +157,13 @@
158158 $prefixedField = $c::getPrefixedField( $field );
159159 $value = isset( $row->$prefixedField ) ? $row->$prefixedField : null;
160160 }
161 -
 161+
162162 $formatted = strval( $this->formatValue( $field, $value ) );
163 -
 163+
164164 if ( $formatted == '' ) {
165165 $formatted = '&#160;';
166166 }
167 -
 167+
168168 $cells[] = Html::rawElement( 'td', $this->getCellAttrs( $field, $value ), $formatted );
169169 }
170170
@@ -172,9 +172,9 @@
173173
174174 /**
175175 * Returns the relevant field names.
176 - *
 176+ *
177177 * @since 0.1
178 - *
 178+ *
179179 * @return array
180180 */
181181 public function getFieldNames() {
@@ -196,20 +196,20 @@
197197
198198 return $fields;
199199 }
200 -
 200+
201201 /**
202202 * Returns HTML for the multiple item control.
203203 * With actions coming from @see getMultipleItemActions.
204 - *
 204+ *
205205 * @since 0.1
206 - *
 206+ *
207207 * @return string
208208 */
209209 public function getMultipleItemControl() {
210210 if ( !$this->hasMultipleItemControl() ) {
211211 return '';
212212 }
213 -
 213+
214214 $controls = array();
215215
216216 foreach ( $this->getMultipleItemActions() as $label => $attribs ) {
@@ -235,13 +235,13 @@
236236 implode( '', $controls ) .
237237 '</fieldset>';
238238 }
239 -
 239+
240240 /**
241241 * Return the multiple item actions the current user can do.
242242 * Override in deriving classes to add actions.
243 - *
 243+ *
244244 * @since 0.1
245 - *
 245+ *
246246 * @return array
247247 */
248248 protected function getMultipleItemActions() {
@@ -278,54 +278,54 @@
279279 protected function hasActionsColumn() {
280280 return true;
281281 }
282 -
 282+
283283 /**
284284 * Returns the fields to display.
285285 * Similar to @see getFieldNames, but fields should not be prefixed, and
286286 * non-relevant fields will be removed.
287 - *
 287+ *
288288 * @since 0.1
289 - *
 289+ *
290290 * @return array
291291 */
292292 protected abstract function getFields();
293 -
 293+
294294 /**
295295 * (non-PHPdoc)
296296 * @see IndexPager::getQueryInfo()
297297 */
298298 function getQueryInfo() {
299 - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
 299+ $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
300300 return array(
301301 'tables' => array( $c::getDBTable() ),
302302 'fields' => $c::getPrefixedFields( $c::getFieldNames() ),
303303 'conds' => $c::getPrefixedValues( $this->getConditions() ),
304304 );
305305 }
306 -
 306+
307307 /**
308308 * Get the conditions to use in the query.
309309 * This is done by merging the filter controls conditions with those provided to the constructor.
310 - *
 310+ *
311311 * @since 0.1
312 - *
 312+ *
313313 * @return array
314314 */
315315 protected function getConditions() {
316316 $conds = array();
317 -
 317+
318318 $filterOptions = $this->getFilterOptions();
319319 $this->addFilterValues( $filterOptions, false );
320 -
 320+
321321 foreach ( $filterOptions as $optionName => $optionData ) {
322322 if ( array_key_exists( 'value', $optionData ) && $optionData['value'] !== '' ) {
323323 $conds[$optionName] = $optionData['value'];
324324 }
325325 }
326 -
 326+
327327 return array_merge( $conds, $this->conds );
328328 }
329 -
 329+
330330 /**
331331 * (non-PHPdoc)
332332 * @see TablePager::isFieldSortable()
@@ -342,63 +342,63 @@
343343 $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
344344 return $c::getPrefixedField( 'id' );
345345 }
346 -
 346+
347347 /**
348348 * Should return an array with the names of the fields that are sortable.
349 - *
 349+ *
350350 * @since 0.1
351 - *
 351+ *
352352 * @return array of string
353353 */
354354 protected abstract function getSortableFields();
355 -
 355+
356356 /**
357357 * Returns a list with the filter options.
358 - *
 358+ *
359359 * @since 0.1
360 - *
361 - * @return array
 360+ *
 361+ * @return array
362362 */
363363 protected function getFilterOptions() {
364364 return array();
365365 }
366 -
 366+
367367 /**
368368 * Gets the HTML for a filter control.
369 - *
 369+ *
370370 * @since 0.1
371 - *
372 - * @param boolean $hideWhenNoResults When true, there are no results, and no filters are applied, an empty string is returned.
373 - *
 371+ *
 372+ * @param boolean $hideWhenNoResults When true, there are no results, and no filters are applied, an empty string is returned.
 373+ *
374374 * @return string
375375 */
376376 public function getFilterControl( $hideWhenNoResults = true ) {
377377 $filterOptions = $this->getFilterOptions();
378 -
 378+
379379 foreach ( $this->conds as $name => $value ) {
380380 if ( array_key_exists( $name, $filterOptions ) ) {
381381 unset( $filterOptions[$name] );
382382 }
383383 }
384 -
 384+
385385 if ( count( $filterOptions ) < 1 ) {
386386 return '';
387387 }
388 -
 388+
389389 $this->addFilterValues( $filterOptions );
390 -
 390+
391391 if ( $hideWhenNoResults && $this->getNumRows() < 1 ) {
392392 $noFiltersSet = array_reduce( $filterOptions, function( $current, array $data ) {
393393 return $current && ( $data['value'] === '' || is_null( $data['value'] ) );
394 - }, true );
395 -
 394+ } , true );
 395+
396396 if ( $noFiltersSet ) {
397397 return '';
398398 }
399399 }
400 -
 400+
401401 $controls = array();
402 -
 402+
403403 foreach ( $filterOptions as $optionName => $optionData ) {
404404 switch ( $optionData['type'] ) {
405405 case 'select':
@@ -407,14 +407,14 @@
408408 $control = $select->getHTML();
409409 break;
410410 }
411 -
 411+
412412 $control = '&#160;' . $this->getMsg( 'filter-' . $optionName ) . '&#160;' . $control;
413 -
 413+
414414 $controls[] = $control;
415415 }
416 -
 416+
417417 $title = $this->getTitle()->getFullText();
418 -
 418+
419419 return
420420 '<fieldset>' .
421421 '<legend>' . wfMsgHtml( 'ep-pager-showonly' ) . '</legend>' .
@@ -426,16 +426,16 @@
427427 '</form>' .
428428 '</fieldset>';
429429 }
430 -
 430+
431431 /**
432432 * Changes the provided filter options list by replacing the values by what's set
433 - * in the request, or as fallback, what's set in the session.
434 - *
 433+ * in the request, or as fallback, what's set in the session.
 434+ *
435435 * @since 0.1
436 - *
 436+ *
437437 * @param array $filterOptions
438438 * @param boolean $cast Should values with non-string type be casted (ie to have a select with int values have the correct val selected).
439 - *
 439+ *
440440 * @return boolean If anything was changed from the default
441441 */
442442 protected function addFilterValues( array &$filterOptions, $cast = true ) {
@@ -447,7 +447,7 @@
448448 $optionData['value'] = $req->getVal( $optionName );
449449 $req->setSessionData( get_called_class() . $optionName, $optionData['value'] );
450450 $changed = true;
451 -
 451+
452452 if ( $cast && array_key_exists( 'datatype', $optionData ) ) {
453453 switch ( $optionData['datatype'] ) {
454454 case 'int':
@@ -464,24 +464,24 @@
465465 $changed = true;
466466 }
467467 }
468 -
 468+
469469 return $changed;
470470 }
471 -
 471+
472472 /**
473473 * Takes a message key and prefixes it with the extension name and name of the pager,
474474 * feeds it to wfMsg, and returns it.
475 - *
 475+ *
476476 * @since 0.1
477 - *
 477+ *
478478 * @param string $messageKey
479 - *
 479+ *
480480 * @return string
481481 */
482482 protected function getMsg( $messageKey ) {
483483 return wfMsg( strtolower( $this->className ) . 'pager-' . str_replace( '_', '-', $messageKey ) );
484484 }
485 -
 485+
486486 /**
487487 * (non-PHPdoc)
488488 * @see TablePager::formatValue()
@@ -489,41 +489,41 @@
490490 public final function formatValue( $name, $value ) {
491491 return $this->getFormattedValue( $name, $value );
492492 }
493 -
 493+
494494 /**
495495 * Similar to TablePager::formatValue, but passes along the name of the field without prefix.
496496 * Returned values need to be escaped!
497497 *
498498 * @since 0.1
499 - *
 499+ *
500500 * @param string $name
501501 * @param string $value
502 - *
 502+ *
503503 * @return string
504504 */
505505 protected abstract function getFormattedValue( $name, $value );
506 -
 506+
507507 /**
508508 * Returns a list of (escaped, html) links to add in an additional column.
509 - *
 509+ *
510510 * @since 0.1
511 - *
 511+ *
512512 * @param EPDBObject $item
513 - *
 513+ *
514514 * @return array
515515 */
516516 protected function getControlLinks( EPDBObject $item ) {
517517 return array();
518518 }
519 -
 519+
520520 /**
521521 * Returns a deletion link.
522 - *
 522+ *
523523 * @since 0.1
524 - *
 524+ *
525525 * @param string $type
526526 * @param integer $id
527 - *
 527+ *
528528 * @return string
529529 */
530530 protected function getDeletionLink( $type, $id ) {
@@ -542,7 +542,7 @@
543543 /**
544544 * (non-PHPdoc)
545545 * @see TablePager::getStartBody()
546 - *
 546+ *
547547 * Mostly just a copy of parent class function.
548548 * Allows for having a checlbox in the selection column header.
549549 * Would obviously be better if parent class supported doing this nicer.
@@ -551,10 +551,10 @@
552552 global $wgStylePath;
553553 $tableClass = htmlspecialchars( $this->getTableClass() );
554554 $sortClass = htmlspecialchars( $this->getSortHeaderClass() );
555 -
 555+
556556 $s = "<table style='border:1;' class=\"mw-datatable $tableClass\"><thead><tr>\n";
557557 $fields = $this->getFieldNames();
558 -
 558+
559559 # Make table header
560560 foreach ( $fields as $field => $name ) {
561561 $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php
@@ -35,7 +35,7 @@
3636 'active',
3737 );
3838 }
39 -
 39+
4040 /**
4141 * (non-PHPdoc)
4242 * @see TablePager::getRowClass()
@@ -43,12 +43,12 @@
4444 function getRowClass( $row ) {
4545 return 'ep-course-row';
4646 }
47 -
 47+
4848 /**
4949 * (non-PHPdoc)
5050 * @see TablePager::getTableClass()
5151 */
52 - public function getTableClass(){
 52+ public function getTableClass() {
5353 return 'TablePager ep-courses';
5454 }
5555
@@ -66,7 +66,7 @@
6767 break;
6868 case 'org_id':
6969 $value = EPOrg::selectRow( 'name', array( 'id' => $value ) )->getField( 'name' );
70 -
 70+
7171 $value = Linker::linkKnown(
7272 SpecialPage::getTitleFor( 'Institution', $value ),
7373 htmlspecialchars( $value )
@@ -99,7 +99,7 @@
100100 'active',
101101 );
102102 }
103 -
 103+
104104 /**
105105 * (non-PHPdoc)
106106 * @see EPPager::getFilterOptions()
@@ -126,29 +126,29 @@
127127 ),
128128 );
129129 }
130 -
 130+
131131 /**
132132 * (non-PHPdoc)
133133 * @see EPPager::getControlLinks()
134134 */
135135 protected function getControlLinks( EPDBObject $item ) {
136136 $links = parent::getControlLinks( $item );
137 -
 137+
138138 $links[] = $value = Linker::linkKnown(
139139 SpecialPage::getTitleFor( 'Course', $item->getField( 'name' ) ),
140140 wfMsgHtml( 'view' )
141141 );
142 -
 142+
143143 if ( $this->getUser()->isAllowed( 'epadmin' ) ) {
144144 $links[] = $value = Linker::linkKnown(
145145 SpecialPage::getTitleFor( 'EditCourse', $item->getField( 'name' ) ),
146146 wfMsgHtml( 'edit' )
147147 );
148 -
 148+
149149 $links[] = $this->getDeletionLink( 'course', $item->getId() );
150150 }
151 -
 151+
152152 return $links;
153153 }
154 -
 154+
155155 }
Index: trunk/extensions/EducationProgram/includes/EPCourse.php
@@ -16,12 +16,12 @@
1717
1818 /**
1919 * Field for caching the linked org.
20 - *
 20+ *
2121 * @since 0.1
2222 * @var EPOrg|false
2323 */
2424 protected $org = false;
25 -
 25+
2626 /**
2727 * @see parent::getFieldTypes
2828 *
@@ -33,7 +33,7 @@
3434 return array(
3535 'id' => 'id',
3636 'org_id' => 'id',
37 -
 37+
3838 'name' => 'str',
3939 'description' => 'str',
4040 'lang' => 'str',
@@ -42,7 +42,7 @@
4343 'students' => 'int',
4444 );
4545 }
46 -
 46+
4747 /**
4848 * (non-PHPdoc)
4949 * @see EPDBObject::getDefaults()
@@ -99,7 +99,7 @@
100100
101101 $this->setFields( $fields );
102102 }
103 -
 103+
104104 /**
105105 * (non-PHPdoc)
106106 * @see EPDBObject::removeFromDB()
@@ -113,7 +113,7 @@
114114 }
115115
116116 $success = parent::removeFromDB();
117 -
 117+
118118 if ( $success ) {
119119 foreach ( EPTerm::select( 'id', array( 'course_id' => $id ) ) as /* EPTerm */ $term ) {
120120 $term->setUpdateSummaries( false );
@@ -162,100 +162,100 @@
163163
164164 /**
165165 * Returns the org associated with this course.
166 - *
 166+ *
167167 * @since 0.1
168 - *
 168+ *
169169 * @param string|array|null $fields
170 - *
 170+ *
171171 * @return EPOrg
172172 */
173173 public function getOrg( $fields = null ) {
174174 if ( $this->org === false ) {
175175 $this->org = EPOrg::selectRow( $fields, array( 'id' => $this->getField( 'org_id' ) ) );
176176 }
177 -
 177+
178178 return $this->org;
179179 }
180 -
 180+
181181 /**
182182 * Returns a list of courses in an array that can be fed to select inputs.
183 - *
 183+ *
184184 * @since 0.1
185 - *
 185+ *
186186 * @param array $courses
187 - *
 187+ *
188188 * @return array
189189 */
190190 public static function getCourseOptions( array /* EPCourse */ $courses ) {
191191 $options = array();
192 -
 192+
193193 foreach ( $courses as /* EPCourse */ $course ) {
194194 $options[$course->getField( 'name' )] = $course->getId();
195195 }
196 -
 196+
197197 return $options;
198198 }
199 -
 199+
200200 /**
201201 * Returns the list of orgs that the specified user can edit.
202 - *
 202+ *
203203 * @since 0.1
204 - *
 204+ *
205205 * @param User|int $user
206206 * @param array|null $fields
207 - *
 207+ *
208208 * @return array of EPCourse
209209 */
210210 public static function getEditableCourses( $user, array $fields = null ) {
211211 static $cache = array();
212 -
 212+
213213 if ( is_int( $user ) ) {
214214 $userId = $user;
215215 }
216216 else {
217217 $userId = $user->getId();
218218 }
219 -
 219+
220220 if ( !array_key_exists( $userId, $cache ) ) {
221221 if ( is_int( $user ) ) {
222222 $user = User::newFromId( $userId );
223223 }
224 -
 224+
225225 $courses = array();
226 -
 226+
227227 if ( $user->isAllowed( 'epadmin' ) ) {
228228 $courses = self::select( $fields );
229229 }
230230 elseif ( $user->isAllowed( 'epmentor' ) ) {
231231 $mentor = EPMentor::select( array( 'user_id' => $user->getId() ) );
232 -
 232+
233233 if ( $mentor !== false ) {
234234 $courses = $mentor->getCourses( $fields );
235235 }
236236 }
237 -
 237+
238238 $cache[$userId] = $courses;
239239 }
240 -
 240+
241241 return $cache[$userId];
242242 }
243 -
 243+
244244 /**
245245 * Adds a control to add a new course to the provided context.
246246 * Additional arguments can be provided to set the default values for the control fields.
247 - *
 247+ *
248248 * @since 0.1
249 - *
 249+ *
250250 * @param IContextSource $context
251251 * @param array $args
252 - *
 252+ *
253253 * @return boolean
254254 */
255255 public static function displayAddNewControl( IContextSource $context, array $args = array() ) {
256256 if ( !$context->getUser()->isAllowed( 'epmentor' ) ) {
257257 return false;
258258 }
259 -
 259+
260260 $out = $context->getOutput();
261261
262262 $out->addHTML( Html::openElement(
@@ -273,7 +273,7 @@
274274 $out->addHTML( Html::element( 'p', array(), wfMsg( 'ep-courses-namedoc' ) ) );
275275
276276 $out->addHTML( Html::element( 'label', array( 'for' => 'neworg' ), wfMsg( 'ep-courses-neworg' ) ) );
277 -
 277+
278278 $out->addHTML( '&#160;' );
279279
280280 $select = new XmlSelect(
@@ -284,9 +284,9 @@
285285
286286 $select->addOptions( EPOrg::getOrgOptions( EPOrg::getEditableOrgs( $context->getUser() ) ) );
287287 $out->addHTML( $select->getHTML() );
288 -
 288+
289289 $out->addHTML( '&#160;' );
290 -
 290+
291291 $out->addHTML( Xml::inputLabel(
292292 wfMsg( 'ep-courses-newname' ),
293293 'newname',
@@ -296,7 +296,7 @@
297297 ) );
298298
299299 $out->addHTML( '&#160;' );
300 -
 300+
301301 $out->addHTML( Html::input(
302302 'addneworg',
303303 wfMsg( 'ep-courses-add' ),
@@ -306,22 +306,22 @@
307307 $out->addHTML( Html::hidden( 'isnew', 1 ) );
308308
309309 $out->addHTML( '</fieldset></form>' );
310 -
 310+
311311 return true;
312312 }
313 -
 313+
314314 /**
315315 * Adds a control to add a new course to the provided context
316316 * or show a message if this is not possible for some reason.
317 - *
 317+ *
318318 * @since 0.1
319 - *
 319+ *
320320 * @param IContextSource $context
321321 * @param array $args
322322 */
323323 public static function displayAddNewRegion( IContextSource $context, array $args = array() ) {
324324 $orgs = EPOrg::getEditableOrgs( $context->getUser() );
325 -
 325+
326326 if ( count( $orgs ) > 0 ) {
327327 EPCourse::displayAddNewControl( $context, $args );
328328 }
@@ -332,18 +332,18 @@
333333 $context->getOutput()->addWikiMsg( 'ep-courses-addorgfirst' );
334334 }
335335 }
336 -
 336+
337337 /**
338338 * Display a pager with courses.
339 - *
 339+ *
340340 * @since 0.1
341 - *
 341+ *
342342 * @param IContextSource $context
343343 * @param array $conditions
344344 */
345345 public static function displayPager( IContextSource $context, array $conditions = array() ) {
346346 $pager = new EPCoursePager( $context, $conditions );
347 -
 347+
348348 if ( $pager->getNumRows() ) {
349349 $context->getOutput()->addHTML(
350350 $pager->getFilterControl() .
@@ -358,29 +358,29 @@
359359 $context->getOutput()->addWikiMsg( 'ep-courses-noresults' );
360360 }
361361 }
362 -
 362+
363363 /**
364364 * Returns if the provided user can manage the course or not.
365 - *
 365+ *
366366 * @since 0.1
367 - *
 367+ *
368368 * @param User $user
369 - *
 369+ *
370370 * @return boolean
371371 */
372372 public function useCanManage( User $user ) {
373373 if ( $user->isAllowed( 'epadmin' ) ) {
374374 return true;
375375 }
376 -
 376+
377377 if ( $user->isAllowed( 'epmentor' ) ) {
378378 $mentor = EPMentor::selectRow( 'id', array( 'user_id' => $user->getId() ) );
379 -
 379+
380380 if ( $mentor !== false ) {
381381 return $mentor->hasCourse( array( 'id' => $this->getId() ) );
382382 }
383383 }
384 -
 384+
385385 return false;
386386 }
387387
Index: trunk/extensions/EducationProgram/includes/EPMentorPager.php
@@ -12,7 +12,6 @@
1313 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
1414 */
1515 class EPMentorPager extends EPPager {
16 -
1716 /**
1817 * Constructor.
1918 *
@@ -36,7 +35,7 @@
3736 'user_id',
3837 );
3938 }
40 -
 39+
4140 /**
4241 * (non-PHPdoc)
4342 * @see TablePager::getRowClass()
@@ -44,12 +43,12 @@
4544 function getRowClass( $row ) {
4645 return 'ep-mentor-row';
4746 }
48 -
 47+
4948 /**
5049 * (non-PHPdoc)
5150 * @see TablePager::getTableClass()
5251 */
53 - public function getTableClass(){
 52+ public function getTableClass() {
5453 return 'TablePager ep-mentors';
5554 }
5655
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -151,17 +151,17 @@
152152
153153 # Users that can manage the education program.
154154 $wgGroupPermissions['*' ]['epadmin'] = false;
155 -//$wgGroupPermissions['user' ]['epadmin'] = false;
156 -//$wgGroupPermissions['autoconfirmed']['epadmin'] = false;
157 -//$wgGroupPermissions['bot' ]['epadmin'] = false;
 155+// $wgGroupPermissions['user' ]['epadmin'] = false;
 156+// $wgGroupPermissions['autoconfirmed']['epadmin'] = false;
 157+// $wgGroupPermissions['bot' ]['epadmin'] = false;
158158 $wgGroupPermissions['sysop' ]['epadmin'] = true;
159159 $wgGroupPermissions['epadmin' ]['epadmin'] = true;
160160
161161 # Users that can enroll as students in the education program.
162162 $wgGroupPermissions['*' ]['epstudent'] = false;
163163 $wgGroupPermissions['user' ]['epstudent'] = true;
164 -//$wgGroupPermissions['autoconfirmed']['epstudent'] = true;
165 -//$wgGroupPermissions['bot' ]['epstudent'] = false;
 164+// $wgGroupPermissions['autoconfirmed']['epstudent'] = true;
 165+// $wgGroupPermissions['bot' ]['epstudent'] = false;
166166 $wgGroupPermissions['sysop' ]['epstudent'] = true;
167167 $wgGroupPermissions['epadmin']['epstudent'] = true;
168168 $wgGroupPermissions['epstudent' ]['epstudent'] = true;
@@ -170,8 +170,8 @@
171171 # Users that act as mentors in the education program.
172172 $wgGroupPermissions['*' ]['epmentor'] = false;
173173 $wgGroupPermissions['user' ]['epmentor'] = true;
174 -//$wgGroupPermissions['autoconfirmed']['epmentor'] = true;
175 -//$wgGroupPermissions['bot' ]['epmentor'] = false;
 174+// $wgGroupPermissions['autoconfirmed']['epmentor'] = true;
 175+// $wgGroupPermissions['bot' ]['epmentor'] = false;
176176 $wgGroupPermissions['sysop' ]['epmentor'] = true;
177177 $wgGroupPermissions['epadmin']['epmentor'] = true;
178178 $wgGroupPermissions['epmentor' ]['epmentor'] = true;
@@ -237,12 +237,12 @@
238238 $countries = CountryNames::getNames( $langCode );
239239
240240 return array_merge(
241 - array( '' => '' ),
 241+ array( '' => '' ),
242242 array_combine(
243243 array_map(
244244 function( $value, $key ) {
245245 return $key . ' - ' . $value;
246 - },
 246+ } ,
247247 array_values( $countries ),
248248 array_keys( $countries )
249249 ),
Index: trunk/extensions/EducationProgram/api/ApiDeleteEducation.php
@@ -47,10 +47,10 @@
4848
4949 return $map[$className];
5050 }
51 -
 51+
5252 public function execute() {
5353 $params = $this->extractRequestParams();
54 -
 54+
5555 if ( !$this->userIsAllowed( $params['type'], $params ) || $this->getUser()->isBlocked() ) {
5656 $this->dieUsageMsg( array( 'badaccess-groups' ) );
5757 }
@@ -71,12 +71,12 @@
7272 $everythingOk
7373 );
7474 }
75 -
 75+
7676 /**
7777 * Returns if the user is allowed to delete the specified object(s).
7878 *
7979 * @since 0.1
80 - *
 80+ *
8181 * @param string $type
8282 * @param array $params
8383 *
@@ -84,22 +84,22 @@
8585 */
8686 protected function userIsAllowed( $type, array $params ) {
8787 $user = $this->getUser();
88 -
 88+
8989 if ( $type === 'student' ) {
9090 return EPStudent::selectField( 'id', array( 'user_id' => $user->getId() ) ) === $params['id'];
9191 }
92 -
 92+
9393 if ( $type === 'mentor' ) {
9494 return EPMentor::selectField( 'id', array( 'user_id' => $user->getId() ) ) === $params['id'];
9595 }
96 -
 96+
9797 if ( $user->isAllowed( 'epadmin' ) ) {
9898 return true;
9999 }
100 -
 100+
101101 if ( $user->isAllowed( 'epmentor' ) ) {
102102 $mentor = new EPMentor( null, array( 'user_id' => $user->getId() ) );
103 -
 103+
104104 if ( $mentor !== false ) {
105105 if ( $type === 'course' ) {
106106 return $mentor->hasCourse( array( 'id' => $params['id'] ) );
@@ -109,7 +109,7 @@
110110 }
111111 }
112112 }
113 -
 113+
114114 return false;
115115 }
116116
@@ -124,7 +124,7 @@
125125 public function getUser() {
126126 return method_exists( 'ApiBase', 'getUser' ) ? parent::getUser() : $GLOBALS['wgUser'];
127127 }
128 -
 128+
129129 public function needsToken() {
130130 return true;
131131 }
Index: trunk/extensions/EducationProgram/resources/ep.api.js
@@ -7,9 +7,9 @@
88 */
99
1010 window.educationProgram = new( function() {
11 -
 11+
1212 this.api = new( function() {
13 -
 13+
1414 this.remove = function( data, callback ) {
1515 var requestArgs = {
1616 'action': 'deleteeducation',
@@ -18,21 +18,21 @@
1919 'ids': data.ids.join( '|' ),
2020 'type': data.type
2121 };
22 -
 22+
2323 $.post(
2424 wgScriptPath + '/api.php',
2525 requestArgs,
2626 function( data ) {
2727 var success = data.hasOwnProperty( 'success' ) && data.success;
28 -
 28+
2929 callback( {
3030 'success': success
3131 } );
32 - }
33 - );
 32+ }
 33+ );
3434 };
35 -
 35+
3636 } );
37 -
 37+
3838 } );
3939
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php
@@ -120,5 +120,5 @@
121121
122122 return true;
123123 }
124 -
 124+
125125 }
Index: trunk/extensions/EducationProgram/README
@@ -1,5 +1,5 @@
22 These is the readme file for the Education Program extension.
3 -
 3+
44 Extension page on mediawiki.org: https://www.mediawiki.org/wiki/Extension:Education_Program
55 Latest version of the readme file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/EducationProgram/README?view=co
66
Index: trunk/extensions/ShortUrl/populateShortUrlTable.php
@@ -29,7 +29,7 @@
3030
3131 $last_processed_id = 0;
3232
33 - while( true ) {
 33+ while ( true ) {
3434 $insertBuffer = array();
3535 $res = $dbr->select(
3636 'page',
@@ -38,11 +38,11 @@
3939 __METHOD__,
4040 array( 'LIMIT' => 100, 'ORDER BY' => 'page_id' )
4141 );
42 - if( $res->numRows() == 0 ) {
 42+ if ( $res->numRows() == 0 ) {
4343 break;
4444 }
4545
46 - foreach( $res as $row ) {
 46+ foreach ( $res as $row ) {
4747 $rowCount++;
4848
4949 $rowData = array(
Index: trunk/extensions/ShortUrl/README
@@ -8,7 +8,7 @@
99
1010 == Installing ==
1111
12 -Copy the ShortUrl directory into the extensions folder of your
 12+Copy the ShortUrl directory into the extensions folder of your
1313 MediaWiki installation. Then add the following lines to your
1414 LocalSettings.php file (near the end):
1515
@@ -16,6 +16,6 @@
1717
1818 == Configuration ==
1919
20 -$wgShortUrlPrefix specifies the prefix to use before the shorturl.
 20+$wgShortUrlPrefix specifies the prefix to use before the shorturl.
2121 Defaults to using the longer form (with Special:ShortUrl). Can be
2222 condensed down to use anything else, via mod_rewrite rules
Index: trunk/extensions/MobileFrontend/FooterTemplate.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
88 class FooterTemplate extends MobileFrontendTemplate {
9 -
 9+
1010 public function getHTML() {
1111
1212 $regularSite = $this->data['messages']['mobile-frontend-regular-site'];
Index: trunk/extensions/MobileFrontend/LeaveFeedbackTemplate.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
88 class LeaveFeedbackTemplate extends MobileFrontendTemplate {
9 -
 9+
1010 public function getHTML() {
1111
1212 $leaveFeedbackHtml = <<<HTML
Index: trunk/extensions/MobileFrontend/ApplicationTemplate.php
@@ -1,6 +1,6 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
@@ -13,7 +13,7 @@
1414 } else {
1515 $appleTouchIconTag = '';
1616 }
17 -
 17+
1818 $zeroRatedBanner = ( isset( $this->data['zeroRatedBanner'] ) ) ? str_replace( 'style="display:none;"', '', $this->data['zeroRatedBanner'] ) : '';
1919
2020 $betaPrefix = ( $this->data['isBetaGroupMember'] ) ? 'beta_' : '';
Index: trunk/extensions/MobileFrontend/DisableTemplate.php
@@ -1,6 +1,6 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
Index: trunk/extensions/MobileFrontend/SearchTemplate.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
88 class SearchTemplate extends MobileFrontendTemplate {
9 -
 9+
1010 public function getHTML() {
1111
1212 $searchField = htmlspecialchars( $this->data['searchField'] );
Index: trunk/extensions/MobileFrontend/MobileFrontendTemplate.php
@@ -1,6 +1,6 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
@@ -29,7 +29,7 @@
3030 * @param $value
3131 */
3232 public function setByArray( $options ) {
33 - foreach ($options as $name => $value ) {
 33+ foreach ( $options as $name => $value ) {
3434 $this->set( $name, $value );
3535 }
3636 }
Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -378,7 +378,7 @@
379379 'lang' => $wgLanguageCode,
380380 );
381381
382 - foreach( $wgOut->getLanguageLinks() as $l ) {
 382+ foreach ( $wgOut->getLanguageLinks() as $l ) {
383383 $tmp = explode( ':', $l, 2 );
384384 $class = 'interwiki-' . $tmp[0];
385385 $lang = $tmp[0];
@@ -424,7 +424,7 @@
425425 wfProfileOut( __METHOD__ );
426426 return true;
427427 }
428 -
 428+
429429 /**
430430 * @param $parsedUrl wfParseUrl Array
431431 * @return string
@@ -471,7 +471,7 @@
472472
473473 $redirect = $this->parsePageRedirect( $parsedUrl );
474474 }
475 - } else if ($out->getTitle()->isSpecial( 'Randompage' ) ) {
 475+ } else if ( $out->getTitle()->isSpecial( 'Randompage' ) ) {
476476 $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : '';
477477 if ( $xDevice ) {
478478 $parsedUrl = wfParseUrl( $redirect );
@@ -740,7 +740,7 @@
741741 if ( !empty( $_SERVER['HTTP_APPLICATION_VERSION'] ) &&
742742 strpos( $_SERVER['HTTP_APPLICATION_VERSION'], 'Wikipedia Mobile' ) !== false ) {
743743 self::$hideSearchBox = true;
744 - if (strpos( $_SERVER['HTTP_APPLICATION_VERSION'], 'Android' ) !== false ) {
 744+ if ( strpos( $_SERVER['HTTP_APPLICATION_VERSION'], 'Android' ) !== false ) {
745745 self::$hideLogo = true;
746746 }
747747 }
@@ -1238,7 +1238,7 @@
12391239
12401240 $content = $this->mainPage->createElement( 'div' );
12411241 $content->setAttribute( 'id', 'content' );
1242 -
 1242+
12431243 if ( $zeroLandingPage ) {
12441244 $content->appendChild( $zeroLandingPage );
12451245 }
@@ -1301,7 +1301,7 @@
13021302 'id' => 'wpName1',
13031303 'tabindex' => '1',
13041304 'size' => '20',
1305 - 'required') ) .
 1305+ 'required' ) ) .
13061306 Html::closeElement( 'td' ) .
13071307 Html::closeElement( 'tr' ) .
13081308 Html::openElement( 'tr' ) .
@@ -1318,7 +1318,7 @@
13191319 array( 'class' => 'loginPassword',
13201320 'id' => 'wpPassword1',
13211321 'tabindex' => '2',
1322 - 'size' => '20') ) .
 1322+ 'size' => '20' ) ) .
13231323 Html::closeElement( 'td' ) .
13241324 Html::closeElement( 'tr' ) .
13251325 Html::openElement( 'tr' ) .
@@ -1329,7 +1329,7 @@
13301330 array( 'class' => 'mw-submit' ) ) .
13311331 Html::input( 'wpLoginAttempt', self::$messages['mobile-frontend-login'], 'submit',
13321332 array( 'id' => 'wpLoginAttempt',
1333 - 'tabindex' => '3') ) .
 1333+ 'tabindex' => '3' ) ) .
13341334 Html::closeElement( 'td' ) .
13351335 Html::closeElement( 'tr' ) .
13361336 Html::closeElement( 'tbody' ) .
@@ -1354,7 +1354,7 @@
13551355 $dom->preserveWhiteSpace = false;
13561356 $dom->strictErrorChecking = false;
13571357 $dom->encoding = 'UTF-8';
1358 - $node = $dom->getElementsByTagName( $tagName )->item(0);
 1358+ $node = $dom->getElementsByTagName( $tagName )->item( 0 );
13591359 wfProfileOut( __METHOD__ );
13601360 return $node;
13611361 }
@@ -1378,7 +1378,7 @@
13791379 $itemToRemoveRecords = $this->parseItemsToRemove();
13801380
13811381 $zeroRatedBannerElement = $this->doc->getElementById( 'zero-rated-banner' );
1382 -
 1382+
13831383 if ( !$zeroRatedBannerElement ) {
13841384 $zeroRatedBannerElement = $this->doc->getElementById( 'zero-rated-banner-red' );
13851385 }
@@ -1395,7 +1395,7 @@
13961396 self::$logoutHtml = $this->doc->saveXML( $ptLogoutLink, LIBXML_NOEMPTYTAG );
13971397 }
13981398 $ptAnonLogin = $this->doc->getElementById( 'pt-anonlogin' );
1399 -
 1399+
14001400 if ( !$ptAnonLogin ) {
14011401 $ptAnonLogin = $this->doc->getElementById( 'pt-login' );
14021402 }
@@ -1448,7 +1448,7 @@
14491449 $itemToRemoveRecords['CLASS'][] = "thumbcaption";
14501450 $itemToRemoveRecords['CLASS'][] = "gallery";
14511451 }
1452 -
 1452+
14531453 $tagToRemoveNodeIdAttributeValues = array( 'zero-language-search' );
14541454
14551455 $domElemsToRemove = array();
@@ -1554,7 +1554,7 @@
15551555 $contentHtml = preg_replace( '#</?' . $element . '[^>]*>#is', '', $contentHtml );
15561556 }
15571557
1558 - //Wml for searching
 1558+ // Wml for searching
15591559 $searchWml = '<p><input emptyok="true" format="*M" type="text" name="search" value="" size="16" />' .
15601560 '<do type="accept" label="' . self::$messages['mobile-frontend-search-submit'] . '">' .
15611561 '<go href="' . $wgScript . '?title=Special%3ASearch&amp;search=$(search)"></go></do></p>';
@@ -1695,7 +1695,7 @@
16961696 $output = Html::openElement( 'select',
16971697 array( 'id' => 'languageselection',
16981698 'onchange' => 'javascript:navigateToLanguageSelection();' ) );
1699 - foreach (self::$languageUrls as $languageUrl) {
 1699+ foreach ( self::$languageUrls as $languageUrl ) {
17001700 if ( $languageUrl['lang'] == $wgLanguageCode ) {
17011701 $output .= Html::element( 'option',
17021702 array( 'value' => $languageUrl['href'], 'selected' => 'selected' ),
Index: trunk/extensions/MobileFrontend/tests/DeviceDetectionTest.php
@@ -4,7 +4,7 @@
55 * @group MobileFrontend
66 */
77 class DeviceDetectionTest extends MediaWikiTestCase {
8 -
 8+
99 /**
1010 * @dataProvider provideTestFormatName
1111 */
Index: trunk/extensions/MobileFrontend/ApplicationWmlTemplate.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
88 class ApplicationWmlTemplate extends MobileFrontendTemplate {
9 -
 9+
1010 public function getHTML() {
1111 $mainPageUrl = $this->data['mainPageUrl'];
1212 $randomPageUrl = $this->data['randomPageUrl'];
@@ -14,7 +14,7 @@
1515
1616 $applicationHtml = <<<HTML
1717 <?xml version='1.0' encoding='utf-8' ?>
18 - <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
 18+ <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
1919 "http://www.wapforum.org/DTD/wml13.dtd">
2020 <wml xml:lang="{$code}" dir="{$dir}">
2121 <template>
Index: trunk/extensions/MobileFrontend/OptInTemplate.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
88 class OptInTemplate extends MobileFrontendTemplate {
9 -
 9+
1010 public function getHTML() {
1111
1212 $optInHtml = <<<HTML
Index: trunk/extensions/MobileFrontend/OptOutTemplate.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
88 class OptOutTemplate extends MobileFrontendTemplate {
9 -
 9+
1010 public function getHTML() {
1111 $optOutHtml = <<<HTML
1212 <h1>
Index: trunk/extensions/MobileFrontend/ThanksNoticeTemplate.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 die( -1 );
66 }
77
88 class ThanksNoticeTemplate extends MobileFrontendTemplate {
9 -
 9+
1010 public function getHTML() {
1111
1212 $thanks = $this->data['messages']['mobile-frontend-leave-feedback-thanks'];
Index: trunk/extensions/SwiftMedia/SwiftMedia.i18n.php
@@ -2,7 +2,7 @@
33 $messages = array();
44
55 $messages['en'] = array(
6 - 'swiftmedia' => 'Openstack\'s Swift is a very large scale reliable object store. It will serve multiple petabytes of media files.
 6+ 'swiftmedia' => 'Openstack\'s Swift is a very large scale reliable object store. It will serve multiple petabytes of media files.
77 [[Extension:SwiftMedia]] allows MediaWiki uploads to be stored in Swift.',
88 );
99
Index: trunk/extensions/SwiftMedia/TODO
@@ -57,7 +57,7 @@
5858 neilk_: in the old design, in essence, all this does is move a file into an NFS directory, and creates the matching database entry which creates a wiki page.
5959 neilk_: so far I don't think this should be news?
6060 nelson____: right
61 -neilk_: So that's includes/specials/SpecialUpload.php
 61+neilk_: So that's includes/specials/SpecialUpload.php
6262 neilk_: then there's includes/api/ApiUpload.php
6363 neilk_: which is similar but not quite the same
6464
@@ -72,7 +72,7 @@
7373 nelson____: yes.
7474 neilk_: ok so that's the overview of the upload methods & stashing, what else
7575 nelson____: I think that part of the problem is that various parts of the system feel free to make the jump from "stored" to "accessible as full path".
76 -neilk_: yes
 76+neilk_: yes
7777 neilk_: it drove me nuts too
7878 neilk_: and the code intentionally conflates a number of cases, because MediaWiki at heart just wants to throw a number of files into a directory, not manage millions of them
7979 nelson____: I gotta figure out how to mark the difference, so that something is either 1) a locally stored file, or 2) a blind token from the repo.
@@ -91,7 +91,7 @@
9292 nelson____: maybe ... what I should do is throw an exception if SwiftRepo::resolveVirtualUrl ever gets called without a mwrepo url, and then just go test everything.
9393 nelson____: I think maybe I'm trying to overanalyze the code.
9494 neilk_: I sympathize
95 -nelson____: I should trust the code more.
 95+nelson____: I should trust the code more.
9696 neilk_: hm, I think not
9797 nelson____: Trust but verify.
9898 neilk_: also, this is sad but stashing is done in two slightly different ways, too.
Index: trunk/extensions/SwiftMedia/php-fakecloudfiles/fake_cloudfiles.php
@@ -15,12 +15,12 @@
1616 die( "Nothing to see here.\n" );
1717 }
1818 require_once( dirname( __FILE__ ) . "/../php-cloudfiles/cloudfiles_exceptions.php" );
19 -define("DEFAULT_CF_API_VERSION", 1);
20 -define("MAX_CONTAINER_NAME_LEN", 256);
21 -define("MAX_OBJECT_NAME_LEN", 1024);
22 -define("MAX_OBJECT_SIZE", 5*1024*1024*1024+1);
23 -define("US_AUTHURL", "https://auth.api.rackspacecloud.com");
24 -define("UK_AUTHURL", "https://lon.auth.api.rackspacecloud.com");
 19+define( "DEFAULT_CF_API_VERSION", 1 );
 20+define( "MAX_CONTAINER_NAME_LEN", 256 );
 21+define( "MAX_OBJECT_NAME_LEN", 1024 );
 22+define( "MAX_OBJECT_SIZE", 5 * 1024 * 1024 * 1024 + 1 );
 23+define( "US_AUTHURL", "https://auth.api.rackspacecloud.com" );
 24+define( "UK_AUTHURL", "https://lon.auth.api.rackspacecloud.com" );
2525 /**
2626 * Class for handling Cloud Files Authentication, call it's {@link authenticate()}
2727 * method to obtain authorized service urls and an authentication token.
@@ -76,7 +76,7 @@
7777 * @param string $account <i>Account name</i>
7878 * @param string $auth_host <i>Authentication service URI</i>
7979 */
80 - function __construct($username=NULL, $api_key=NULL, $account=NULL, $auth_host=US_AUTHURL)
 80+ function __construct( $username = NULL, $api_key = NULL, $account = NULL, $auth_host = US_AUTHURL )
8181 {
8282
8383 $this->dbug = False;
@@ -88,7 +88,7 @@
8989 $this->storage_url = NULL;
9090 $this->cdnm_url = NULL;
9191 $this->auth_token = NULL;
92 -
 92+
9393 $this->cfs_http = NULL;
9494 }
9595
@@ -115,7 +115,7 @@
116116 * @throws AuthenticationException invalid credentials
117117 * @throws InvalidResponseException invalid response
118118 */
119 - function authenticate($version=DEFAULT_CF_API_VERSION)
 119+ function authenticate( $version = DEFAULT_CF_API_VERSION )
120120 {
121121 $this->storage_url = 'http://localhost/swift/storage/someuserurl';
122122 $this->cdnm_url = 'http://localhost/swift/curl/someuserurl';
@@ -132,14 +132,14 @@
133133 * #Pass Cached URL's and Token as Args
134134 * $auth->load_cached_credentials("auth_token", "storage_url", "cdn_management_url");
135135 * </code>
136 - *
 136+ *
137137 * @param string $auth_token A Cloud Files Auth Token (Required)
138138 * @param string $storage_url The Cloud Files Storage URL (Required)
139139 * @param string $cdnm_url CDN Management URL (Required)
140 - * @return boolean <kbd>True</kbd> if successful
 140+ * @return boolean <kbd>True</kbd> if successful
141141 * @throws SyntaxException If any of the Required Arguments are missing
142142 */
143 - function load_cached_credentials($auth_token, $storage_url, $cdnm_url)
 143+ function load_cached_credentials( $auth_token, $storage_url, $cdnm_url )
144144 {
145145 $this->storage_url = $storage_url;
146146 $this->cdnm_url = $cdnm_url;
@@ -156,7 +156,7 @@
157157 * $auth->authenticate();
158158 * $array = $auth->export_credentials();
159159 * </code>
160 - *
 160+ *
161161 * @return array of url's and an auth token.
162162 */
163163 function export_credentials()
@@ -180,7 +180,7 @@
181181 */
182182 function authenticated()
183183 {
184 - if (!($this->storage_url || $this->cdnm_url) || !$this->auth_token) {
 184+ if ( !( $this->storage_url || $this->cdnm_url ) || !$this->auth_token ) {
185185 return False;
186186 }
187187 return True;
@@ -189,7 +189,7 @@
190190 /**
191191 * Toggle debugging - set cURL verbose flag
192192 */
193 - function setDebug($bool)
 193+ function setDebug( $bool )
194194 {
195195 $this->dbug = $bool;
196196 }
@@ -264,15 +264,15 @@
265265 * @param boolean $servicenet enable/disable access via Rackspace servicenet.
266266 * @throws AuthenticationException not authenticated
267267 */
268 - function __construct($cfs_auth, $servicenet=False)
 268+ function __construct( $cfs_auth, $servicenet = False )
269269 {
270 - if (isset($_ENV['RACKSPACE_SERVICENET']))
271 - $servicenet=True;
 270+ if ( isset( $_ENV['RACKSPACE_SERVICENET'] ) )
 271+ $servicenet = True;
272272 $this->cfs_auth = $cfs_auth;
273 - if (!$this->cfs_auth->authenticated()) {
 273+ if ( !$this->cfs_auth->authenticated() ) {
274274 $e = "Need to pass in a previously authenticated ";
275275 $e .= "CF_Authentication instance.";
276 - throw new AuthenticationException($e);
 276+ throw new AuthenticationException( $e );
277277 }
278278 $this->dbug = False;
279279 }
@@ -282,7 +282,7 @@
283283 *
284284 * @param boolean $bool enable/disable cURL debugging
285285 */
286 - function setDebug($bool)
 286+ function setDebug( $bool )
287287 {
288288 $this->dbug = (boolean) $bool;
289289 }
@@ -292,13 +292,13 @@
293293 *
294294 * Example:
295295 * <code>
296 - *
 296+ *
297297 * $conn->close();
298 - *
 298+ *
299299 * </code>
300300 *
301301 * Will close all current cUrl active connections.
302 - *
 302+ *
303303 */
304304 public function close()
305305 {
@@ -324,30 +324,30 @@
325325 * @throws SyntaxException invalid name
326326 * @throws InvalidResponseException unexpected response
327327 */
328 - function create_container($container_name=NULL)
 328+ function create_container( $container_name = NULL )
329329 {
330 - if ($container_name != "0" and !isset($container_name))
331 - throw new SyntaxException("Container name not set.");
332 -
333 - if (!isset($container_name) or $container_name == "")
334 - throw new SyntaxException("Container name not set.");
 330+ if ( $container_name != "0" and !isset( $container_name ) )
 331+ throw new SyntaxException( "Container name not set." );
335332
336 - if (strpos($container_name, "/") !== False) {
337 - $r = "Container name '".$container_name;
 333+ if ( !isset( $container_name ) or $container_name == "" )
 334+ throw new SyntaxException( "Container name not set." );
 335+
 336+ if ( strpos( $container_name, "/" ) !== False ) {
 337+ $r = "Container name '" . $container_name;
338338 $r .= "' cannot contain a '/' character.";
339 - throw new SyntaxException($r);
 339+ throw new SyntaxException( $r );
340340 }
341 - if (strlen($container_name) > MAX_CONTAINER_NAME_LEN) {
342 - throw new SyntaxException(sprintf(
 341+ if ( strlen( $container_name ) > MAX_CONTAINER_NAME_LEN ) {
 342+ throw new SyntaxException( sprintf(
343343 "Container name exeeds %d bytes.",
344 - MAX_CONTAINER_NAME_LEN));
 344+ MAX_CONTAINER_NAME_LEN ) );
345345 }
346346
347347 if ( !is_dir( FAKE_SWIFT_CONTAINER_PATH . "/$container_name" ) ) {
348348 mkdir( FAKE_SWIFT_CONTAINER_PATH . "/$container_name" );
349349 }
350350
351 - return new CF_Container($this->cfs_auth, $this->cfs_http, $container_name);
 351+ return new CF_Container( $this->cfs_auth, $this->cfs_http, $container_name );
352352 }
353353
354354 /**
@@ -372,29 +372,29 @@
373373 * @throws NonEmptyContainerException container not empty
374374 * @throws NoSuchContainerException remote container does not exist
375375 */
376 - function delete_container($container=NULL)
 376+ function delete_container( $container = NULL )
377377 {
378378 $container_name = NULL;
379 -
380 - if (is_object($container)) {
381 - if (get_class($container) == "CF_Container") {
 379+
 380+ if ( is_object( $container ) ) {
 381+ if ( get_class( $container ) == "CF_Container" ) {
382382 $container_name = $container->name;
383383 }
384384 }
385 - if (is_string($container)) {
 385+ if ( is_string( $container ) ) {
386386 $container_name = $container;
387387 }
388388
389 - if ($container_name != "0" and !isset($container_name))
390 - throw new SyntaxException("Must specify container object or name.");
 389+ if ( $container_name != "0" and !isset( $container_name ) )
 390+ throw new SyntaxException( "Must specify container object or name." );
391391
392392 if ( !is_dir( FAKE_SWIFT_CONTAINER_PATH . "/$container_name" ) ) {
393393 throw new NoSuchContainerException(
394 - "Specified container did not exist to delete.");
 394+ "Specified container did not exist to delete." );
395395 }
396396 if ( !rmdir( FAKE_SWIFT_CONTAINER_PATH . "/$container_name" ) ) {
397397 throw new NonEmptyContainerException(
398 - "Container must be empty prior to removing it.");
 398+ "Container must be empty prior to removing it." );
399399 }
400400 return True;
401401 }
@@ -421,14 +421,14 @@
422422 * @throws NoSuchContainerException thrown if no remote Container
423423 * @throws InvalidResponseException unexpected response
424424 */
425 - function get_container($container_name=NULL)
 425+ function get_container( $container_name = NULL )
426426 {
427427 if ( !is_dir( FAKE_SWIFT_CONTAINER_PATH . "/$container_name" ) ) {
428 - throw new NoSuchContainerException("Container not found.");
 428+ throw new NoSuchContainerException( "Container not found." );
429429 }
430430 $count = $bytes = -1; // not implemented
431 - return new CF_Container($this->cfs_auth, $this->cfs_http,
432 - $container_name, $count, $bytes);
 431+ return new CF_Container( $this->cfs_auth, $this->cfs_http,
 432+ $container_name, $count, $bytes );
433433 }
434434 }
435435
@@ -473,16 +473,16 @@
474474 * @param int $bytes number of bytes stored in this Container
475475 * @throws SyntaxException invalid Container name
476476 */
477 - function __construct(&$cfs_auth, &$cfs_http, $name, $count=0,
478 - $bytes=0, $docdn=True)
 477+ function __construct( &$cfs_auth, &$cfs_http, $name, $count = 0,
 478+ $bytes = 0, $docdn = True )
479479 {
480 - if (strlen($name) > MAX_CONTAINER_NAME_LEN) {
481 - throw new SyntaxException("Container name exceeds "
482 - . "maximum allowed length.");
 480+ if ( strlen( $name ) > MAX_CONTAINER_NAME_LEN ) {
 481+ throw new SyntaxException( "Container name exceeds "
 482+ . "maximum allowed length." );
483483 }
484 - if (strpos($name, "/") !== False) {
 484+ if ( strpos( $name, "/" ) !== False ) {
485485 throw new SyntaxException(
486 - "Container names cannot contain a '/' character.");
 486+ "Container names cannot contain a '/' character." );
487487 }
488488 $this->cfs_auth = $cfs_auth;
489489 $this->cfs_http = $cfs_http;
@@ -521,9 +521,9 @@
522522 * @param string $obj_name name of storage Object
523523 * @return obj CF_Object instance
524524 */
525 - function create_object($obj_name=NULL)
 525+ function create_object( $obj_name = NULL )
526526 {
527 - return new CF_Object($this, $obj_name);
 527+ return new CF_Object( $this, $obj_name );
528528 }
529529
530530 /**
@@ -550,9 +550,9 @@
551551 * @param string $obj_name name of storage Object
552552 * @return obj CF_Object instance
553553 */
554 - function get_object($obj_name=NULL)
 554+ function get_object( $obj_name = NULL )
555555 {
556 - return new CF_Object($this, $obj_name, True);
 556+ return new CF_Object( $this, $obj_name, True );
557557 }
558558
559559 /**
@@ -573,7 +573,7 @@
574574 * # Grab subsets of all storage objects
575575 * #
576576 * $first_ten = $images->list_objects(10);
577 - *
 577+ *
578578 * # Note the use of the previous result's last object name being
579579 * # used as the 'marker' parameter to fetch the next 10 objects
580580 * #
@@ -599,7 +599,7 @@
600600 * @return array array of strings
601601 * @throws InvalidResponseException unexpected response
602602 */
603 - function list_objects($limit=0, $marker=NULL, $prefix=NULL, $path=NULL)
 603+ function list_objects( $limit = 0, $marker = NULL, $prefix = NULL, $path = NULL )
604604 {
605605 $names = array();
606606 // $prefix must be a dir in mock class
@@ -643,24 +643,24 @@
644644 * @throws NoSuchObjectException remote Object does not exist
645645 * @throws InvalidResponseException unexpected response
646646 */
647 - function delete_object($obj)
 647+ function delete_object( $obj )
648648 {
649649 $obj_name = NULL;
650 - if (is_object($obj)) {
651 - if (get_class($obj) == "CF_Object") {
 650+ if ( is_object( $obj ) ) {
 651+ if ( get_class( $obj ) == "CF_Object" ) {
652652 $obj_name = $obj->name;
653653 }
654654 }
655 - if (is_string($obj)) {
 655+ if ( is_string( $obj ) ) {
656656 $obj_name = $obj;
657657 }
658 - if (!$obj_name) {
659 - throw new SyntaxException("Object name not set.");
 658+ if ( !$obj_name ) {
 659+ throw new SyntaxException( "Object name not set." );
660660 }
661661 if ( !@unlink( $this->getObjectFSPath( $obj_name ) ) ) {
662 - $m = "Specified object '".$this->name."/".$obj_name;
663 - $m.= "' did not exist to delete.";
664 - throw new NoSuchObjectException($m);
 662+ $m = "Specified object '" . $this->name . "/" . $obj_name;
 663+ $m .= "' did not exist to delete.";
 664+ throw new NoSuchObjectException( $m );
665665 }
666666 return True;
667667 }
@@ -675,7 +675,7 @@
676676 * Object operations
677677 *
678678 * An Object is analogous to a file on a conventional filesystem. You can
679 - * read data from, or write data to your Objects. You can also associate
 679+ * read data from, or write data to your Objects. You can also associate
680680 * arbitrary metadata with them.
681681 *
682682 * @package php-cloudfiles
@@ -698,16 +698,16 @@
699699 * @param string $name name of Object
700700 * @param boolean $force_exists if set, throw an error if Object doesn't exist
701701 */
702 - function __construct(&$container, $name, $force_exists=False, $dohead=True)
 702+ function __construct( &$container, $name, $force_exists = False, $dohead = True )
703703 {
704 - if ($name[0] == "/") {
705 - $r = "Object name '".$name;
 704+ if ( $name[0] == "/" ) {
 705+ $r = "Object name '" . $name;
706706 $r .= "' cannot contain begin with a '/' character.";
707 - throw new SyntaxException($r);
 707+ throw new SyntaxException( $r );
708708 }
709 - if (strlen($name) > MAX_OBJECT_NAME_LEN) {
710 - throw new SyntaxException("Object name exceeds "
711 - . "maximum allowed length.");
 709+ if ( strlen( $name ) > MAX_OBJECT_NAME_LEN ) {
 710+ throw new SyntaxException( "Object name exceeds "
 711+ . "maximum allowed length." );
712712 }
713713 $this->container = $container;
714714 $this->name = $name;
@@ -718,9 +718,9 @@
719719 $this->content_length = 0;
720720 $this->metadata = array();
721721 $this->manifest = NULL;
722 - if ($dohead) {
723 - if (!$this->_initialize() && $force_exists) {
724 - throw new NoSuchObjectException("No such object '".$name."'");
 722+ if ( $dohead ) {
 723+ if ( !$this->_initialize() && $force_exists ) {
 724+ throw new NoSuchObjectException( "No such object '" . $name . "'" );
725725 }
726726 }
727727 }
@@ -754,51 +754,51 @@
755755 *
756756 * if fileinfo is not available it will try to use the internal
757757 * mime_content_type function.
758 - *
 758+ *
759759 * @param string $handle name of file or buffer to guess the type from
760760 * @return boolean <kbd>True</kbd> if successful
761761 * @throws BadContentTypeException
762762 */
763 - function _guess_content_type($handle) {
764 - if ($this->content_type)
 763+ function _guess_content_type( $handle ) {
 764+ if ( $this->content_type )
765765 return;
766 -
767 - if (function_exists("finfo_open")) {
768 - $local_magic = dirname(__FILE__) . "/share/magic";
769 - $finfo = @finfo_open(FILEINFO_MIME, $local_magic);
770766
771 - if (!$finfo)
772 - $finfo = @finfo_open(FILEINFO_MIME);
773 -
774 - if ($finfo) {
 767+ if ( function_exists( "finfo_open" ) ) {
 768+ $local_magic = dirname( __FILE__ ) . "/share/magic";
 769+ $finfo = @finfo_open( FILEINFO_MIME, $local_magic );
775770
776 - if (is_file((string)$handle))
777 - $ct = @finfo_file($finfo, $handle);
778 - else
779 - $ct = @finfo_buffer($finfo, $handle);
 771+ if ( !$finfo )
 772+ $finfo = @finfo_open( FILEINFO_MIME );
780773
 774+ if ( $finfo ) {
 775+
 776+ if ( is_file( (string)$handle ) )
 777+ $ct = @finfo_file( $finfo, $handle );
 778+ else
 779+ $ct = @finfo_buffer( $finfo, $handle );
 780+
781781 /* PHP 5.3 fileinfo display extra information like
782782 charset so we remove everything after the ; since
783783 we are not into that stuff */
784 - if ($ct) {
785 - $extra_content_type_info = strpos($ct, "; ");
786 - if ($extra_content_type_info)
787 - $ct = substr($ct, 0, $extra_content_type_info);
 784+ if ( $ct ) {
 785+ $extra_content_type_info = strpos( $ct, "; " );
 786+ if ( $extra_content_type_info )
 787+ $ct = substr( $ct, 0, $extra_content_type_info );
788788 }
789789
790 - if ($ct && $ct != 'application/octet-stream')
 790+ if ( $ct && $ct != 'application/octet-stream' )
791791 $this->content_type = $ct;
792792
793 - @finfo_close($finfo);
 793+ @finfo_close( $finfo );
794794 }
795795 }
796796
797 - if (!$this->content_type && (string)is_file($handle) && function_exists("mime_content_type")) {
798 - $this->content_type = @mime_content_type($handle);
 797+ if ( !$this->content_type && (string)is_file( $handle ) && function_exists( "mime_content_type" ) ) {
 798+ $this->content_type = @mime_content_type( $handle );
799799 }
800800
801 - if (!$this->content_type) {
802 - throw new BadContentTypeException("Required Content-Type not set");
 801+ if ( !$this->content_type ) {
 802+ throw new BadContentTypeException( "Required Content-Type not set" );
803803 }
804804 return True;
805805 }
@@ -835,7 +835,7 @@
836836 * @return string Object's data
837837 * @throws InvalidResponseException unexpected response
838838 */
839 - function read($hdrs=array())
 839+ function read( $hdrs = array() )
840840 {
841841 return file_get_contents( $this->getFSPath() );
842842 }
@@ -882,7 +882,7 @@
883883 * @return string Object's data
884884 * @throws InvalidResponseException unexpected response
885885 */
886 - function stream(&$fp, $hdrs=array())
 886+ function stream( &$fp, $hdrs = array() )
887887 {
888888 $data = file_get_contents( $this->getFSPath() );
889889 fwrite( $fp, $data );
@@ -919,46 +919,46 @@
920920 * @throws MisMatchedChecksumException $verify is set and checksums unequal
921921 * @throws InvalidResponseException unexpected response
922922 */
923 - function write($data=NULL, $bytes=0, $verify=True)
 923+ function write( $data = NULL, $bytes = 0, $verify = True )
924924 {
925 - if (!$data && !is_string($data)) {
926 - throw new SyntaxException("Missing data source.");
 925+ if ( !$data && !is_string( $data ) ) {
 926+ throw new SyntaxException( "Missing data source." );
927927 }
928 - if ($bytes > MAX_OBJECT_SIZE) {
929 - throw new SyntaxException("Bytes exceeds maximum object size.");
 928+ if ( $bytes > MAX_OBJECT_SIZE ) {
 929+ throw new SyntaxException( "Bytes exceeds maximum object size." );
930930 }
931 - if ($verify) {
932 - if (!$this->_etag_override) {
933 - $this->etag = $this->compute_md5sum($data);
 931+ if ( $verify ) {
 932+ if ( !$this->_etag_override ) {
 933+ $this->etag = $this->compute_md5sum( $data );
934934 }
935935 } else {
936936 $this->etag = NULL;
937937 }
938938
939939 $close_fh = False;
940 - if (!is_resource($data)) {
 940+ if ( !is_resource( $data ) ) {
941941 # A hack to treat string data as a file handle. php://memory feels
942942 # like a better option, but it seems to break on Windows so use
943943 # a temporary file instead.
944944 #
945 - $fp = fopen("php://temp", "wb+");
946 - #$fp = fopen("php://memory", "wb+");
947 - fwrite($fp, $data, strlen($data));
948 - rewind($fp);
 945+ $fp = fopen( "php://temp", "wb+" );
 946+ # $fp = fopen("php://memory", "wb+");
 947+ fwrite( $fp, $data, strlen( $data ) );
 948+ rewind( $fp );
949949 $close_fh = True;
950 - $this->content_length = (float) strlen($data);
951 - if ($this->content_length > MAX_OBJECT_SIZE) {
952 - throw new SyntaxException("Data exceeds maximum object size");
 950+ $this->content_length = (float) strlen( $data );
 951+ if ( $this->content_length > MAX_OBJECT_SIZE ) {
 952+ throw new SyntaxException( "Data exceeds maximum object size" );
953953 }
954 - $ct_data = substr($data, 0, 64);
 954+ $ct_data = substr( $data, 0, 64 );
955955 } else {
956956 $this->content_length = $bytes;
957957 $fp = $data;
958 - $ct_data = fread($data, 64);
959 - rewind($data);
 958+ $ct_data = fread( $data, 64 );
 959+ rewind( $data );
960960 }
961961
962 - $this->_guess_content_type($ct_data);
 962+ $this->_guess_content_type( $ct_data );
963963
964964 $dir = dirname( $this->getFSPath() );
965965 if ( !file_exists( $dir ) ) {
@@ -966,7 +966,7 @@
967967 }
968968 file_put_contents( $this->getFSPath(), $data, LOCK_EX );
969969
970 - if ($close_fh) { fclose($fp); }
 970+ if ( $close_fh ) { fclose( $fp ); }
971971 return True;
972972 }
973973
@@ -994,10 +994,10 @@
995995 * @throws MisMatchedChecksumException $verify is set and checksums unequal
996996 * @throws InvalidResponseException unexpected response
997997 */
998 - function copy($source)
 998+ function copy( $source )
999999 {
1000 - if (!$source && !is_string($source)) {
1001 - throw new SyntaxException("Missing data source.");
 1000+ if ( !$source && !is_string( $source ) ) {
 1001+ throw new SyntaxException( "Missing data source." );
10021002 }
10031003 $sObj = new self( $this->container, $source );
10041004 copy( $sObj->getFSPath(), $this->getFSPath() );
@@ -1033,24 +1033,24 @@
10341034 * @throws InvalidResponseException unexpected response
10351035 * @throws IOException error opening file
10361036 */
1037 - function load_from_filename($filename, $verify=True)
 1037+ function load_from_filename( $filename, $verify = True )
10381038 {
1039 - $fp = @fopen($filename, "r");
1040 - if (!$fp) {
1041 - throw new IOException("Could not open file for reading: ".$filename);
 1039+ $fp = @fopen( $filename, "r" );
 1040+ if ( !$fp ) {
 1041+ throw new IOException( "Could not open file for reading: " . $filename );
10421042 }
10431043
10441044 clearstatcache();
1045 -
1046 - $size = (float) sprintf("%u", filesize($filename));
1047 - if ($size > MAX_OBJECT_SIZE) {
1048 - throw new SyntaxException("File size exceeds maximum object size.");
 1045+
 1046+ $size = (float) sprintf( "%u", filesize( $filename ) );
 1047+ if ( $size > MAX_OBJECT_SIZE ) {
 1048+ throw new SyntaxException( "File size exceeds maximum object size." );
10491049 }
10501050
1051 - $this->_guess_content_type($filename);
1052 -
1053 - $this->write($fp, $size, $verify);
1054 - fclose($fp);
 1051+ $this->_guess_content_type( $filename );
 1052+
 1053+ $this->write( $fp, $size, $verify );
 1054+ fclose( $fp );
10551055 return True;
10561056 }
10571057
@@ -1078,14 +1078,14 @@
10791079 * @throws IOException error opening file
10801080 * @throws InvalidResponseException unexpected response
10811081 */
1082 - function save_to_filename($filename)
 1082+ function save_to_filename( $filename )
10831083 {
1084 - $fp = @fopen($filename, "wb");
1085 - if (!$fp) {
1086 - throw new IOException("Could not open file for writing: ".$filename);
 1084+ $fp = @fopen( $filename, "wb" );
 1085+ if ( !$fp ) {
 1086+ throw new IOException( "Could not open file for writing: " . $filename );
10871087 }
1088 - $result = $this->stream($fp);
1089 - fclose($fp);
 1088+ $result = $this->stream( $fp );
 1089+ fclose( $fp );
10901090 return $result;
10911091 }
10921092
@@ -1098,7 +1098,7 @@
10991099 *
11001100 * @param string $etag MD5 checksum hexidecimal string
11011101 */
1102 - function set_etag($etag)
 1102+ function set_etag( $etag )
11031103 {
11041104 $this->etag = $etag;
11051105 $this->_etag_override = True;
@@ -1130,20 +1130,20 @@
11311131 * @param filename|obj|string $data filename, open resource, or string
11321132 * @return string MD5 checksum hexidecimal string
11331133 */
1134 - function compute_md5sum(&$data)
 1134+ function compute_md5sum( &$data )
11351135 {
1136 - if (function_exists("hash_init") && is_resource($data)) {
1137 - $ctx = hash_init('md5');
1138 - while (!feof($data)) {
1139 - $buffer = fgets($data, 65536);
1140 - hash_update($ctx, $buffer);
 1136+ if ( function_exists( "hash_init" ) && is_resource( $data ) ) {
 1137+ $ctx = hash_init( 'md5' );
 1138+ while ( !feof( $data ) ) {
 1139+ $buffer = fgets( $data, 65536 );
 1140+ hash_update( $ctx, $buffer );
11411141 }
1142 - $md5 = hash_final($ctx, false);
1143 - rewind($data);
1144 - } elseif ((string)is_file($data)) {
1145 - $md5 = md5_file($data);
 1142+ $md5 = hash_final( $ctx, false );
 1143+ rewind( $data );
 1144+ } elseif ( (string)is_file( $data ) ) {
 1145+ $md5 = md5_file( $data );
11461146 } else {
1147 - $md5 = md5($data);
 1147+ $md5 = md5( $data );
11481148 }
11491149 return $md5;
11501150 }
Index: trunk/extensions/SwiftMedia/smtest.py
@@ -5,7 +5,7 @@
66 import twill
77 import twill.commands as t
88 import gd
9 -
 9+
1010 temp_html = "/tmp/wikipedia.html"
1111 rss_title = "Wikipedia watchlist"
1212 rss_link = "http://en.wikipedia.org"
@@ -18,7 +18,7 @@
1919 t.go(host+"index.php/Special:UserLogin")
2020 t.fv("1", "wpName", username)
2121 t.fv("1", "wpPassword", password)
22 - t.submit("wpLoginAttempt")
 22+ t.submit("wpLoginAttempt")
2323
2424
2525 def upload_list(browser, pagename, uploads):
@@ -34,7 +34,7 @@
3535 t.formfile("1", "wpUploadFile", uploads[0])
3636 t.fv("1", "wpDestFile", pagename)
3737 t.fv("1", "wpUploadDescription", "Uploading %s" % pagename)
38 - t.submit("wpUpload")
 38+ t.submit("wpUpload")
3939
4040 # Verify that we succeeded.
4141 t.find("File:%s" % pagename)
@@ -44,7 +44,7 @@
4545 t.go(host+"index.php?title=Special:Upload&wpDestFile=%s&wpForReUpload=1" % pagename)
4646 t.formfile("1", "wpUploadFile", fn)
4747 t.fv("1", "wpUploadDescription", "Uploading %s as %s" % (fn, pagename))
48 - t.submit("wpUpload")
 48+ t.submit("wpUpload")
4949
5050 # get the URLs for the thumbnails
5151 urls = []
@@ -65,7 +65,7 @@
6666 t.go(host+"index.php?title=File:%s&action=delete" % pagename)
6767 # after we get the confirmation page, commit to the action.
6868 t.fv("1", "wpReason", "Test Deleting...")
69 - t.submit("mw-filedelete-submit")
 69+ t.submit("mw-filedelete-submit")
7070
7171 # make sure that we can't visit their URLs.
7272 for i, url in enumerate(urls):
Index: trunk/extensions/SwiftMedia/test_rewrite.py
@@ -4,7 +4,7 @@
55
66 import webob
77
8 -from wmf import rewrite
 8+from wmf import rewrite
99 from wmf.client import ClientException
1010
1111 class FakeApp(object):
@@ -96,13 +96,13 @@
9797 environ={'REQUEST_METHOD': 'GET'})
9898 resp = app(req.environ, start_response)
9999 self.assertEquals(req.environ['PATH_INFO'], self.url448)
100 - self.assertEquals(resp,
 100+ self.assertEquals(resp,
101101 ['401 Unauthorized\n\nThis server could not verify that you are '\
102102 'authorized to access the document you requested. Either you '\
103103 'supplied the wrong credentials (e.g., bad password), or your '\
104104 'browser does not understand how to supply the credentials '\
105105 'required.\n\n Token may have timed out '])
106 -
 106+
107107 def test_06(self):
108108 """#06 Give them a bad token so that the PUT fails."""
109109 app = rewrite.WMFRewrite(FakeApp("404 Bad", {}),self.a)
Index: trunk/extensions/SwiftMedia/wmf/swift.php
@@ -2,10 +2,10 @@
33 /**
44 * Helper functions for Swift related image thumbnail purging.
55 * The functions here should only be called after MediaWiki setup.
6 - *
 6+ *
77 * $wmfSwiftConfig must reside in PrivateSettings.php. It should also
88 * be extracted in CommonSettings.php to set any swift backend settings.
9 - *
 9+ *
1010 * This file belongs under wmf-config/ and should be included by CommonSettings.php.
1111 */
1212
@@ -16,7 +16,7 @@
1717 * Handler for the LocalFilePurgeThumbnails hook.
1818 * To avoid excess inclusion of cloudfiles.php, a hook handler can be added
1919 * to CommonSettings.php which includes this file and calls this function.
20 - *
 20+ *
2121 * @param $file File
2222 * @param $archiveName string|false
2323 * @return true
@@ -48,7 +48,7 @@
4949
5050 /**
5151 * Get the Swift thumbnail container for this wiki.
52 - *
 52+ *
5353 * @param $site string
5454 * @param $lang string
5555 * @return CF_Container|null
Index: trunk/extensions/SwiftMedia/SwiftMedia.body.php
@@ -91,7 +91,7 @@
9292 * @return string Path to a local copy of the file.
9393 */
9494 public function getPath() {
95 - if ( !array_key_exists('', $this->tempPaths ) ) {
 95+ if ( !array_key_exists( '', $this->tempPaths ) ) {
9696 $this->tempPaths[''] = $this->repo->getLocalCopy( $this->repo->container, $this->getRel(), "getPath_" );
9797 }
9898 return $this->tempPaths[''];
@@ -99,17 +99,17 @@
100100
101101 /**
102102 * We're re-purposing getPath() to checkout a copy of the file, if we don't already have a copy.
103 - * Get a local copy of a particular archived file specified by $suffix
 103+ * Get a local copy of a particular archived file specified by $suffix
104104 *
105105 * @param string suffix Specific archived copy.
106106 * @return string Path to a local copy of the file.
107107 */
108 - public function getArchivePath( $suffix = false) {
109 - if (!$suffix) {
 108+ public function getArchivePath( $suffix = false ) {
 109+ if ( !$suffix ) {
110110 throw new MWException( "Can't call getArchivePath without a suffix" );
111111 }
112112 $rel = $this->getArchiveRel( $suffix );
113 - if ( !array_key_exists($rel, $this->tempPaths ) ) {
 113+ if ( !array_key_exists( $rel, $this->tempPaths ) ) {
114114 $this->tempPaths[$rel] = $this->repo->getLocalCopy( $this->repo->container, $rel );
115115 }
116116 return $this->tempPaths[$rel];
@@ -117,24 +117,24 @@
118118
119119 /**
120120 * We're re-purposing getPath() to checkout a copy of the file, if we don't already have a copy.
121 - * Get a local copy of a particular thumb specified by $suffix
 121+ * Get a local copy of a particular thumb specified by $suffix
122122 *
123123 * @param string suffix Specific thumbnail.
124124 * @return string Path to a local copy of the file.
125125 */
126 - public function getThumbPath( $suffix = false) {
127 - if (!$suffix) {
 126+ public function getThumbPath( $suffix = false ) {
 127+ if ( !$suffix ) {
128128 throw new MWException( "Can't call getThumbPath without a suffix" );
129129 }
130130 $rel = $this->getRel() . '/' . $suffix;
131 - if ( !array_key_exists($rel, $this->tempPaths ) ) {
 131+ if ( !array_key_exists( $rel, $this->tempPaths ) ) {
132132 $this->tempPaths[$rel] = $this->repo->getLocalCopy( $this->repo->getZoneContainer( 'thumb' ), $rel );
133133 }
134134 return $this->tempPaths[$rel];
135135 }
136136
137137 function __destruct() {
138 - foreach ( $this->tempPaths as $path) {
 138+ foreach ( $this->tempPaths as $path ) {
139139 // Clean up temporary data.
140140 wfDebug( __METHOD__ . ": deleting $path\n" );
141141 unlink( $path );
@@ -161,8 +161,8 @@
162162 $thumbPath = tempnam( $wgTmpDirectory, 'transform_out_' );
163163 unlink( $thumbPath );
164164 $thumbPath .= '.' . pathinfo( $thumbName, PATHINFO_EXTENSION );
165 -
166165
 166+
167167 if ( $this->repo && $this->repo->canTransformVia404() && !( $flags & self::RENDER_NOW ) ) {
168168 return $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
169169 }
@@ -424,7 +424,7 @@
425425 foreach ( $triplets as $i => $triplet ) {
426426 list( $srcPath, $dstZone, $dstRel ) = $triplet;
427427
428 - wfDebug( __METHOD__ . ": Storing $srcPath into $dstZone::$dstRel\n");
 428+ wfDebug( __METHOD__ . ": Storing $srcPath into $dstZone::$dstRel\n" );
429429
430430 // Point to the container.
431431 $dstContainer = $this->getZoneContainer( $dstZone );
@@ -442,7 +442,7 @@
443443 if ( !( $flags & self::OVERWRITE ) ) {
444444 // does it exist?
445445 try {
446 - $objd = $dstc->get_object($dstRel);
 446+ $objd = $dstc->get_object( $dstRel );
447447 // and if it does, are we allowed to overwrite it?
448448 if ( $flags & self::OVERWRITE_SAME ) {
449449 $objs = $srcc->get_object( $srcRel );
@@ -455,15 +455,15 @@
456456 $good = false;
457457 }
458458 $exists = true;
459 - } catch (NoSuchObjectException $e) {
 459+ } catch ( NoSuchObjectException $e ) {
460460 $exists = false;
461461 }
462462 }
463 -
 463+
464464 if ( $good ) {
465465 try {
466466 $this->swiftcopy( $srcc, $srcRel, $dstc, $dstRel );
467 - } catch (InvalidResponseException $e ) {
 467+ } catch ( InvalidResponseException $e ) {
468468 $status->error( 'filecopyerror', $srcPath, "{$dstc->name}/$dstRel" );
469469 $good = false;
470470 }
@@ -479,7 +479,7 @@
480480 $objd = $dstc->get_object( $dstRel );
481481 // and if it does, are we allowed to overwrite it?
482482 if ( $flags & self::OVERWRITE_SAME ) {
483 - if ( $objd->getETag() != md5_file($srcPath) ) {
 483+ if ( $objd->getETag() != md5_file( $srcPath ) ) {
484484 $status->fatal( 'fileexistserror', $dstRel );
485485 $good = false;
486486 }
@@ -488,15 +488,15 @@
489489 $good = false;
490490 }
491491 $exists = true;
492 - } catch (NoSuchObjectException $e) {
 492+ } catch ( NoSuchObjectException $e ) {
493493 $exists = false;
494494 }
495495 }
496496 if ( $good ) {
497 - wfDebug( __METHOD__ . ": Writing $srcPath to {$dstc->name}/$dstRel\n");
 497+ wfDebug( __METHOD__ . ": Writing $srcPath to {$dstc->name}/$dstRel\n" );
498498 try {
499499 $this->write_swift_object( $srcPath, $dstc, $dstRel );
500 - } catch (InvalidResponseException $e ) {
 500+ } catch ( InvalidResponseException $e ) {
501501 $status->error( 'filecopyerror', $srcPath, "{$dstc->name}/$dstRel" );
502502 $good = false;
503503 }
@@ -547,7 +547,7 @@
548548 function appendFinish( $toAppendPath ) {
549549 $conn = $this->connect();
550550 $container = $this->repo->get_container( $conn, $this->repo->container . '-temp' );
551 - $parts = $container->list_objects( 0, NULL, $toAppendPath);
 551+ $parts = $container->list_objects( 0, NULL, $toAppendPath );
552552 // list_objects() returns a sorted list.
553553
554554 // FIXME probably want to put this into a different container.
@@ -667,12 +667,12 @@
668668 $srcObj = $srcContainer->get_object( $srcRel );
669669 } catch ( NoSuchObjectException $e ) {
670670 throw new MWException( 'Source file does not exist: ' . $srcContainer->name . "/$srcRel: $e" );
671 - }
 671+ }
672672
673673 wfDebug( __METHOD__ . ' copying to ' . $dstContainer->name . "/$dstRel from " . $srcContainer->name . "/$srcRel\n" );
674674
675675 try {
676 - $dstContainer->copy_object_from($srcObj,$srcContainer,$dstRel);
 676+ $dstContainer->copy_object_from( $srcObj, $srcContainer, $dstRel );
677677 } catch ( SyntaxException $e ) {
678678 throw new MWException( 'Source file does not exist: ' . $srcContainer->name . "/$srcRel: $e" );
679679 } catch ( MisMatchedChecksumException $e ) {

Sign-offs

UserFlagDate
Preillyinspected23:15, 12 January 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r1088351.18wmf1: MFT r108714 - 108831preilly20:07, 13 January 2012

Status & tagging log