From 79d5225c0e864482269e2315f47b899697681e52 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 14 Apr 2008 07:45:50 +0000 Subject: [PATCH] * remove end of line whitespace * remove empty lines at end of file * remove "?>" where still present --- includes/AjaxDispatcher.php | 2 - includes/AjaxFunctions.php | 13 +- includes/AjaxResponse.php | 3 +- includes/Article.php | 84 +++--- includes/AuthPlugin.php | 2 - includes/AutoLoader.php | 12 +- includes/Autopromote.php | 2 +- includes/BagOStuff.php | 20 +- includes/Block.php | 39 ++- includes/CacheDependency.php | 32 ++- includes/CategoryPage.php | 15 +- includes/Categoryfinder.php | 2 - includes/ChangesList.php | 50 ++-- includes/CoreParserFunctions.php | 15 +- includes/Credits.php | 4 +- includes/DatabaseFunctions.php | 1 - includes/DatabaseOracle.php | 18 +- includes/DatabasePostgres.php | 50 ++-- includes/DateFormatter.php | 4 +- includes/DefaultSettings.php | 156 +++++------ includes/Defines.php | 6 +- includes/DifferenceEngine.php | 45 ++-- includes/DjVuImage.php | 53 ++-- includes/EditPage.php | 62 ++--- includes/EmaillingJob.php | 3 +- includes/EnotifNotifyJob.php | 3 +- includes/Exception.php | 14 +- includes/Exif.php | 8 +- includes/Export.php | 26 +- includes/ExternalEdit.php | 1 - includes/ExternalStore.php | 1 - includes/ExternalStoreDB.php | 1 - includes/ExternalStoreHttp.php | 1 - includes/FakeTitle.php | 2 - includes/Feed.php | 2 - includes/FileDeleteForm.php | 46 ++-- includes/FileRevertForm.php | 28 +- includes/FileStore.php | 78 +++--- includes/GlobalFunctions.php | 96 +++---- includes/HTMLCacheUpdate.php | 25 +- includes/HTMLFileCache.php | 2 - includes/HistoryBlob.php | 5 +- includes/Hooks.php | 1 - includes/HttpFunctions.php | 1 - includes/IP.php | 34 ++- includes/ImageFunctions.php | 5 +- includes/ImageGallery.php | 16 +- includes/ImagePage.php | 36 +-- includes/ImageQueryPage.php | 2 - includes/JobQueue.php | 14 +- includes/LBFactory.php | 7 +- includes/LBFactory_Multi.php | 11 +- includes/Licenses.php | 3 +- includes/LinkBatch.php | 10 +- includes/LinkCache.php | 11 +- includes/LinkFilter.php | 1 - includes/Linker.php | 60 ++--- includes/LinksUpdate.php | 53 ++-- includes/LoadBalancer.php | 34 ++- includes/LogEventsList.php | 89 ++++--- includes/LogPage.php | 8 +- includes/MacBinary.php | 2 - includes/MagicWord.php | 14 +- includes/Math.php | 3 +- includes/MediaTransformOutput.php | 30 +-- includes/MemcachedSessions.php | 2 - includes/MessageCache.php | 18 +- includes/Metadata.php | 4 +- includes/MimeMagic.php | 32 ++- includes/Namespace.php | 10 +- includes/NamespaceCompat.php | 2 +- includes/ObjectCache.php | 4 +- includes/OutputHandler.php | 9 +- includes/OutputPage.php | 70 ++--- includes/PageHistory.php | 66 ++--- includes/PageQueryPage.php | 2 - includes/Pager.php | 84 +++--- includes/Parser.php | 123 +++++---- includes/ParserCache.php | 2 - includes/ParserOptions.php | 6 +- includes/ParserOutput.php | 20 +- includes/Parser_DiffTest.php | 3 +- includes/Parser_OldPP.php | 67 +++-- includes/PatrolLog.php | 6 +- includes/PrefixSearch.php | 22 +- includes/Preprocessor.php | 17 +- includes/Preprocessor_DOM.php | 96 +++---- includes/Preprocessor_Hash.php | 87 ++++--- includes/Profiler.php | 6 +- includes/ProfilerSimple.php | 3 +- includes/ProfilerSimpleText.php | 3 +- includes/ProfilerSimpleUDP.php | 1 - includes/ProfilerStub.php | 2 - includes/ProtectionForm.php | 11 +- includes/ProxyTools.php | 14 +- includes/QueryPage.php | 38 ++- includes/RawPage.php | 19 +- includes/RecentChange.php | 6 +- includes/RefreshLinksJob.php | 1 - includes/Revision.php | 45 ++-- includes/Sanitizer.php | 28 +- includes/SearchEngine.php | 43 ++-- includes/SearchMySQL.php | 4 +- includes/SearchOracle.php | 2 - includes/SearchPostgres.php | 5 +- includes/SearchTsearch2.php | 3 - includes/SearchUpdate.php | 6 +- includes/Setup.php | 12 +- includes/SiteConfiguration.php | 4 +- includes/SiteStats.php | 19 +- includes/Skin.php | 59 +++-- includes/SkinTemplate.php | 18 +- includes/SpecialAllmessages.php | 12 +- includes/SpecialAllpages.php | 6 +- includes/SpecialAncientpages.php | 2 - includes/SpecialBlockip.php | 9 +- includes/SpecialBlockme.php | 3 +- includes/SpecialBooksources.php | 5 +- includes/SpecialBrokenRedirects.php | 10 +- includes/SpecialCategories.php | 14 +- includes/SpecialConfirmemail.php | 24 +- includes/SpecialContributions.php | 42 +-- includes/SpecialDeadendpages.php | 2 - includes/SpecialDisambiguations.php | 1 - includes/SpecialDoubleRedirects.php | 7 +- includes/SpecialEmailuser.php | 14 +- includes/SpecialExport.php | 36 +-- includes/SpecialFewestrevisions.php | 2 - includes/SpecialFileDuplicateSearch.php | 2 +- includes/SpecialImagelist.php | 6 +- includes/SpecialImport.php | 72 +++--- includes/SpecialIpblocklist.php | 20 +- includes/SpecialListgrouprights.php | 2 +- includes/SpecialListredirects.php | 5 +- includes/SpecialListusers.php | 6 +- includes/SpecialLockdb.php | 7 +- includes/SpecialLog.php | 5 +- includes/SpecialLonelypages.php | 2 - includes/SpecialLongpages.php | 2 - includes/SpecialMergeHistory.php | 98 +++---- includes/SpecialMostcategories.php | 2 - includes/SpecialMostimages.php | 4 +- includes/SpecialMostlinked.php | 2 - includes/SpecialMostlinkedcategories.php | 2 - includes/SpecialMostrevisions.php | 2 - includes/SpecialMovepage.php | 8 +- includes/SpecialNewimages.php | 2 - includes/SpecialNewpages.php | 52 ++-- includes/SpecialPage.php | 72 +++--- includes/SpecialPopularpages.php | 4 +- includes/SpecialPreferences.php | 24 +- includes/SpecialPrefixindex.php | 186 +++++++------- includes/SpecialProtectedpages.php | 39 ++- includes/SpecialProtectedtitles.php | 23 +- includes/SpecialRandompage.php | 10 +- includes/SpecialRandomredirect.php | 3 +- includes/SpecialRecentchanges.php | 42 ++- includes/SpecialRecentchangeslinked.php | 14 +- includes/SpecialResetpass.php | 30 +-- includes/SpecialRevisiondelete.php | 270 ++++++++++---------- includes/SpecialSearch.php | 52 ++-- includes/SpecialShortpages.php | 6 +- includes/SpecialSpecialpages.php | 8 +- includes/SpecialStatistics.php | 7 +- includes/SpecialUncategorizedcategories.php | 2 - includes/SpecialUncategorizedimages.php | 2 - includes/SpecialUncategorizedpages.php | 2 - includes/SpecialUncategorizedtemplates.php | 2 - includes/SpecialUndelete.php | 122 ++++----- includes/SpecialUnlockdb.php | 2 - includes/SpecialUnusedcategories.php | 1 - includes/SpecialUnusedimages.php | 7 +- includes/SpecialUnusedtemplates.php | 2 - includes/SpecialUnwatchedpages.php | 2 - includes/SpecialUpload.php | 72 +++--- includes/SpecialUploadMogile.php | 1 - includes/SpecialUserlogin.php | 12 +- includes/SpecialUserlogout.php | 6 +- includes/SpecialUserrights.php | 46 ++-- includes/SpecialVersion.php | 2 - includes/SpecialWantedcategories.php | 2 - includes/SpecialWantedpages.php | 6 +- includes/SpecialWatchlist.php | 10 +- includes/SpecialWhatlinkshere.php | 9 +- includes/SpecialWithoutinterwiki.php | 2 - includes/SquidUpdate.php | 7 +- includes/Status.php | 37 ++- includes/StreamFile.php | 6 +- includes/StringUtils.php | 38 ++- includes/StubObject.php | 22 +- includes/Title.php | 86 +++---- includes/User.php | 147 ++++++----- includes/UserMailer.php | 25 +- includes/UserRightsProxy.php | 26 +- includes/Utf8Case.php | 2 - includes/WatchedItem.php | 4 - includes/WatchlistEditor.php | 37 ++- includes/WebRequest.php | 38 ++- includes/WebResponse.php | 2 - includes/WebStart.php | 5 +- includes/Wiki.php | 9 +- includes/Xml.php | 67 +++-- includes/XmlFunctions.php | 2 +- includes/XmlTypeCheck.php | 22 +- includes/api/ApiBase.php | 69 +++-- includes/api/ApiDelete.php | 18 +- includes/api/ApiEditPage.php | 12 +- includes/api/ApiExpandTemplates.php | 3 +- includes/api/ApiFeedWatchlist.php | 25 +- includes/api/ApiFormatBase.php | 20 +- includes/api/ApiFormatDbg.php | 1 - includes/api/ApiFormatJson.php | 1 - includes/api/ApiFormatJson_json.php | 9 +- includes/api/ApiFormatPhp.php | 1 - includes/api/ApiFormatTxt.php | 1 - includes/api/ApiFormatWddx.php | 1 - includes/api/ApiFormatXml.php | 13 +- includes/api/ApiFormatYaml.php | 1 - includes/api/ApiFormatYaml_spyc.php | 215 ++++++++-------- includes/api/ApiHelp.php | 3 +- includes/api/ApiLogin.php | 45 ++-- includes/api/ApiLogout.php | 2 +- includes/api/ApiMain.php | 63 +++-- includes/api/ApiMove.php | 16 +- includes/api/ApiOpenSearch.php | 3 +- includes/api/ApiPageSet.php | 80 +++--- includes/api/ApiParamInfo.php | 7 +- includes/api/ApiParse.php | 13 +- includes/api/ApiProtect.php | 8 +- includes/api/ApiQuery.php | 51 ++-- includes/api/ApiQueryAllCategories.php | 8 +- includes/api/ApiQueryAllLinks.php | 4 +- includes/api/ApiQueryAllUsers.php | 28 +- includes/api/ApiQueryAllimages.php | 9 +- includes/api/ApiQueryAllmessages.php | 8 +- includes/api/ApiQueryAllpages.php | 21 +- includes/api/ApiQueryBacklinks.php | 27 +- includes/api/ApiQueryBase.php | 25 +- includes/api/ApiQueryBlocks.php | 2 +- includes/api/ApiQueryCategories.php | 15 +- includes/api/ApiQueryCategoryMembers.php | 31 ++- includes/api/ApiQueryDeletedrevs.php | 6 +- includes/api/ApiQueryExtLinksUsage.php | 12 +- includes/api/ApiQueryExternalLinks.php | 11 +- includes/api/ApiQueryImageInfo.php | 20 +- includes/api/ApiQueryImages.php | 9 +- includes/api/ApiQueryInfo.php | 11 +- includes/api/ApiQueryLangLinks.php | 7 +- includes/api/ApiQueryLinks.php | 9 +- includes/api/ApiQueryLogEvents.php | 21 +- includes/api/ApiQueryRandom.php | 14 +- includes/api/ApiQueryRecentChanges.php | 43 ++-- includes/api/ApiQueryRevisions.php | 45 ++-- includes/api/ApiQuerySearch.php | 11 +- includes/api/ApiQuerySiteinfo.php | 40 +-- includes/api/ApiQueryUserContributions.php | 25 +- includes/api/ApiQueryUserInfo.php | 14 +- includes/api/ApiQueryUsers.php | 16 +- includes/api/ApiQueryWatchlist.php | 19 +- includes/api/ApiResult.php | 30 +-- includes/api/ApiRollback.php | 6 +- includes/api/ApiUnblock.php | 4 +- includes/api/ApiUndelete.php | 6 +- includes/cbt/CBTCompiler.php | 35 ++- includes/cbt/CBTProcessor.php | 81 +++--- includes/cbt/README | 44 ++-- includes/filerepo/ArchivedFile.php | 68 ++--- includes/filerepo/FSRepo.php | 36 ++- includes/filerepo/File.php | 112 ++++---- includes/filerepo/FileRepo.php | 51 ++-- includes/filerepo/FileRepoStatus.php | 2 +- includes/filerepo/ForeignDBFile.php | 3 +- includes/filerepo/ForeignDBRepo.php | 10 +- includes/filerepo/ICRepo.php | 2 - includes/filerepo/Image.php | 6 +- includes/filerepo/LocalFile.php | 86 +++---- includes/filerepo/LocalRepo.php | 12 +- includes/filerepo/NullRepo.php | 6 +- includes/filerepo/OldLocalFile.php | 21 +- includes/filerepo/README | 14 +- includes/filerepo/RepoGroup.php | 10 +- includes/filerepo/UnregisteredLocalFile.php | 7 +- includes/media/BMP.php | 2 +- includes/media/Bitmap.php | 12 +- includes/media/DjVu.php | 12 +- includes/media/Generic.php | 28 +- includes/media/SVG.php | 10 +- includes/memcached-client.php | 9 +- includes/mime.info | 4 +- includes/mime.types | 6 +- includes/normal/CleanUpTest.php | 1 - includes/normal/RandomTest.php | 2 - includes/normal/Utf8Test.php | 2 - includes/normal/UtfNormal.php | 2 - includes/normal/UtfNormalBench.php | 2 - includes/normal/UtfNormalGenerate.php | 2 - includes/normal/UtfNormalTest.php | 2 - includes/normal/UtfNormalUtil.php | 2 - includes/proxy_check.php | 2 - includes/templates/Userlogin.php | 2 - includes/tidy.conf | 6 +- 301 files changed, 3168 insertions(+), 3539 deletions(-) diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index 7b85ed2054..e3b3bb12c8 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -119,5 +119,3 @@ class AjaxDispatcher { $wgOut = null; } } - - diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index d86b52969e..a71e599520 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -1,6 +1,6 @@ checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) ); if ( $wgCapitalLinks ) - $term = $wgContLang->ucfirst( $term ); + $term = $wgContLang->ucfirst( $term ); $term_title = Title::newFromText( $term ); $memckey = $term_title ? wfMemcKey( 'ajaxsearch', md5( $term_title->getFullText() ) ) : wfMemcKey( 'ajaxsearch', md5( $term ) ); @@ -97,12 +97,12 @@ function wfSajaxSearch( $term ) { $r = $more = ''; $canSearch = true; - + $results = PrefixSearch::titleSearch( $term, $limit + 1 ); foreach( array_slice( $results, 0, $limit ) as $titleText ) { $r .= '
  • ' . $sk->makeKnownLink( $titleText ) . "
  • \n"; } - + // Hack to check for specials if( $results ) { $t = Title::newFromText( $results[0] ); @@ -162,7 +162,7 @@ function wfSajaxSearch( $term ) { * Called for AJAX watch/unwatch requests. * @param $pagename Prefixed title string for page to watch/unwatch * @param $watch String 'w' to watch, 'u' to unwatch - * @return String '' or '' on successful watch or unwatch, + * @return String '' or '' on successful watch or unwatch, * respectively, followed by an HTML message to display in the alert box; or * '' on error */ @@ -170,7 +170,7 @@ function wfAjaxWatch($pagename = "", $watch = "") { if(wfReadOnly()) { // redirect to action=(un)watch, which will display the database lock // message - return ''; + return ''; } if('w' !== $watch && 'u' !== $watch) { @@ -207,4 +207,3 @@ function wfAjaxWatch($pagename = "", $watch = "") { return ''.wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() ); } } - diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index 8fa08539a6..791bfbb102 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -99,7 +99,7 @@ class AjaxResponse { if ( $this->mCacheDuration ) { - # If squid caches are configured, tell them to cache the response, + # If squid caches are configured, tell them to cache the response, # and tell the client to always check with the squid. Otherwise, # tell the client to use a cached copy, without a way to purge it. @@ -220,4 +220,3 @@ class AjaxResponse { return true; } } - diff --git a/includes/Article.php b/includes/Article.php index 6c459448c6..8a919c816b 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -832,7 +832,7 @@ class Article { } if( !$outputDone ) { $wgOut->setRevisionId( $this->getRevIdFetched() ); - + // Pages containing custom CSS or JavaScript get special treatment if( $this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) { $wgOut->addHtml( wfMsgExt( 'clearyourcache', 'parse' ) ); @@ -846,9 +846,9 @@ class Article { $wgOut->addHtml( htmlspecialchars( $this->mContent ) ); $wgOut->addHtml( "\n\n" ); } - + } - + elseif ( $rt = $this->getRedirectTarget() ) { # Display redirect $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; @@ -1396,7 +1396,7 @@ class Article { $lastRevision = 0; $revisionId = 0; - + $changed = ( strcmp( $text, $oldtext ) != 0 ); if ( $changed ) { @@ -1465,7 +1465,7 @@ class Article { # Invalidate cache of this article and all pages using this article # as a template. Partly deferred. Article::onArticleEdit( $this->mTitle ); - + # Update links tables, site stats, etc. $this->editUpdates( $text, $summary, $isminor, $now, $revisionId, $changed ); } @@ -1571,7 +1571,7 @@ class Article { if ( !($wgUseNPPatrol || $wgUseRCPatrol)) { $wgOut->showErrorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); - return; + return; } # If we haven't been given an rc_id value, we can't do anything @@ -1590,7 +1590,7 @@ class Article { $wgOut->showErrorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); return; } - + # Check permissions $permission_errors = $this->mTitle->getUserPermissionsErrors( 'patrol', $wgUser ); @@ -1810,10 +1810,10 @@ class Article { foreach( $limit as $action => $restrictions ) { # Check if the group level required to edit also can protect pages # Otherwise, people who cannot normally protect can "protect" pages via transclusion - $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && - $wgGroupPermissions[$restrictions]['protect'] ); + $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && + $wgGroupPermissions[$restrictions]['protect'] ); } - + $cascade_description = ''; if ($cascade) { $cascade_description = ' ['.wfMsg('protect-summary-cascade').']'; @@ -1827,7 +1827,7 @@ class Article { $comment .= "$expiry_description"; if ( $cascade ) $comment .= "$cascade_description"; - + # Update restrictions table foreach( $limit as $action => $restrictions ) { if ($restrictions != '' ) { @@ -1859,8 +1859,8 @@ class Article { # Update the protection log $log = new LogPage( 'protect' ); - - + + if( $protect ) { $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, trim( $reason . " [$updated]$cascade_description$expiry_description" ) ); @@ -1894,7 +1894,7 @@ class Article { } return implode( ':', $bits ); } - + /** * Auto-generates a deletion reason * @param bool &$hasHistory Whether the page has a history @@ -1956,7 +1956,7 @@ class Article { else $reason = wfMsgForContent('excontent', '$1'); } - + // Replace newlines with spaces to prevent uglyness $contents = preg_replace("/[\n\r]/", ' ', $contents); // Calculate the maximum amount of chars to get @@ -1979,12 +1979,12 @@ class Article { $confirm = $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ); - + $this->DeleteReasonList = $wgRequest->getText( 'wpDeleteReasonList', 'other' ); $this->DeleteReason = $wgRequest->getText( 'wpReason' ); - + $reason = $this->DeleteReasonList; - + if ( $reason != 'other' && $this->DeleteReason != '') { // Entry from drop down menu + additional comment $reason .= ': ' . $this->DeleteReason; @@ -2001,7 +2001,7 @@ class Article { $wgOut->readOnlyPage(); return; } - + # Check permissions $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgUser ); @@ -2054,10 +2054,10 @@ class Article { array( 'delete-warning-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) ); } } - + return $this->confirmDelete( '', $reason ); } - + /** * @return bool whether or not the page surpasses $wgDeleteRevisionsLimit revisions */ @@ -2069,7 +2069,7 @@ class Article { } return false; } - + /** * @return int approximate revision count */ @@ -2161,7 +2161,7 @@ class Article { " " . Xml::listDropDown( 'wpDeleteReasonList', - wfMsgForContent( 'deletereason-dropdown' ), + wfMsgForContent( 'deletereason-dropdown' ), wfMsgForContent( 'deletereasonotherlist' ), '', 'wpReasonDropDown', 1 ) . " @@ -2270,7 +2270,7 @@ class Article { } else { $bitfield = 'rev_deleted'; } - + // For now, shunt the revision data into the archive table. // Text is *not* removed from the text table; bulk storage // is left intact to avoid breaking block-compression or @@ -2339,7 +2339,7 @@ class Article { if ( !$dbw->cleanupTriggers() ) { # Clean up recentchanges entries... - $dbw->delete( 'recentchanges', + $dbw->delete( 'recentchanges', array( 'rc_namespace' => $ns, 'rc_title' => $t, 'rc_type != '.RC_LOG ), __METHOD__ ); } @@ -2355,7 +2355,7 @@ class Article { $logtype = $suppress ? 'suppress' : 'delete'; $log = new LogPage( $logtype ); $log->addEntry( 'delete', $this->mTitle, $reason ); - + return true; } @@ -2366,15 +2366,15 @@ class Article { * performs permissions checks on $wgUser, then calls commitRollback() * to do the dirty work * - * @param string $fromP - Name of the user whose edits to rollback. + * @param string $fromP - Name of the user whose edits to rollback. * @param string $summary - Custom summary. Set to default summary if empty. * @param string $token - Rollback token. * @param bool $bot - If true, mark all reverted edits as bot. - * + * * @param array $resultDetails contains result-specific array of additional values * 'alreadyrolled' : 'current' (rev) * success : 'summary' (str), 'current' (rev), 'target' (rev) - * + * * @return array of errors, each error formatted as * array(messagekey, param1, param2, ...). * On success, the array is empty. This array can also be passed to @@ -2396,10 +2396,10 @@ class Article { # If there were errors, bail out now if(!empty($errors)) return $errors; - + return $this->commitRollback($fromP, $summary, $bot, $resultDetails); } - + /** * Backend implementation of doRollback(), please refer there for parameter * and return value documentation @@ -2408,7 +2408,7 @@ class Article { * rollback to the DB Therefore, you should only call this function direct- * ly if you want to use custom permissions checks. If you don't, use * doRollback() instead. - */ + */ public function commitRollback($fromP, $summary, $bot, &$resultDetails) { global $wgUseRCPatrol, $wgUser; $dbw = wfGetDB( DB_MASTER ); @@ -2452,7 +2452,7 @@ class Article { # Only admins can see this text return array(array('notvisiblerev')); } - + $set = array(); if ( $bot && $wgUser->isAllowed('markbotedits') ) { # Mark all reverted edits as bot @@ -2767,14 +2767,14 @@ class Article { : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid ); $cdel=''; - if( $wgUser->isAllowed( 'deleterevision' ) ) { + if( $wgUser->isAllowed( 'deleterevision' ) ) { $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); if( $revision->isCurrent() ) { // We don't handle top deleted edits too well - $cdel = wfMsgHtml('rev-delundel'); + $cdel = wfMsgHtml('rev-delundel'); } else if( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) { // If revision was hidden from sysops - $cdel = wfMsgHtml('rev-delundel'); + $cdel = wfMsgHtml('rev-delundel'); } else { $cdel = $sk->makeKnownLinkObj( $revdel, wfMsgHtml('rev-delundel'), @@ -2794,7 +2794,7 @@ class Article { $infomsg = $current && !wfEmptyMsg( 'revision-info-current', $m ) && $m != '-' ? 'revision-info-current' : 'revision-info'; - + $r = "\n\t\t\t\t
    " . wfMsg( $infomsg, $td, $userlinks ) . "
    \n" . "\n\t\t\t\t
    " . $cdel . wfMsg( 'revision-nav', $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "
    \n\t\t\t"; @@ -2855,9 +2855,9 @@ class Article { $printable = $wgRequest->getVal( 'printable' ); $page = $wgRequest->getVal( 'page' ); - //check for non-standard user language; this covers uselang, + //check for non-standard user language; this covers uselang, //and extensions for auto-detecting user language. - $ulang = $wgLang->getCode(); + $ulang = $wgLang->getCode(); $clang = $wgContLang->getCode(); $cacheable = $wgUseFileCache @@ -3043,7 +3043,7 @@ class Article { } $other->invalidateCache(); $other->purgeSquid(); - + $title->touchLinks(); $title->purgeSquid(); @@ -3073,7 +3073,7 @@ class Article { // Invalidate the caches of all pages which redirect here $wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, 'redirect' ); - + # Purge squid for this page only $title->purgeSquid(); @@ -3237,7 +3237,7 @@ class Article { $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( array( 'categorylinks', 'page_props', 'page' ), array( 'cl_to' ), - array( 'cl_from' => $id, 'pp_page=page_id', 'pp_propname' => 'hiddencat', + array( 'cl_from' => $id, 'pp_page=page_id', 'pp_propname' => 'hiddencat', 'page_namespace' => NS_CATEGORY, 'page_title=cl_to'), 'Article:getHiddenCategories' ); if ( false !== $res ) { diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index 6c5c7a1232..7717e001c2 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -242,5 +242,3 @@ class AuthPlugin { return $username; } } - - diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 8eecb77a0a..db7cb4c91a 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -392,7 +392,7 @@ function __autoload($className) { 'ApiUnblock' => 'includes/api/ApiUnblock.php', 'ApiUndelete' => 'includes/api/ApiUndelete.php', ); - + wfProfileIn( __METHOD__ ); if ( isset( $localClasses[$className] ) ) { $filename = $localClasses[$className]; @@ -427,14 +427,14 @@ function __autoload($className) { function wfLoadAllExtensions() { global $wgAutoloadClasses; - # It is crucial that SpecialPage.php is included before any special page + # It is crucial that SpecialPage.php is included before any special page # extensions are loaded. Otherwise the parent class will not be available - # when APC loads the early-bound extension class. Normally this is - # guaranteed by entering special pages via SpecialPage members such as + # when APC loads the early-bound extension class. Normally this is + # guaranteed by entering special pages via SpecialPage members such as # executePath(), but here we have to take a more explicit measure. - + require_once( dirname(__FILE__) . '/SpecialPage.php' ); - + foreach( $wgAutoloadClasses as $class => $file ) { if( !( class_exists( $class ) || interface_exists( $class ) ) ) { require( $file ); diff --git a/includes/Autopromote.php b/includes/Autopromote.php index b509742331..b166aa7bee 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -47,7 +47,7 @@ class Autopromote { return false; return true; } elseif( $cond[0] == '|' ) { - foreach( array_slice( $cond, 1 ) as $subcond ) + foreach( array_slice( $cond, 1 ) as $subcond ) if( self::recCheckCondition( $subcond, $user ) ) return true; return false; diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index 1cc7ce341e..14d6d93e23 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -247,8 +247,8 @@ abstract class SqlBagOStuff extends BagOStuff { } if($row=$this->_fetchobject($res)) { $this->_debug("get: retrieved data; exp time is " . $row->exptime); - if ( $row->exptime != $this->_maxdatetime() && - wfTimestamp( TS_UNIX, $row->exptime ) < time() ) + if ( $row->exptime != $this->_maxdatetime() && + wfTimestamp( TS_UNIX, $row->exptime ) < time() ) { $this->_debug("get: key has expired, deleting"); $this->delete($key); @@ -536,12 +536,12 @@ class APCBagOStuff extends BagOStuff { } return $val; } - + function set($key, $value, $exptime=0) { apc_store($key, serialize($value), $exptime); return true; } - + function delete($key, $time=0) { apc_delete($key); return true; @@ -604,7 +604,7 @@ class XCacheBagOStuff extends BagOStuff { $val = unserialize( $val ); return $val; } - + /** * Store a value in the XCache object cache * @@ -617,7 +617,7 @@ class XCacheBagOStuff extends BagOStuff { xcache_set( $key, serialize( $value ), $expire ); return true; } - + /** * Remove a value from the XCache object cache * @@ -629,7 +629,7 @@ class XCacheBagOStuff extends BagOStuff { xcache_unset( $key ); return true; } - + } /** @@ -637,7 +637,7 @@ class XCacheBagOStuff extends BagOStuff { */ class DBABagOStuff extends BagOStuff { var $mHandler, $mFile, $mReader, $mWriter, $mDisabled; - + function __construct( $handler = 'db3', $dir = false ) { if ( $dir === false ) { global $wgTmpDirectory; @@ -665,7 +665,7 @@ class DBABagOStuff extends BagOStuff { if ( !is_string( $blob ) ) { return array( null, 0 ); } else { - return array( + return array( unserialize( substr( $blob, 11 ) ), intval( substr( $blob, 0, 10 ) ) ); @@ -780,5 +780,3 @@ class DBABagOStuff extends BagOStuff { return $result; } } - - diff --git a/includes/Block.php b/includes/Block.php index 1733ebc0ab..f740d35bb3 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -15,16 +15,16 @@ class Block { /* public*/ var $mAddress, $mUser, $mBy, $mReason, $mTimestamp, $mAuto, $mId, $mExpiry, - $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock, $mHideName, + $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock, $mHideName, $mBlockEmail, $mByName; /* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate, $mFromMaster; - + const EB_KEEP_EXPIRED = 1; const EB_FOR_UPDATE = 2; const EB_RANGE_ONLY = 4; function __construct( $address = '', $user = 0, $by = 0, $reason = '', - $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0, + $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0, $hideName = 0, $blockEmail = 0 ) { $this->mId = 0; @@ -59,10 +59,10 @@ class Block } } - static function newFromID( $id ) + static function newFromID( $id ) { $dbr = wfGetDB( DB_SLAVE ); - $res = $dbr->resultObject( $dbr->select( 'ipblocks', '*', + $res = $dbr->resultObject( $dbr->select( 'ipblocks', '*', array( 'ipb_id' => $id ), __METHOD__ ) ); $block = new Block; if ( $block->loadFromResult( $res ) ) { @@ -75,8 +75,8 @@ class Block function clear() { $this->mAddress = $this->mReason = $this->mTimestamp = ''; - $this->mId = $this->mAnonOnly = $this->mCreateAccount = - $this->mEnableAutoblock = $this->mAuto = $this->mUser = + $this->mId = $this->mAnonOnly = $this->mCreateAccount = + $this->mEnableAutoblock = $this->mAuto = $this->mUser = $this->mBy = $this->mHideName = $this->mBlockEmail = 0; $this->mByName = false; } @@ -124,7 +124,7 @@ class Block # Try user block if ( $user ) { - $res = $db->resultObject( $db->select( 'ipblocks', '*', array( 'ipb_user' => $user ), + $res = $db->resultObject( $db->select( 'ipblocks', '*', array( 'ipb_user' => $user ), __METHOD__, $options ) ); if ( $this->loadFromResult( $res, $killExpired ) ) { return true; @@ -170,7 +170,7 @@ class Block return true; } } - + # Give up $this->clear(); return false; @@ -179,7 +179,7 @@ class Block /** * Fill in member variables from a result wrapper */ - function loadFromResult( ResultWrapper $res, $killExpired = true ) + function loadFromResult( ResultWrapper $res, $killExpired = true ) { $ret = false; if ( 0 != $res->numRows() ) { @@ -234,7 +234,7 @@ class Block "ipb_range_start <= '$iaddr'", "ipb_range_end >= '$iaddr'" ); - + if ( $user ) { $conds['ipb_anon_only'] = 0; } @@ -620,7 +620,7 @@ class Block return $this->mAddress; } } - + /** * Encode expiry for DB */ @@ -632,7 +632,7 @@ class Block } } - /** + /** * Decode expiry which has come from the DB */ static function decodeExpiry( $expiry, $timestampType = TS_MW ) { @@ -642,14 +642,14 @@ class Block return wfTimestamp( $timestampType, $expiry ); } } - + static function getAutoblockExpiry( $timestamp ) { global $wgAutoblockExpiry; return wfTimestamp( TS_MW, wfTimestamp( TS_UNIX, $timestamp ) + $wgAutoblockExpiry ); } - - /** + + /** * Gets rid of uneeded numbers in quad-dotted/octet IP strings * For example, 127.111.113.151/24 -> 127.111.113.0/24 */ @@ -682,7 +682,7 @@ class Block return $range; } - /** + /** * Purge expired blocks from the ipblocks table */ static function purgeExpired() { @@ -691,8 +691,8 @@ class Block } static function infinity() { - # This is a special keyword for timestamps in PostgreSQL, and - # works with CHAR(14) as well because "i" sorts after all numbers. + # This is a special keyword for timestamps in PostgreSQL, and + # works with CHAR(14) as well because "i" sorts after all numbers. return 'infinity'; /* @@ -706,4 +706,3 @@ class Block } } - diff --git a/includes/CacheDependency.php b/includes/CacheDependency.php index 1d48c383e7..3e465b9669 100644 --- a/includes/CacheDependency.php +++ b/includes/CacheDependency.php @@ -1,7 +1,7 @@ deps = $deps; } - /** + /** * Returns true if any of the dependencies have expired */ function isExpired() { @@ -62,24 +62,24 @@ class DependencyWrapper { } /** - * Attempt to get a value from the cache. If the value is expired or missing, + * Attempt to get a value from the cache. If the value is expired or missing, * it will be generated with the callback function (if present), and the newly - * calculated value will be stored to the cache in a wrapper. + * calculated value will be stored to the cache in a wrapper. * * @param object $cache A cache object such as $wgMemc * @param string $key The cache key * @param integer $expiry The expiry timestamp or interval in seconds * @param mixed $callback The callback for generating the value, or false * @param array $callbackParams The function parameters for the callback - * @param array $deps The dependencies to store on a cache miss. Note: these + * @param array $deps The dependencies to store on a cache miss. Note: these * are not the dependencies used on a cache hit! Cache hits use the stored * dependency array. * * @return mixed The value, or null if it was not present in the cache and no * callback was defined. */ - static function getValueFromCache( $cache, $key, $expiry = 0, $callback = false, - $callbackParams = array(), $deps = array() ) + static function getValueFromCache( $cache, $key, $expiry = 0, $callback = false, + $callbackParams = array(), $deps = array() ) { $obj = $cache->get( $key ); if ( is_object( $obj ) && $obj instanceof DependencyWrapper && !$obj->isExpired() ) { @@ -122,11 +122,11 @@ class FileDependency extends CacheDependency { * * @param string $filename The name of the file, preferably fully qualified * @param mixed $timestamp The unix last modified timestamp, or false if the - * file does not exist. If omitted, the timestamp will be loaded from + * file does not exist. If omitted, the timestamp will be loaded from * the file. * - * A dependency on a nonexistent file will be triggered when the file is - * created. A dependency on an existing file will be triggered when the + * A dependency on a nonexistent file will be triggered when the file is + * created. A dependency on an existing file will be triggered when the * file is changed. */ function __construct( $filename, $timestamp = null ) { @@ -191,7 +191,7 @@ class TitleDependency extends CacheDependency { function loadDependencyValues() { $this->touched = $this->getTitle()->getTouched(); } - + /** * Get rid of bulky Title object for sleep */ @@ -202,7 +202,7 @@ class TitleDependency extends CacheDependency { function getTitle() { if ( !isset( $this->titleObj ) ) { $this->titleObj = Title::makeTitle( $this->ns, $this->dbk ); - } + } return $this->titleObj; } @@ -235,7 +235,7 @@ class TitleDependency extends CacheDependency { class TitleListDependency extends CacheDependency { var $linkBatch; var $timestamps; - + /** * Construct a dependency on a list of titles */ @@ -259,7 +259,7 @@ class TitleListDependency extends CacheDependency { if ( count( $timestamps ) ) { $dbr = wfGetDB( DB_SLAVE ); $where = $this->getLinkBatch()->constructSet( 'page', $dbr ); - $res = $dbr->select( 'page', + $res = $dbr->select( 'page', array( 'page_namespace', 'page_title', 'page_touched' ), $where, __METHOD__ ); while ( $row = $dbr->fetchObject( $res ) ) { @@ -317,7 +317,7 @@ class TitleListDependency extends CacheDependency { */ class GlobalDependency extends CacheDependency { var $name, $value; - + function __construct( $name ) { $this->name = $name; $this->value = $GLOBALS[$name]; @@ -343,5 +343,3 @@ class ConstantDependency extends CacheDependency { return constant( $this->name ) != $this->value; } } - - diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 5f293d1729..eb4912ed7c 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -66,7 +66,7 @@ class CategoryPage extends Article { class CategoryViewer { var $title, $limit, $from, $until, - $articles, $articles_start_char, + $articles, $articles_start_char, $children, $children_start_char, $showGallery, $gallery, $skin; @@ -81,7 +81,7 @@ class CategoryViewer { $this->limit = $wgCategoryPagingLimit; $this->cat = Category::newFromName( $title->getDBKey() ); } - + /** * Format the category data list. * @@ -140,7 +140,7 @@ class CategoryViewer { function addSubcategory( $title, $sortkey, $pageLength ) { global $wgContLang; // Subcategory; strip the 'Category' namespace from the link text. - $this->children[] = $this->getSkin()->makeKnownLinkObj( + $this->children[] = $this->getSkin()->makeKnownLinkObj( $title, $wgContLang->convertHtml( $title->getText() ) ); $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey ); @@ -155,13 +155,13 @@ class CategoryViewer { */ function getSubcategorySortChar( $title, $sortkey ) { global $wgContLang; - + if( $title->getPrefixedText() == $sortkey ) { $firstChar = $wgContLang->firstChar( $title->getDBkey() ); } else { $firstChar = $wgContLang->firstChar( $sortkey ); } - + return $wgContLang->convert( $firstChar ); } @@ -223,7 +223,7 @@ class CategoryViewer { #+ $pageCondition, __METHOD__, array( 'ORDER BY' => $this->flip ? 'cl_sortkey DESC' : 'cl_sortkey', - 'USE INDEX' => 'cl_sortkey', + 'USE INDEX' => 'cl_sortkey', 'LIMIT' => $this->limit + 1 ) ); $count = 0; @@ -502,6 +502,3 @@ class CategoryViewer { $wgLang->formatNum( $totalcnt ) ); } } - - - diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php index b94dcf5e5d..d28f2eebbf 100644 --- a/includes/Categoryfinder.php +++ b/includes/Categoryfinder.php @@ -188,5 +188,3 @@ class Categoryfinder { } } # END OF CLASS "Categoryfinder" - - diff --git a/includes/ChangesList.php b/includes/ChangesList.php index cb609d1845..ba94b4b5ce 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -27,7 +27,7 @@ class ChangesList { # Called by history lists and recent changes # - /** + /** * Changeslist contructor * @param Skin $skin */ @@ -194,7 +194,7 @@ class ChangesList { wfRunHooks('ChangesListInsertArticleLink', array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched)); - + $s .= ' '.$articlelink; } @@ -207,7 +207,7 @@ class ChangesList { /** Insert links to user page, user talk page and eventually a blocking link */ protected function insertUserRelatedLinks(&$s, &$rc) { if ( $this->isDeleted($rc,Revision::DELETED_USER) ) { - $s .= ' ' . wfMsgHtml('rev-deleted-user') . ''; + $s .= ' ' . wfMsgHtml('rev-deleted-user') . ''; } else { $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] ); $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] ); @@ -222,7 +222,7 @@ class ChangesList { if ( $this->isDeleted($rc,LogPage::DELETED_ACTION) ) { $s .= ' ' . wfMsgHtml('rev-deleted-event') . ''; } else { - $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'], + $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'], $rc->getTitle(), $this->skin, LogPage::extractParams($rc->mAttribs['rc_params']), true, true ); } } @@ -240,7 +240,7 @@ class ChangesList { } } } - + /** * Check whether to enable recent changes patrol features * @return bool @@ -266,7 +266,7 @@ class ChangesList { return ''; } } - + /** * Determine if said field of a revision is hidden * @param RCCacheEntry $rc @@ -276,7 +276,7 @@ class ChangesList { public static function isDeleted( $rc, $field ) { return ($rc->mAttribs['rc_deleted'] & $field) == $field; } - + /** * Determine if the current user is allowed to view a particular * field of this revision, if it's marked as deleted. @@ -364,7 +364,7 @@ class OldChangesList extends ChangesList { $this->insertAction($s, $rc); # Edit or log comment $this->insertComment($s, $rc); - + # Mark revision as deleted if so if ( !$rc_log_type && $this->isDeleted($rc,Revision::DELETED_TEXT) ) $s .= ' ' . wfMsgHtml( 'deletedrev' ) . ''; @@ -446,7 +446,7 @@ class EnhancedChangesList extends ChangesList { } else { $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' ); } - + # Don't show unusable diff links if ( !ChangesList::userCan($rc,Revision::DELETED_TEXT) ) { $showdifflinks = false; @@ -468,7 +468,7 @@ class EnhancedChangesList extends ChangesList { $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery"; $aprops = ' tabindex="'.$baseRC->counter.'"'; $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops ); - + # Make "diff" an "cur" links if( !$showdifflinks ) { $curLink = $this->message['cur']; @@ -481,7 +481,7 @@ class EnhancedChangesList extends ChangesList { } else { $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops ); } - + # Make "last" link if( !$showdifflinks ) { $lastLink = $this->message['last']; @@ -491,7 +491,7 @@ class EnhancedChangesList extends ChangesList { $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'], $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery ); } - + # Make user links if( $this->isDeleted($rc,Revision::DELETED_USER) ) { $rc->userlink = ' ' . wfMsgHtml('rev-deleted-user') . ''; @@ -569,7 +569,7 @@ class EnhancedChangesList extends ChangesList { if( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) { $currentRevision = $rcObj->mAttribs['rc_this_oldid']; } - + $bot = $rcObj->mAttribs['rc_bot']; $userlinks[$u]++; } @@ -634,7 +634,7 @@ class EnhancedChangesList extends ChangesList { } $r .= ') . . '; } - + # Character difference (does not apply if only log items) if( $wgRCShowChangedSize && !$alllogs ) { $last = 0; @@ -649,7 +649,7 @@ class EnhancedChangesList extends ChangesList { # Get net change $chardiff = $rcObj->getCharacterDifference( $block[$first]->mAttribs['rc_old_len'], $block[$last]->mAttribs['rc_new_len'] ); - + if( $chardiff == '' ) { $r .= ' '; } else { @@ -664,10 +664,10 @@ class EnhancedChangesList extends ChangesList { $r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(), $this->message['history'], $curIdEq.'&action=history' ) . ')'; } - + $r .= $users; $r .=$this->numberofWatchingusers($block[0]->numberofWatchingusers); - + $r .= "\n"; # Sub-entries @@ -698,7 +698,7 @@ class EnhancedChangesList extends ChangesList { $link = ''.$link.' '; } $r .= $link; - + if ( !$rc_type == RC_LOG || $rc_type == RC_NEW ) { $r .= ' ('; $r .= $rcObj->curlink; @@ -781,11 +781,11 @@ class EnhancedChangesList extends ChangesList { protected function spacerArrow() { return $this->arrow( '', ' ' ); } - + /** * Add a set of spaces * @return string HTML tag - */ + */ protected function spacerIndent() { return '     '; } @@ -805,7 +805,7 @@ class EnhancedChangesList extends ChangesList { $r = ''; $r .= ' @@ -186,7 +186,7 @@ class FileDeleteForm { $wgOut->addHtml( '

    ' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

    \n" ); LogEventsList::showLogExtract( $wgOut, 'delete', $this->title->getPrefixedText() ); } - + /** * Prepare a message referring to the file being deleted, * showing an appropriate message depending upon whether @@ -214,7 +214,7 @@ class FileDeleteForm { ); } } - + /** * Set headers, titles and other bits */ @@ -224,7 +224,7 @@ class FileDeleteForm { $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setSubtitle( wfMsg( 'filedelete-backlink', $wgUser->getSkin()->makeKnownLinkObj( $this->title ) ) ); } - + /** * Is the provided `oldimage` value valid? * @@ -235,7 +235,7 @@ class FileDeleteForm { && strpos( $oldimage, '/' ) === false && strpos( $oldimage, '\\' ) === false; } - + /** * Could we delete the file specified? If an `oldimage` * value was provided, does it correspond to an @@ -248,7 +248,7 @@ class FileDeleteForm { ? $oldfile && $oldfile->exists() && $oldfile->isLocal() : $file && $file->exists() && $file->isLocal(); } - + /** * Prepare the form action * @@ -261,7 +261,7 @@ class FileDeleteForm { $q[] = 'oldimage=' . urlencode( $this->oldimage ); return $this->title->getLocalUrl( implode( '&', $q ) ); } - + /** * Extract the timestamp of the old version * @@ -270,5 +270,5 @@ class FileDeleteForm { private function getTimestamp() { return $this->oldfile->getTimestamp(); } - + } diff --git a/includes/FileRevertForm.php b/includes/FileRevertForm.php index b8455bb76e..e4401d0574 100644 --- a/includes/FileRevertForm.php +++ b/includes/FileRevertForm.php @@ -13,7 +13,7 @@ class FileRevertForm { protected $archiveName = ''; protected $timestamp = false; protected $oldFile; - + /** * Constructor * @@ -23,7 +23,7 @@ class FileRevertForm { $this->title = $file->getTitle(); $this->file = $file; } - + /** * Fulfil the request; shows the form or reverts the file, * pending authentication, confirmation, etc. @@ -48,20 +48,20 @@ class FileRevertForm { $wgOut->blockedPage(); return; } - + $this->archiveName = $wgRequest->getText( 'oldimage' ); $token = $wgRequest->getText( 'wpEditToken' ); if( !$this->isValidOldSpec() ) { $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars( $this->archiveName ) ); return; } - + if( !$this->haveOldVersion() ) { $wgOut->addHtml( wfMsgExt( 'filerevert-badversion', 'parse' ) ); $wgOut->returnToMain( false, $this->title ); return; } - + // Perform the reversion if appropriate if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->archiveName ) ) { $source = $this->file->getArchiveVirtualUrl( $this->archiveName ); @@ -79,11 +79,11 @@ class FileRevertForm { } return; } - + // Show the form - $this->showForm(); + $this->showForm(); } - + /** * Show the confirmation form */ @@ -103,10 +103,10 @@ class FileRevertForm { $form .= '

    ' . Xml::submitButton( wfMsg( 'filerevert-submit' ) ) . '

    '; $form .= ''; $form .= ''; - + $wgOut->addHtml( $form ); } - + /** * Set headers, titles and other bits */ @@ -116,7 +116,7 @@ class FileRevertForm { $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setSubtitle( wfMsg( 'filerevert-backlink', $wgUser->getSkin()->makeKnownLinkObj( $this->title ) ) ); } - + /** * Is the provided `oldimage` value valid? * @@ -127,7 +127,7 @@ class FileRevertForm { && strpos( $this->archiveName, '/' ) === false && strpos( $this->archiveName, '\\' ) === false; } - + /** * Does the provided `oldimage` value correspond * to an existing, local, old version of this file? @@ -137,7 +137,7 @@ class FileRevertForm { protected function haveOldVersion() { return $this->getOldFile()->exists(); } - + /** * Prepare the form action * @@ -149,7 +149,7 @@ class FileRevertForm { $q[] = 'oldimage=' . urlencode( $this->archiveName ); return $this->title->getLocalUrl( implode( '&', $q ) ); } - + /** * Extract the timestamp of the old version * diff --git a/includes/FileStore.php b/includes/FileStore.php index a547e7e44a..caa8bbadbd 100644 --- a/includes/FileStore.php +++ b/includes/FileStore.php @@ -5,13 +5,13 @@ */ class FileStore { const DELETE_ORIGINAL = 1; - + /** * Fetch the FileStore object for a given storage group */ static function get( $group ) { global $wgFileStore; - + if( isset( $wgFileStore[$group] ) ) { $info = $wgFileStore[$group]; return new FileStore( $group, @@ -22,14 +22,14 @@ class FileStore { return null; } } - + private function __construct( $group, $directory, $path, $hash ) { $this->mGroup = $group; $this->mDirectory = $directory; $this->mPath = $path; $this->mHashLevel = $hash; } - + /** * Acquire a lock; use when performing write operations on a store. * This is attached to your master database connection, so if you @@ -47,7 +47,7 @@ class FileStore { $result = $dbw->query( "SELECT GET_LOCK($lockname, 5) AS lockstatus", __METHOD__ ); $row = $dbw->fetchObject( $result ); $dbw->freeResult( $result ); - + if( $row->lockstatus == 1 ) { return true; } else { @@ -55,7 +55,7 @@ class FileStore { return false; } } - + /** * Release the global file store lock. */ @@ -69,11 +69,11 @@ class FileStore { $dbw->fetchObject( $result ); $dbw->freeResult( $result ); } - + private static function lockName() { return 'MediaWiki.' . wfWikiID() . '.FileStore'; } - + /** * Copy a file into the file store from elsewhere in the filesystem. * Should be protected by FileStore::lock() to avoid race conditions. @@ -89,7 +89,7 @@ class FileStore { $destPath = $this->filePath( $key ); return $this->copyFile( $sourcePath, $destPath, $flags ); } - + /** * Copy a file from the file store to elsewhere in the filesystem. * Should be protected by FileStore::lock() to avoid race conditions. @@ -105,19 +105,19 @@ class FileStore { $sourcePath = $this->filePath( $key ); return $this->copyFile( $sourcePath, $destPath, $flags ); } - + private function copyFile( $sourcePath, $destPath, $flags=0 ) { if( !file_exists( $sourcePath ) ) { // Abort! Abort! throw new FSException( "missing source file '$sourcePath'" ); } - + $transaction = new FSTransaction(); - + if( $flags & self::DELETE_ORIGINAL ) { $transaction->addCommit( FSTransaction::DELETE_FILE, $sourcePath ); } - + if( file_exists( $destPath ) ) { // An identical file is already present; no need to copy. } else { @@ -125,17 +125,17 @@ class FileStore { wfSuppressWarnings(); $ok = mkdir( dirname( $destPath ), 0777, true ); wfRestoreWarnings(); - + if( !$ok ) { throw new FSException( "failed to create directory for '$destPath'" ); } } - + wfSuppressWarnings(); $ok = copy( $sourcePath, $destPath ); wfRestoreWarnings(); - + if( $ok ) { wfDebug( __METHOD__." copied '$sourcePath' to '$destPath'\n" ); $transaction->addRollback( FSTransaction::DELETE_FILE, $destPath ); @@ -144,10 +144,10 @@ class FileStore { __METHOD__." failed to copy '$sourcePath' to '$destPath'" ); } } - + return $transaction; } - + /** * Delete a file from the file store. * Caller's responsibility to make sure it's not being used by another row. @@ -167,7 +167,7 @@ class FileStore { return FileStore::deleteFile( $destPath ); } } - + /** * Delete a non-managed file on a transactional basis. * @@ -189,7 +189,7 @@ class FileStore { throw new FSException( "cannot delete missing file '$path'" ); } } - + /** * Stream a contained file directly to HTTP output. * Will throw a 404 if file is missing; 400 if invalid key. @@ -201,12 +201,12 @@ class FileStore { wfHttpError( 400, "Bad request", "Invalid or badly-formed filename." ); return false; } - + if( file_exists( $path ) ) { // Set the filename for more convenient save behavior from browsers // FIXME: Is this safe? header( 'Content-Disposition: inline; filename="' . $key . '"' ); - + require_once 'StreamFile.php'; wfStreamFile( $path ); } else { @@ -214,7 +214,7 @@ class FileStore { "The requested resource does not exist." ); } } - + /** * Confirm that the given file key is valid. * Note that a valid key may refer to a file that does not exist. @@ -229,8 +229,8 @@ class FileStore { static function validKey( $key ) { return preg_match( '/^[0-9a-z]{31,32}(\.[0-9a-z]{1,31})?$/', $key ); } - - + + /** * Calculate file storage key from a file on disk. * You must pass an extension to it, as some files may be calculated @@ -248,14 +248,14 @@ class FileStore { wfDebug( __METHOD__.": couldn't hash file '$path'\n" ); return false; } - + $base36 = wfBaseConvert( $hash, 16, 36, 31 ); if( $extension == '' ) { $key = $base36; } else { $key = $base36 . '.' . $extension; } - + // Sanity check if( self::validKey( $key ) ) { return $key; @@ -264,7 +264,7 @@ class FileStore { return false; } } - + /** * Return filesystem path to the given file. * Note that the file may or may not exist. @@ -278,7 +278,7 @@ class FileStore { return false; } } - + /** * Return URL path to the given file, if the store is public. * @return string or false if not public @@ -290,7 +290,7 @@ class FileStore { return false; } } - + private function hashPath( $key, $separator ) { $parts = array(); for( $i = 0; $i < $this->mHashLevel; $i++ ) { @@ -310,7 +310,7 @@ class FileStore { */ class FSTransaction { const DELETE_FILE = 1; - + /** * Combine more items into a fancier transaction */ @@ -320,7 +320,7 @@ class FSTransaction { $this->mOnRollback = array_merge( $this->mOnRollback, $transaction->mOnRollback ); } - + /** * Perform final actions for success. * @return true if actions applied ok, false if errors @@ -328,7 +328,7 @@ class FSTransaction { function commit() { return $this->apply( $this->mOnCommit ); } - + /** * Perform final actions for failure. * @return true if actions applied ok, false if errors @@ -336,22 +336,22 @@ class FSTransaction { function rollback() { return $this->apply( $this->mOnRollback ); } - + // --- Private and friend functions below... - + function __construct() { $this->mOnCommit = array(); $this->mOnRollback = array(); } - + function addCommit( $action, $path ) { $this->mOnCommit[] = array( $action, $path ); } - + function addRollback( $action, $path ) { $this->mOnRollback[] = array( $action, $path ); } - + private function apply( $actions ) { $result = true; foreach( $actions as $item ) { @@ -375,5 +375,3 @@ class FSTransaction { * @addtogroup Exception */ class FSException extends MWException { } - - diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 51d0749f0a..61e9e629dc 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -320,9 +320,9 @@ function wfReadOnlyReason() { * * @param $key String: lookup key for the message, usually * defined in languages/Language.php - * - * This function also takes extra optional parameters (not - * shown in the function definition), which can by used to + * + * This function also takes extra optional parameters (not + * shown in the function definition), which can by used to * insert variable text into the predefined message. */ function wfMsg( $key ) { @@ -657,7 +657,7 @@ function wfDie( $msg='' ) { } /** - * Throw a debugging exception. This function previously once exited the process, + * Throw a debugging exception. This function previously once exited the process, * but now throws an exception instead, with similar results. * * @param string $msg Message shown when dieing. @@ -876,7 +876,7 @@ function wfClientAcceptsGzip() { * @param $deflimit Default limit if none supplied * @param $optionname Name of a user preference to check against * @return array - * + * */ function wfCheckLimits( $deflimit = 50, $optionname = 'rclimit' ) { global $wgRequest; @@ -1543,9 +1543,9 @@ function wfGetCachedNotice( $name ) { global $wgOut, $parserMemc; $fname = 'wfGetCachedNotice'; wfProfileIn( $fname ); - + $needParse = false; - + if( $name === 'default' ) { // special case global $wgSiteNotice; @@ -1561,7 +1561,7 @@ function wfGetCachedNotice( $name ) { return( false ); } } - + $cachedNotice = $parserMemc->get( wfMemcKey( $name ) ); if( is_array( $cachedNotice ) ) { if( md5( $notice ) == $cachedNotice['hash'] ) { @@ -1572,7 +1572,7 @@ function wfGetCachedNotice( $name ) { } else { $needParse = true; } - + if( $needParse ) { if( is_object( $wgOut ) ) { $parsed = $wgOut->parse( $notice ); @@ -1583,21 +1583,21 @@ function wfGetCachedNotice( $name ) { $notice = ''; } } - + wfProfileOut( $fname ); return $notice; } function wfGetNamespaceNotice() { global $wgTitle; - + # Paranoia if ( !isset( $wgTitle ) || !is_object( $wgTitle ) ) return ""; $fname = 'wfGetNamespaceNotice'; wfProfileIn( $fname ); - + $key = "namespacenotice-" . $wgTitle->getNsText(); $namespaceNotice = wfGetCachedNotice( $key ); if ( $namespaceNotice && substr ( $namespaceNotice , 0 ,7 ) != "

    <" ) { @@ -1614,8 +1614,8 @@ function wfGetSiteNotice() { global $wgUser, $wgSiteNotice; $fname = 'wfGetSiteNotice'; wfProfileIn( $fname ); - $siteNotice = ''; - + $siteNotice = ''; + if( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice ) ) ) { if( is_object( $wgUser ) && $wgUser->isLoggedIn() ) { $siteNotice = wfGetCachedNotice( 'sitenotice' ); @@ -1637,7 +1637,7 @@ function wfGetSiteNotice() { return $siteNotice; } -/** +/** * BC wrapper for MimeMagic::singleton() * @deprecated */ @@ -1682,7 +1682,7 @@ function wfMkdirParents( $fullDir, $mode = 0777 ) { */ function wfIncrStats( $key ) { global $wgStatsMethod; - + if( $wgStatsMethod == 'udp' ) { global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgDBname; static $socket; @@ -1837,7 +1837,7 @@ function wfIniGetBool( $setting ) { */ function wfShellExec( $cmd, &$retval=null ) { global $IP, $wgMaxShellMemory, $wgMaxShellFileSize; - + if( wfIniGetBool( 'safe_mode' ) ) { wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" ); $retval = 1; @@ -1861,14 +1861,14 @@ function wfShellExec( $cmd, &$retval=null ) { $cmd = '"' . $cmd . '"'; } wfDebug( "wfShellExec: $cmd\n" ); - + $retval = 1; // error by default? ob_start(); passthru( $cmd, $retval ); $output = ob_get_contents(); ob_end_clean(); return $output; - + } /** @@ -1927,7 +1927,7 @@ function wfRegexReplacement( $string ) { * * PHP's basename() only considers '\' a pathchar on Windows and Netware. * We'll consider it so always, as we don't want \s in our Unix paths either. - * + * * @param string $path * @param string $suffix to remove if present * @return string @@ -1957,14 +1957,14 @@ function wfRelativePath( $path, $from ) { // Normalize mixed input on Windows... $path = str_replace( '/', DIRECTORY_SEPARATOR, $path ); $from = str_replace( '/', DIRECTORY_SEPARATOR, $from ); - + // Trim trailing slashes -- fix for drive root $path = rtrim( $path, DIRECTORY_SEPARATOR ); $from = rtrim( $from, DIRECTORY_SEPARATOR ); - + $pieces = explode( DIRECTORY_SEPARATOR, dirname( $path ) ); $against = explode( DIRECTORY_SEPARATOR, $from ); - + if( $pieces[0] !== $against[0] ) { // Non-matching Windows drive letters? // Return a full path. @@ -2030,7 +2030,7 @@ function wfMakeUrlIndex( $url ) { $delimiter = ':'; // parse_url detects for news: and mailto: the host part of an url as path // We have to correct this wrong detection - if ( isset ( $bits['path'] ) ) { + if ( isset ( $bits['path'] ) ) { $bits['host'] = $bits['path']; $bits['path'] = ''; } @@ -2127,7 +2127,7 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true $digitChars = ( $lowercase ) ? '0123456789abcdefghijklmnopqrstuvwxyz' : '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $inDigits = array(); $outChars = ''; - + // Decode and validate input string $input = strtolower( $input ); for( $i = 0; $i < strlen( $input ); $i++ ) { @@ -2137,18 +2137,18 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true } $inDigits[] = $n; } - + // Iterate over the input, modulo-ing out an output digit // at a time until input is gone. while( count( $inDigits ) ) { $work = 0; $workDigits = array(); - + // Long division... foreach( $inDigits as $digit ) { $work *= $sourceBase; $work += $digit; - + if( $work < $destBase ) { // Gonna need to pull another digit. if( count( $workDigits ) ) { @@ -2160,26 +2160,26 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true } else { // Finally! Actual division! $workDigits[] = intval( $work / $destBase ); - + // Isn't it annoying that most programming languages // don't have a single divide-and-remainder operator, // even though the CPU implements it that way? $work = $work % $destBase; } } - + // All that division leaves us with a remainder, // which is conveniently our next output digit. $outChars .= $digitChars[$work]; - + // And we continue! $inDigits = $workDigits; } - + while( strlen( $outChars ) < $pad ) { $outChars .= '0'; } - + return strrev( $outChars ); } @@ -2213,11 +2213,11 @@ function wfCreateObject( $name, $p ){ /** * Aliases for modularized functions */ -function wfGetHTTP( $url, $timeout = 'default' ) { - return Http::get( $url, $timeout ); +function wfGetHTTP( $url, $timeout = 'default' ) { + return Http::get( $url, $timeout ); } -function wfIsLocalURL( $url ) { - return Http::isLocalURL( $url ); +function wfIsLocalURL( $url ) { + return Http::isLocalURL( $url ); } /** @@ -2320,7 +2320,7 @@ function wfWikiID() { } /** - * Split a wiki ID into DB name and table prefix + * Split a wiki ID into DB name and table prefix */ function wfSplitWikiID( $wiki ) { $bits = explode( '-', $wiki, 2 ); @@ -2332,12 +2332,12 @@ function wfSplitWikiID( $wiki ) { /* * Get a Database object - * @param integer $db Index of the connection to get. May be DB_MASTER for the - * master (for write queries), DB_SLAVE for potentially lagged + * @param integer $db Index of the connection to get. May be DB_MASTER for the + * master (for write queries), DB_SLAVE for potentially lagged * read queries, or an integer >= 0 for a particular server. * - * @param mixed $groups Query groups. An array of group names that this query - * belongs to. May contain a single string if the query is only + * @param mixed $groups Query groups. An array of group names that this query + * belongs to. May contain a single string if the query is only * in one group. * * @param string $wiki The wiki ID, or false for the current wiki @@ -2365,11 +2365,11 @@ function &wfGetLBFactory() { } /** - * Find a file. + * Find a file. * Shortcut for RepoGroup::singleton()->findFile() * @param mixed $title Title object or string. May be interwiki. - * @param mixed $time Requested time for an archived image, or false for the - * current version. An image object will be returned which + * @param mixed $time Requested time for an archived image, or false for the + * current version. An image object will be returned which * was created at the specified time. * @return File, or false if the file does not exist */ @@ -2447,7 +2447,7 @@ function wfGetNull() { /** * Displays a maxlag error - * + * * @param string $host Server that lags the most * @param int $lag Maxlag (actual) * @param int $maxLag Maxlag (requested) @@ -2508,6 +2508,6 @@ function wfWaitForSlaves( $maxLag ) { */ function wfGenerateToken( $salt = '' ) { $salt = serialize($salt); - + return md5( mt_rand( 0, 0x7fffffff ) . $salt ); - } \ No newline at end of file +} diff --git a/includes/HTMLCacheUpdate.php b/includes/HTMLCacheUpdate.php index 050005dd1d..112c033927 100644 --- a/includes/HTMLCacheUpdate.php +++ b/includes/HTMLCacheUpdate.php @@ -5,19 +5,19 @@ * Small numbers of links will be done immediately, large numbers are pushed onto * the job queue. * - * This class is designed to work efficiently with small numbers of links, and + * This class is designed to work efficiently with small numbers of links, and * to work reasonably well with up to ~10^5 links. Above ~10^6 links, the memory * and time requirements of loading all backlinked IDs in doUpdate() might become * prohibitive. The requirements measured at Wikimedia are approximately: - * + * * memory: 48 bytes per row * time: 16us per row for the query plus processing * * The reason this query is done is to support partitioning of the job - * by backlinked ID. The memory issue could be allieviated by doing this query in + * by backlinked ID. The memory issue could be allieviated by doing this query in * batches, but of course LIMIT with an offset is inefficient on the DB side. * - * The class is nevertheless a vast improvement on the previous method of using + * The class is nevertheless a vast improvement on the previous method of using * Image::getLinksTo() and Title::touchArray(), which uses about 2KB of memory per * link. */ @@ -67,7 +67,7 @@ class HTMLCacheUpdate break; } } - + $params = array( 'table' => $this->mTable, 'start' => $start, @@ -88,7 +88,7 @@ class HTMLCacheUpdate 'categorylinks' => 'cl', 'templatelinks' => 'tl', 'redirect' => 'rd', - + # Not needed # 'externallinks' => 'el', # 'langlinks' => 'll' @@ -102,7 +102,7 @@ class HTMLCacheUpdate } return $this->mPrefix; } - + function getFromField() { return $this->getPrefix() . '_from'; } @@ -113,7 +113,7 @@ class HTMLCacheUpdate case 'pagelinks': case 'templatelinks': case 'redirect': - return array( + return array( "{$prefix}_namespace" => $this->mTitle->getNamespace(), "{$prefix}_title" => $this->mTitle->getDBkey() ); @@ -138,7 +138,7 @@ class HTMLCacheUpdate $dbw = wfGetDB( DB_MASTER ); $timestamp = $dbw->timestamp(); $done = false; - + while ( !$done ) { # Get all IDs in this query into an array $ids = array(); @@ -155,10 +155,10 @@ class HTMLCacheUpdate if ( !count( $ids ) ) { break; } - + # Update page_touched - $dbw->update( 'page', - array( 'page_touched' => $timestamp ), + $dbw->update( 'page', + array( 'page_touched' => $timestamp ), array( 'page_id IN (' . $dbw->makeList( $ids ) . ')' ), __METHOD__ ); @@ -221,4 +221,3 @@ class HTMLCacheUpdateJob extends Job { return true; } } - diff --git a/includes/HTMLFileCache.php b/includes/HTMLFileCache.php index a746681488..c6948a3c1d 100644 --- a/includes/HTMLFileCache.php +++ b/includes/HTMLFileCache.php @@ -153,5 +153,3 @@ class HTMLFileCache { } } - - diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 984ee2d4f8..f595b34d5e 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -5,7 +5,7 @@ /** * Pure virtual parent - * @todo document (needs a one-sentence top-level class description, that answers the question: "what is a HistoryBlob?") + * @todo document (needs a one-sentence top-level class description, that answers the question: "what is a HistoryBlob?") */ interface HistoryBlob { @@ -308,6 +308,3 @@ class HistoryBlobCurStub { return $row->cur_text; } } - - - diff --git a/includes/Hooks.php b/includes/Hooks.php index d1ed4a2432..8d01e88d08 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -143,4 +143,3 @@ function wfRunHooks($event, $args = array()) { return true; } - diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 9ab7447a2f..555a79b733 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -118,4 +118,3 @@ class Http { return false; } } - diff --git a/includes/IP.php b/includes/IP.php index db712c3bcd..e76f66c1a3 100644 --- a/includes/IP.php +++ b/includes/IP.php @@ -48,7 +48,7 @@ class IP { // IPv6 IPs with two "::" strings are ambiguous and thus invalid return preg_match( '/^' . IP_ADDRESS_STRING . '$/', $ip) && ( substr_count($ip, '::') < 2 ); } - + public static function isIPv6( $ip ) { if ( !$ip ) return false; if( is_array( $ip ) ) { @@ -57,18 +57,18 @@ class IP { // IPv6 IPs with two "::" strings are ambiguous and thus invalid return preg_match( '/^' . RE_IPV6_ADD . '(\/' . RE_IPV6_PREFIX . '|)$/', $ip) && ( substr_count($ip, '::') < 2); } - + public static function isIPv4( $ip ) { if ( !$ip ) return false; return preg_match( '/^' . RE_IP_ADD . '(\/' . RE_IP_PREFIX . '|)$/', $ip); } - + /** * Given an IP address in dotted-quad notation, returns an IPv6 octet. * See http://www.answers.com/topic/ipv4-compatible-address * IPs with the first 92 bits as zeros are reserved from IPv6 * @param $ip quad-dotted IP address. - * @return string + * @return string */ public static function IPv4toIPv6( $ip ) { if ( !$ip ) return null; @@ -106,13 +106,13 @@ class IP { $r_ip = wfBaseConvert( $r_ip, 16, 10 ); return $r_ip; } - + /** * Given an IPv6 address in octet notation, returns the expanded octet. * IPv4 IPs will be trimmed, thats it... * @param $ip octet ipv6 IP address. - * @return string - */ + * @return string + */ public static function sanitizeIP( $ip ) { $ip = trim( $ip ); if ( $ip === '' ) return null; @@ -132,11 +132,11 @@ class IP { $ip = preg_replace( '/(^|:)0+' . RE_IPV6_WORD . '/', '$1$2', $ip ); return $ip; } - + /** * Given an unsigned integer, returns an IPv6 address in octet notation * @param $ip integer IP address. - * @return string + * @return string */ public static function toOctet( $ip_int ) { // Convert to padded uppercase hex @@ -181,9 +181,9 @@ class IP { } return array( $network, $bits ); } - + /** - * Given a string range in a number of formats, return the start and end of + * Given a string range in a number of formats, return the start and end of * the range in hexadecimal. For IPv6. * * Formats are: @@ -233,7 +233,7 @@ class IP { return array( $start, $end ); } } - + /** * Validate an IP address. * @return boolean True if it is valid. @@ -310,7 +310,7 @@ class IP { * Return a zero-padded hexadecimal representation of an IP address. * * Hexadecimal addresses are used because they can easily be extended to - * IPv6 support. To separate the ranges, the return value from this + * IPv6 support. To separate the ranges, the return value from this * function for an IPv6 address will be prefixed with "v6-", a non- * hexadecimal string which sorts after the IPv4 addresses. * @@ -396,14 +396,14 @@ class IP { } /** - * Given a string range in a number of formats, return the start and end of + * Given a string range in a number of formats, return the start and end of * the range in hexadecimal. * * Formats are: * 1.2.3.4/24 CIDR * 1.2.3.4 - 1.2.3.5 Explicit range * 1.2.3.4 Single IP - * + * * 2001:0db8:85a3::7344/96 CIDR * 2001:0db8:85a3::7344 - 2001:0db8:85a3::7344 Explicit range * 2001:0db8:85a3::7344 Single IP @@ -439,7 +439,7 @@ class IP { } if ( $start === false || $end === false ) { return array( false, false ); - } else { + } else { return array( $start, $end ); } } @@ -492,5 +492,3 @@ class IP { return null; // give up } } - - diff --git a/includes/ImageFunctions.php b/includes/ImageFunctions.php index ee8cda164f..cbe3fe4edf 100644 --- a/includes/ImageFunctions.php +++ b/includes/ImageFunctions.php @@ -122,7 +122,7 @@ function wfIsBadImage( $name, $contextTitle = false ) { } } } - + $contextKey = $contextTitle ? $contextTitle->getPrefixedDBkey() : false; $bad = isset( $badImages[$name] ) && !isset( $badImages[$name][$contextKey] ); wfProfileOut( __METHOD__ ); @@ -145,6 +145,3 @@ function wfFitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) { else return $roundedUp; } - - - diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 29a54512d3..150fe0381e 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -37,7 +37,7 @@ class ImageGallery private $mPerRow = 4; // How many images wide should the gallery be? private $mWidths = 120, $mHeights = 120; // How wide/tall each thumbnail should be - + private $mAttribs = array(); /** @@ -196,11 +196,11 @@ class ImageGallery function setShowFilename( $f ) { $this->mShowFilename = ( $f == true); } - + /** * Set arbitrary attributes to go on the HTML gallery output element. * Should be suitable for a <table> element. - * + * * Note -- if taking from user input, you should probably run through * Sanitizer::validateAttributes() first. * @@ -240,7 +240,7 @@ class ImageGallery foreach ( $this->mImages as $pair ) { $nt = $pair[0]; $text = $pair[1]; - + # Give extensions a chance to select the file revision for us $time = false; wfRunHooks( 'BeforeGalleryFindFile', array( &$this, &$nt, &$time ) ); @@ -261,7 +261,7 @@ class ImageGallery . htmlspecialchars( $img->getLastError() ) . ''; } else { $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2; - + $thumbhtml = "\n\t\t\t". '

    ' # Auto-margin centering for block-level elements. Needed now that we have video @@ -328,7 +328,7 @@ class ImageGallery public function count() { return count( $this->mImages ); } - + /** * Set the contextual title * @@ -337,7 +337,7 @@ class ImageGallery public function setContextTitle( $title ) { $this->contextTitle = $title; } - + /** * Get the contextual title, if applicable * @@ -350,5 +350,3 @@ class ImageGallery } } //class - - diff --git a/includes/ImagePage.php b/includes/ImagePage.php index a9e0dbce89..6206b1c046 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -51,7 +51,7 @@ class ImagePage extends Article { return Article::view(); if ($wgShowEXIF && $this->img->exists()) { - // FIXME: bad interface, see note on MediaHandler::formatMetadata(). + // FIXME: bad interface, see note on MediaHandler::formatMetadata(). $formattedMetadata = $this->img->formatMetadata(); $showmeta = $formattedMetadata !== false; } else { @@ -121,7 +121,7 @@ class ImagePage extends Article { /** * Make a table with metadata to be shown in the output page. * - * FIXME: bad interface, see note on MediaHandler::formatMetadata(). + * FIXME: bad interface, see note on MediaHandler::formatMetadata(). * * @access private * @@ -148,7 +148,7 @@ class ImagePage extends Article { /** * Overloading Article's getContent method. - * + * * Omit noarticletext if sharedupload; text will be fetched from the * shared upload server if possible. */ @@ -237,7 +237,7 @@ class ImagePage extends Article { if( $this->img->mustRender() ) { $showLink = true; } else { - $anchorclose .= + $anchorclose .= $msgsmall . '
    ' . Xml::tags( 'a', $linkAttribs, $msgbig ) . "$dirmark " . $longDesc; } @@ -247,11 +247,11 @@ class ImagePage extends Article { } if ( $thumbnail ) { - $options = array( + $options = array( 'alt' => $this->img->getTitle()->getPrefixedText(), 'file-link' => true, ); - $wgOut->addHTML( '
    ' . $this->spacerArrow() . ' '; - + # Flag and Timestamp if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $r .= '    '; // 4 flags -> 4 spaces @@ -813,7 +813,7 @@ class EnhancedChangesList extends ChangesList { $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); } $r .= ' '.$rcObj->timestamp.' '; - + # Article or log link if( $rc_log_type ) { $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL ); @@ -824,14 +824,14 @@ class EnhancedChangesList extends ChangesList { } else { $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched ); } - + # Diff and hist links if ( $rc_type != RC_LOG ) { $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'] . ' '; $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')'; } $r .= ' . . '; - + # Character diff if( $wgRCShowChangedSize ) { $r .= ( $rcObj->getCharacterDifference() == '' ? '' : ' ' . $rcObj->getCharacterDifference() . ' . . ' ) ; @@ -846,7 +846,7 @@ class EnhancedChangesList extends ChangesList { $r .= ' ' . wfMsgHtml('rev-deleted-event') . ''; } else { $r .= ' ' . LogPage::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin, LogPage::extractParams($rc_params), true, true ); - } + } } # Edit or log comment diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index fa7ad54dd6..88b38fa236 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -7,7 +7,7 @@ class CoreParserFunctions { static function register( $parser ) { global $wgAllowDisplayTitle, $wgAllowSlowParserFunctions; - + # Syntax for arguments (see self::setFunctionHook): # "name for lookup in localized magic words array", # function callback, @@ -185,7 +185,7 @@ class CoreParserFunctions { return $mwRaw->match( $param ); } } - + static function formatRaw( $num, $raw ) { if( self::isRaw( $raw ) ) { return $num; @@ -215,7 +215,7 @@ class CoreParserFunctions { static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) { return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw ); } - + static function pagesincategory( $parser, $category = '', $raw = null ) { global $wgExpensiveParserFunctionLimit; if ($category == '') { @@ -271,14 +271,14 @@ class CoreParserFunctions { return wfMsgForContent( 'nosuchspecialpage' ); } } - + public static function defaultsort( $parser, $text ) { $text = trim( $text ); if( strlen( $text ) > 0 ) $parser->setDefaultSort( $text ); return ''; } - + public static function filepath( $parser, $name='', $option='' ) { $file = wfFindFile( $name ); if( $file ) { @@ -310,8 +310,8 @@ class CoreParserFunctions { $stripList = $parser->getStripList(); if ( !in_array( $tagName, $stripList ) ) { - return '' . - wfMsg( 'unknown_extension_tag', $tagName ) . + return '' . + wfMsg( 'unknown_extension_tag', $tagName ) . ''; } @@ -337,4 +337,3 @@ class CoreParserFunctions { return $parser->extensionSubstitution( $params, $frame ); } } - diff --git a/includes/Credits.php b/includes/Credits.php index 580a8d926c..6326e3a284 100644 --- a/includes/Credits.php +++ b/includes/Credits.php @@ -29,7 +29,7 @@ function showCreditsPage($article) { $fname = 'showCreditsPage'; wfProfileIn( $fname ); - + $wgOut->setPageTitle( $article->mTitle->getPrefixedText() ); $wgOut->setSubtitle( wfMsg( 'creditspage' ) ); $wgOut->setArticleFlag( false ); @@ -184,5 +184,3 @@ function creditOthersLink($article) { $skin = $wgUser->getSkin(); return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits'); } - - diff --git a/includes/DatabaseFunctions.php b/includes/DatabaseFunctions.php index a4a0444f3e..c85db22948 100644 --- a/includes/DatabaseFunctions.php +++ b/includes/DatabaseFunctions.php @@ -399,4 +399,3 @@ function wfUseIndexClause( $index, $dbi = DB_SLAVE ) { return false; } } - diff --git a/includes/DatabaseOracle.php b/includes/DatabaseOracle.php index 06fab298d7..4dc5628b9f 100644 --- a/includes/DatabaseOracle.php +++ b/includes/DatabaseOracle.php @@ -17,8 +17,8 @@ class ORABlob { } /** - * The oci8 extension is fairly weak and doesn't support oci_num_rows, among - * other things. We use a wrapper class to handle that and other + * The oci8 extension is fairly weak and doesn't support oci_num_rows, among + * other things. We use a wrapper class to handle that and other * Oracle-specific bits, like converting column names back to lowercase. * @addtogroup Database */ @@ -204,7 +204,7 @@ class DatabaseOracle extends Database { $e = oci_error($this->mConn); $this->reportQueryError($e['message'], $e['code'], $sql, __FUNCTION__); } - + if (oci_execute($stmt, $this->execFlags()) == false) { $e = oci_error($stmt); $this->reportQueryError($e['message'], $e['code'], $sql, __FUNCTION__); @@ -367,7 +367,7 @@ class DatabaseOracle extends Database { oci_free_statement($stmt); } - + function tableName( $name ) { # Replace reserved words with better ones switch( $name ) { @@ -530,7 +530,7 @@ class DatabaseOracle extends Database { } function reportQueryError($error, $errno, $sql, $fname, $tempIgnore = false) { - # Ignore errors during error handling to avoid infinite + # Ignore errors during error handling to avoid infinite # recursion $ignore = $this->ignoreErrors(true); ++$this->mErrorCount; @@ -653,10 +653,10 @@ echo "error!\n"; if ( isset( $options['GROUP BY'] ) ) $preLimitTail .= " GROUP BY {$options['GROUP BY']}"; if ( isset( $options['ORDER BY'] ) ) $preLimitTail .= " ORDER BY {$options['ORDER BY']}"; - + if (isset($options['LIMIT'])) { // $tailOpts .= $this->limitResult('', $options['LIMIT'], - // isset($options['OFFSET']) ? $options['OFFSET'] + // isset($options['OFFSET']) ? $options['OFFSET'] // : false); } @@ -669,7 +669,7 @@ echo "error!\n"; } else { $useIndex = ''; } - + return array( $startOpts, $useIndex, $preLimitTail, $postLimitTail ); } @@ -704,5 +704,3 @@ echo "error!\n"; } } // end DatabaseOracle class - - diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 2cdc342629..c5a1b91e7f 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -16,7 +16,7 @@ class PostgresField { global $wgDBmwschema; $q = <<'); } $perms = pg_fetch_result($res, 0, 0); - + $SQL = "SELECT 1 FROM pg_catalog.pg_user WHERE usename = " . $this->addQuotes($wgDBuser); $rows = $this->numRows($this->doQuery($SQL)); if ($rows) { @@ -263,7 +263,7 @@ class DatabasePostgres extends Database { // Reconnect to check out tsearch2 rights for this user print "
  • Connecting to \"$wgDBname\" as superuser \"$wgDBsuperuser\" to check rights..."; - + $hstring=""; if ($this->mServer!=false && $this->mServer!="") { $hstring="host=$this->mServer "; @@ -288,7 +288,7 @@ class DatabasePostgres extends Database { print "Please see this article"; print " for instructions or ask on #postgresql on irc.freenode.net
  • \n"; dieout(""); - } + } print "OK\n"; print "
  • Ensuring that user \"$wgDBuser\" has select rights on the tsearch2 tables..."; foreach (array('cfg','cfgmap','dict','parser') as $table) { @@ -335,17 +335,17 @@ class DatabasePostgres extends Database { } print "OK
  • "; } - + // Install plpgsql if needed $this->setup_plpgsql(); $wgDBsuperuser = ''; return true; // Reconnect as regular user - + } // end superuser - + if (!defined('POSTGRES_SEARCHPATH')) { - + if ($this->numeric_version < 8.3) { // Do we have the basic tsearch2 table? print "
  • Checking for tsearch2 in the schema \"$wgDBts2schema\"..."; @@ -356,7 +356,7 @@ class DatabasePostgres extends Database { dieout(""); } print "OK
  • \n"; - + // Does this user have the rights to the tsearch2 tables? $ctype = pg_fetch_result($this->doQuery("SHOW lc_ctype"),0,0); print "
  • Checking tsearch2 permissions..."; @@ -410,7 +410,7 @@ class DatabasePostgres extends Database { } print "OK
  • "; } - + // Final test: try out a simple tsearch2 query $SQL = "SELECT $safetsschema.to_tsvector('default','MediaWiki tsearch2 testing')"; $res = $this->doQuery($SQL); @@ -420,7 +420,7 @@ class DatabasePostgres extends Database { } print "OK"; } - + // Install plpgsql if needed $this->setup_plpgsql(); @@ -446,7 +446,7 @@ class DatabasePostgres extends Database { else { print "
  • Schema \"$wgDBmwschema\" exists and is owned by \"$wgDBuser\". Excellent.
  • \n"; } - + // Always return GMT time to accomodate the existing integer-based timestamp assumption print "
  • Setting the timezone to GMT for user \"$wgDBuser\" ..."; $SQL = "ALTER USER $safeuser SET timezone = 'GMT'"; @@ -479,7 +479,7 @@ class DatabasePostgres extends Database { print "
  • Failed to set datestyle
  • \n"; dieout(""); } - + // Fix up the search paths if needed print "
  • Setting the search path for user \"$wgDBuser\" ..."; $path = $this->quote_ident($wgDBmwschema); @@ -658,7 +658,7 @@ class DatabasePostgres extends Database { * Returns -1 if count cannot be found * Takes same arguments as Database::select() */ - + function estimateRowCount( $table, $vars='*', $conds='', $fname = 'Database::estimateRowCount', $options = array() ) { $options['EXPLAIN'] = true; $res = $this->select( $table, $vars, $conds, $fname, $options ); @@ -708,7 +708,7 @@ class DatabasePostgres extends Database { /** * INSERT wrapper, inserts an array into a table * - * $args may be a single associative array, or an array of these with numeric keys, + * $args may be a single associative array, or an array of these with numeric keys, * for multi-row insert (Postgres version 8.2 and above only). * * @param array $table String: Name of the table to insert to. @@ -997,7 +997,7 @@ class DatabasePostgres extends Database { /** - * Query whether a given relation exists (in the given schema, or the + * Query whether a given relation exists (in the given schema, or the * default mw one if not given) */ function relationExists( $table, $types, $schema = false ) { @@ -1019,13 +1019,13 @@ class DatabasePostgres extends Database { } /* - * For backward compatibility, this function checks both tables and + * For backward compatibility, this function checks both tables and * views. */ function tableExists ($table, $schema = false) { return $this->relationExists($table, array('r', 'v'), $schema); } - + function sequenceExists ($sequence, $schema = false) { return $this->relationExists($sequence, 'S', $schema); } @@ -1063,8 +1063,8 @@ END; global $wgDBmwschema; $SQL = sprintf("SELECT 1 FROM information_schema.table_constraints ". "WHERE constraint_schema = %s AND table_name = %s AND constraint_name = %s", - $this->addQuotes($wgDBmwschema), - $this->addQuotes($table), + $this->addQuotes($wgDBmwschema), + $this->addQuotes($table), $this->addQuotes($constraint)); $res = $this->query($SQL); if (!$res) @@ -1272,17 +1272,17 @@ END; if ( isset( $options['GROUP BY'] ) ) $preLimitTail .= " GROUP BY " . $options['GROUP BY']; if ( isset( $options['HAVING'] ) ) $preLimitTail .= " HAVING {$options['HAVING']}"; if ( isset( $options['ORDER BY'] ) ) $preLimitTail .= " ORDER BY " . $options['ORDER BY']; - + //if (isset($options['LIMIT'])) { // $tailOpts .= $this->limitResult('', $options['LIMIT'], - // isset($options['OFFSET']) ? $options['OFFSET'] + // isset($options['OFFSET']) ? $options['OFFSET'] // : false); //} if ( isset( $noKeyOptions['FOR UPDATE'] ) ) $postLimitTail .= ' FOR UPDATE'; if ( isset( $noKeyOptions['LOCK IN SHARE MODE'] ) ) $postLimitTail .= ' LOCK IN SHARE MODE'; if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT'; - + return array( $startOpts, $useIndex, $preLimitTail, $postLimitTail ); } @@ -1294,7 +1294,7 @@ END; wfDebug( "Function ping() not written for DatabasePostgres.php yet"); return true; } - + /** * How lagged is this slave? * @@ -1320,5 +1320,3 @@ END; } } // end DatabasePostgres class - - diff --git a/includes/DateFormatter.php b/includes/DateFormatter.php index bbad6d1564..4027becafd 100644 --- a/includes/DateFormatter.php +++ b/includes/DateFormatter.php @@ -12,7 +12,7 @@ class DateFormatter var $regexes, $pDays, $pMonths, $pYears; var $rules, $xMonths, $preferences; - + const ALL = -1; const NONE = 0; const MDY = 1; @@ -281,5 +281,3 @@ class DateFormatter return $text; } } - - diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 97ff9a2c54..9dde253fee 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -36,8 +36,8 @@ $wgVersion = '1.13alpha'; /** Name of the site. It must be changed in LocalSettings.php */ $wgSitename = 'MediaWiki'; -/** - * Name of the project namespace. If left set to false, $wgSitename will be +/** + * Name of the project namespace. If left set to false, $wgSitename will be * used instead. */ $wgMetaNamespace = false; @@ -180,11 +180,11 @@ $wgFileStore['deleted']['hash'] = 3; // 3-level subdirectory split * File repository structures * * $wgLocalFileRepo is a single repository structure, and $wgForeignFileRepo is - * a an array of such structures. Each repository structure is an associative - * array of properties configuring the repository. + * a an array of such structures. Each repository structure is an associative + * array of properties configuring the repository. * * Properties required for all repos: - * class The class name for the repository. May come from the core or an extension. + * class The class name for the repository. May come from the core or an extension. * The core repository classes are LocalRepo, ForeignDBRepo, FSRepo. * * name A unique name for the repository. @@ -193,25 +193,25 @@ $wgFileStore['deleted']['hash'] = 3; // 3-level subdirectory split * url Base public URL * hashLevels The number of directory levels for hash-based division of files * thumbScriptUrl The URL for thumb.php (optional, not recommended) - * transformVia404 Whether to skip media file transformation on parse and rely on a 404 + * transformVia404 Whether to skip media file transformation on parse and rely on a 404 * handler instead. - * initialCapital Equivalent to $wgCapitalLinks, determines whether filenames implicitly + * initialCapital Equivalent to $wgCapitalLinks, determines whether filenames implicitly * start with a capital letter. The current implementation may give incorrect - * description page links when the local $wgCapitalLinks and initialCapital + * description page links when the local $wgCapitalLinks and initialCapital * are mismatched. * pathDisclosureProtection - * May be 'paranoid' to remove all parameters from error messages, 'none' to - * leave the paths in unchanged, or 'simple' to replace paths with + * May be 'paranoid' to remove all parameters from error messages, 'none' to + * leave the paths in unchanged, or 'simple' to replace paths with * placeholders. Default for LocalRepo is 'simple'. * * These settings describe a foreign MediaWiki installation. They are optional, and will be ignored * for local repositories: * descBaseUrl URL of image description pages, e.g. http://en.wikipedia.org/wiki/Image: - * scriptDirUrl URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g. + * scriptDirUrl URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g. * http://en.wikipedia.org/w * * articleUrl Equivalent to $wgArticlePath, e.g. http://en.wikipedia.org/wiki/$1 - * fetchDescription Fetch the text of the remote file description page. Equivalent to + * fetchDescription Fetch the text of the remote file description page. Equivalent to * $wgFetchCommonsDescriptions. * * ForeignDBRepo: @@ -220,7 +220,7 @@ $wgFileStore['deleted']['hash'] = 3; // 3-level subdirectory split * tablePrefix Table prefix, the foreign wiki's $wgDBprefix * hasSharedCache True if the wiki's shared cache is accessible via the local $wgMemc * - * The default is to initialise these arrays from the MW<1.11 backwards compatible settings: + * The default is to initialise these arrays from the MW<1.11 backwards compatible settings: * $wgUploadPath, $wgThumbnailScriptPath, $wgSharedUploadDirectory, etc. */ $wgLocalFileRepo = false; @@ -360,7 +360,7 @@ $wgMimeInfoFile= "includes/mime.info"; #$wgMimeInfoFile= NULL; #use built-in defaults only. /** Switch for loading the FileInfo extension by PECL at runtime. - * This should be used only if fileinfo is installed as a shared object + * This should be used only if fileinfo is installed as a shared object * or a dynamic libary * @global string $wgLoadFileinfoExtension */ @@ -566,7 +566,7 @@ $wgDBTableOptions = 'TYPE=InnoDB'; /** * Make all database connections secretly go to localhost. Fool the load balancer - * thinking there is an arbitrarily large cluster of servers to connect to. + * thinking there is an arbitrarily large cluster of servers to connect to. * Useful for debugging. */ $wgAllDBsAreLocalhost = false; @@ -612,31 +612,31 @@ $wgSharedDB = null; * These and any other user-defined properties will be assigned to the mLBInfo member * variable of the Database object. * - * Leave at false to use the single-server variables above. If you set this - * variable, the single-server variables will generally be ignored (except - * perhaps in some command-line scripts). + * Leave at false to use the single-server variables above. If you set this + * variable, the single-server variables will generally be ignored (except + * perhaps in some command-line scripts). * - * The first server listed in this array (with key 0) will be the master. The - * rest of the servers will be slaves. To prevent writes to your slaves due to - * accidental misconfiguration or MediaWiki bugs, set read_only=1 on all your + * The first server listed in this array (with key 0) will be the master. The + * rest of the servers will be slaves. To prevent writes to your slaves due to + * accidental misconfiguration or MediaWiki bugs, set read_only=1 on all your * slaves in my.cnf. You can set read_only mode at runtime using: * * SET @@read_only=1; * * Since the effect of writing to a slave is so damaging and difficult to clean - * up, we at Wikimedia set read_only=1 in my.cnf on all our DB servers, even - * our masters, and then set read_only=0 on masters at runtime. + * up, we at Wikimedia set read_only=1 in my.cnf on all our DB servers, even + * our masters, and then set read_only=0 on masters at runtime. */ $wgDBservers = false; /** * Load balancer factory configuration - * To set up a multi-master wiki farm, set the class here to something that + * To set up a multi-master wiki farm, set the class here to something that * can return a LoadBalancer with an appropriate master on a call to getMainLB(). - * The class identified here is responsible for reading $wgDBservers, + * The class identified here is responsible for reading $wgDBservers, * $wgDBserver, etc., so overriding it may cause those globals to be ignored. * - * The LBFactory_Multi class is provided for this purpose, please see + * The LBFactory_Multi class is provided for this purpose, please see * includes/LBFactory_Multi.php for configuration information. */ $wgLBFactoryConf = array( 'class' => 'LBFactory_Simple' ); @@ -915,7 +915,7 @@ $wgMaxPPNodeCount = 1000000; # A complexity limit on template expansion /** * Maximum recursion depth for templates within templates. - * The current parser adds two levels to the PHP call stack for each template, + * The current parser adds two levels to the PHP call stack for each template, * and xdebug limits the call stack to 100 by default. So this should hopefully * stop the parser before it hits the xdebug limit. */ @@ -1059,7 +1059,7 @@ $wgSysopEmailBans = true; # Allow sysops to ban users from accessing Email # directory name unguessable, or use .htaccess to protect it. $wgWhitelistRead = false; -/** +/** * Should editors be required to have a validated e-mail * address before being allowed to edit? */ @@ -1271,13 +1271,13 @@ $wgAutopromote = array( * groups at Special:Userrights. Example configuration: * * // Bureaucrat can add any group - * $wgAddGroups['bureaucrat'] = true; + * $wgAddGroups['bureaucrat'] = true; * // Bureaucrats can only remove bots and sysops - * $wgRemoveGroups['bureaucrat'] = array( 'bot', 'sysop' ); + * $wgRemoveGroups['bureaucrat'] = array( 'bot', 'sysop' ); * // Sysops can make bots - * $wgAddGroups['sysop'] = array( 'bot' ); + * $wgAddGroups['sysop'] = array( 'bot' ); * // Sysops can disable other sysops in an emergency, and disable bots - * $wgRemoveGroups['sysop'] = array( 'sysop', 'bot' ); + * $wgRemoveGroups['sysop'] = array( 'sysop', 'bot' ); */ $wgAddGroups = $wgRemoveGroups = array(); @@ -1393,14 +1393,14 @@ $wgEnotifMinorEdits = true; # UPO; false: "minor edits" on pages do not trigger $wgEnotifImpersonal = false; -# Maximum number of users to mail at once when using impersonal mail. Should +# Maximum number of users to mail at once when using impersonal mail. Should # match the limit on your mail server. $wgEnotifMaxRecips = 500; # Send mails via the job queue. $wgEnotifUseJobQ = false; -/** +/** * Array of usernames who will be sent a notification email for every change which occurs on a wiki */ $wgUsersNotifiedOnAllChanges = array(); @@ -1416,7 +1416,7 @@ $wgRCTypeGroupedLogs = array( 'block', 'rights' ); /** * If the difference between the character counts of the text - * before and after the edit is below that value, the value will be + * before and after the edit is below that value, the value will be * highlighted on the RC page. */ $wgRCChangedSizeThreshold = -500; @@ -1733,7 +1733,7 @@ $wgSiteNotice = ''; # Images settings # -/** +/** * Plugins for media file type handling. * Each entry in the array maps a MIME type to a class name */ @@ -1826,11 +1826,11 @@ $wgThumbnailEpoch = '20030516000000'; $wgIgnoreImageErrors = false; /** - * Allow thumbnail rendering on page view. If this is false, a valid - * thumbnail URL is still output, but no file will be created at - * the target location. This may save some time if you have a - * thumb.php or 404 handler set up which is faster than the regular - * webserver(s). + * Allow thumbnail rendering on page view. If this is false, a valid + * thumbnail URL is still output, but no file will be created at + * the target location. This may save some time if you have a + * thumb.php or 404 handler set up which is faster than the regular + * webserver(s). */ $wgGenerateThumbnailOnParse = true; @@ -2004,7 +2004,7 @@ $wgTidyInternal = extension_loaded( 'tidy' ); $wgDebugTidy = false; /** - * Validate the overall output using tidy and refuse + * Validate the overall output using tidy and refuse * to display the page if it's not valid. */ $wgValidateAllHtml = false; @@ -2019,7 +2019,7 @@ $wgDefaultSkin = 'monobook'; * $wgDefaultUserOptions ['editsection'] = 0; * */ -$wgDefaultUserOptions = array( +$wgDefaultUserOptions = array( 'quickbar' => 1, 'underline' => 2, 'cols' => 80, @@ -2061,7 +2061,7 @@ $wgDefaultUserOptions = array( $wgAllowRealName = true; /***************************************************************************** - * Extensions + * Extensions */ /** @@ -2070,7 +2070,7 @@ $wgAllowRealName = true; $wgExtensionFunctions = array(); /** - * Extension functions for initialisation of skins. This is called somewhat earlier + * Extension functions for initialisation of skins. This is called somewhat earlier * than $wgExtensionFunctions. */ $wgSkinExtensionFunctions = array(); @@ -2081,7 +2081,7 @@ $wgSkinExtensionFunctions = array(); * The file must create a variable called $messages. * When the messages are needed, the extension should call wfLoadExtensionMessages(). * - * Example: + * Example: * $wgExtensionMessagesFiles['ConfirmEdit'] = dirname(__FILE__).'/ConfirmEdit.i18n.php'; * */ @@ -2094,7 +2094,7 @@ $wgExtensionMessagesFiles = array(); * These will be called as an OutputPageParserOutput hook, if the relevant * tag has been registered with the parser output object. * - * Registration is done with $pout->addOutputHook( $tag, $data ). + * Registration is done with $pout->addOutputHook( $tag, $data ). * * The callback has the form: * function outputHook( $outputPage, $parserOutput, $data ) { ... } @@ -2104,7 +2104,7 @@ $wgParserOutputHooks = array(); /** * List of valid skin names. * The key should be the name in all lower case, the value should be a display name. - * The default skins will be added later, by Skin::getSkinNames(). Use + * The default skins will be added later, by Skin::getSkinNames(). Use * Skin::getSkinNames() as an accessor if you wish to have access to the full list. */ $wgValidSkinNames = array(); @@ -2113,7 +2113,7 @@ $wgValidSkinNames = array(); * Special page list. * See the top of SpecialPage.php for documentation. */ -$wgSpecialPages = array(); +$wgSpecialPages = array(); /** * Array mapping class names to filenames, for autoloading. @@ -2223,14 +2223,14 @@ $wgExtraNamespaces = NULL; /** * Namespace aliases - * These are alternate names for the primary localised namespace names, which - * are defined by $wgExtraNamespaces and the language file. If a page is - * requested with such a prefix, the request will be redirected to the primary - * name. + * These are alternate names for the primary localised namespace names, which + * are defined by $wgExtraNamespaces and the language file. If a page is + * requested with such a prefix, the request will be redirected to the primary + * name. * * Set this to a map from namespace names to IDs. * Example: - * $wgNamespaceAliases = array( + * $wgNamespaceAliases = array( * 'Wikipedian' => NS_USER, * 'Help' => 100, * ); @@ -2294,16 +2294,16 @@ $wgBrowserBlackList = array( * Netscape 2-4 detection * The minor version may contain strings such as "Gold" or "SGoldC-SGI" * Lots of non-netscape user agents have "compatible", so it's useful to check for that - * with a negative assertion. The [UIN] identifier specifies the level of security - * in a Netscape/Mozilla browser, checking for it rules out a number of fakers. + * with a negative assertion. The [UIN] identifier specifies the level of security + * in a Netscape/Mozilla browser, checking for it rules out a number of fakers. * The language string is unreliable, it is missing on NS4 Mac. - * + * * Reference: http://www.psychedelix.com/agents/index.shtml */ '/^Mozilla\/2\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/', '/^Mozilla\/3\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/', '/^Mozilla\/4\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/', - + /** * MSIE on Mac OS 9 is teh sux0r, converts þ to , ð to , Þ to and Ð to * @@ -2317,7 +2317,7 @@ $wgBrowserBlackList = array( * @link http://en.wikipedia.org/wiki/Template%3AOS9 */ '/^Mozilla\/4\.0 \(compatible; MSIE \d+\.\d+; Mac_PowerPC\)/', - + /** * Google wireless transcoder, seems to eat a lot of chars alive * http://it.wikipedia.org/w/index.php?title=Luciano_Ligabue&diff=prev&oldid=8857361 @@ -2556,7 +2556,7 @@ $wgNamespaceRobotPolicies = array(); /** * Robot policies per article. * These override the per-namespace robot policies. - * Must be in the form of an array where the key part is a properly + * Must be in the form of an array where the key part is a properly * canonicalised text form title and the value is a robot policy. * Example: * $wgArticleRobotPolicies = array( 'Main Page' => 'noindex' ); @@ -2681,7 +2681,7 @@ $wgExternalServers = array(); * The place to put new revisions, false to put them in the local text table. * Part of a URL, e.g. DB://cluster1 * - * Can be an array instead of a single string, to enable data distribution. Keys + * Can be an array instead of a single string, to enable data distribution. Keys * must be consecutive integers, starting at zero. Example: * * $wgDefaultExternalStore = array( 'DB://cluster1', 'DB://cluster2' ); @@ -2775,14 +2775,14 @@ $wgUpdateRowsPerQuery = 10; $wgUseAjax = true; /** - * Enable auto suggestion for the search bar + * Enable auto suggestion for the search bar * Requires $wgUseAjax to be true too. * Causes wfSajaxSearch to be added to $wgAjaxExportList */ $wgAjaxSearch = false; /** - * List of Ajax-callable functions. + * List of Ajax-callable functions. * Extensions acting as Ajax callbacks must register here */ $wgAjaxExportList = array( ); @@ -2838,7 +2838,7 @@ $wgAllowTitlesInSVG = false; $wgContentNamespaces = array( NS_MAIN ); /** - * Maximum amount of virtual memory available to shell processes under linux, in KB. + * Maximum amount of virtual memory available to shell processes under linux, in KB. */ $wgMaxShellMemory = 102400; @@ -2865,7 +2865,7 @@ $wgDjvuRenderer = null; /** * Path of the djvutoxml executable - * This works like djvudump except much, much slower as of version 3.5. + * This works like djvudump except much, much slower as of version 3.5. * * For now I recommend you use djvudump instead. The djvuxml output is * probably more stable, so we'll switch back to it as soon as they fix @@ -2930,12 +2930,12 @@ $wgParserTestFiles = array( /** * Break out of framesets. This can be used to prevent external sites from - * framing your site with ads. + * framing your site with ads. */ $wgBreakFrames = false; /** - * Set this to an array of special page names to prevent + * Set this to an array of special page names to prevent * maintenance/updateSpecialPages.php from updating those pages. */ $wgDisableQueryPageUpdate = false; @@ -2951,7 +2951,7 @@ $wgEnableCascadingProtection = true; $wgDisableOutputCompression = false; /** - * If lag is higher than $wgSlaveLagWarning, show a warning in some special + * If lag is higher than $wgSlaveLagWarning, show a warning in some special * pages (like watchlist). If the lag is higher than $wgSlaveLagCritical, * show a more obvious warning. */ @@ -2967,16 +2967,16 @@ $wgSlaveLagCritical = 30; * don't have this module, you can use Preprocessor_Hash wich * has not this depedency. * It has no effect with Parser_OldPP parser class. - * - * - * The entire associative array will be passed through to the constructor as - * the first parameter. Note that only Setup.php can use this variable -- - * the configuration will change at runtime via $wgParser member functions, so - * the contents of this variable will be out-of-date. The variable can only be - * changed during LocalSettings.php, in particular, it can't be changed during - * an extension setup function. - */ -$wgParserConf = array( + * + * + * The entire associative array will be passed through to the constructor as + * the first parameter. Note that only Setup.php can use this variable -- + * the configuration will change at runtime via $wgParser member functions, so + * the contents of this variable will be out-of-date. The variable can only be + * changed during LocalSettings.php, in particular, it can't be changed during + * an extension setup function. + */ +$wgParserConf = array( 'class' => 'Parser', 'preprocessorClass' => 'Preprocessor_DOM', ); diff --git a/includes/Defines.php b/includes/Defines.php index 2d6aee5fed..9ef22cb717 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -188,15 +188,15 @@ define( 'RC_MOVE_OVER_REDIRECT', 4); */ define( 'EDIT_NEW', 1 ); define( 'EDIT_UPDATE', 2 ); -define( 'EDIT_MINOR', 4 ); +define( 'EDIT_MINOR', 4 ); define( 'EDIT_SUPPRESS_RC', 8 ); define( 'EDIT_FORCE_BOT', 16 ); define( 'EDIT_DEFER_UPDATES', 32 ); define( 'EDIT_AUTOSUMMARY', 64 ); /**#@-*/ -/** - * Flags for Database::makeList() +/** + * Flags for Database::makeList() * These are also available as Database class constants */ define( 'LIST_COMMA', 0 ); diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 37c73ecfdc..4e2ddd643f 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -113,7 +113,7 @@ CONTROL; wfProfileOut( __METHOD__ ); return; } - + wfRunHooks( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) ); if ( $this->mNewRev->isCurrent() ) { @@ -156,7 +156,7 @@ CONTROL; } else { $rollback = ''; } - + // Prepare a change patrol link, if applicable if( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) { // If we've been given an explicit change identifier, use it; saves time @@ -216,7 +216,7 @@ CONTROL; if ($this->mNewRev->mMinorEdit == 1) { $newminor = Xml::span( wfMsg( 'minoreditletter'), 'minor' ) . ' '; } - + $rdel = ''; $ldel = ''; if( $wgUser->isAllowed( 'deleterevision' ) ) { $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); @@ -236,10 +236,10 @@ CONTROL; // We don't currently handle well changing the top revision's settings if( $this->mNewRev->isCurrent() ) { // If revision was hidden from sysops - $rdel = wfMsgHtml('rev-delundel'); + $rdel = wfMsgHtml('rev-delundel'); } else if( !$this->mNewRev->userCan( Revision::DELETED_RESTRICTED ) ) { // If revision was hidden from sysops - $rdel = wfMsgHtml('rev-delundel'); + $rdel = wfMsgHtml('rev-delundel'); } else { $rdel = $sk->makeKnownLinkObj( $revdel, wfMsgHtml('rev-delundel'), @@ -380,14 +380,14 @@ CONTROL; return true; } } - + /** * Add style sheets and supporting JS for diff display. */ function showDiffStyle() { global $wgStylePath, $wgStyleVersion, $wgOut; $wgOut->addStyle( 'common/diff.css' ); - + // JS is needed to detect old versions of Mozilla to work around an annoyance bug. $wgOut->addScript( "" ); } @@ -447,7 +447,7 @@ CONTROL; } $difftext = $this->generateDiffBody( $this->mOldtext, $this->mNewtext ); - + // Save to cache for 7 days if ( $key !== false && $difftext !== false ) { wfIncrStats( 'diff_cache_miss' ); @@ -472,7 +472,7 @@ CONTROL; $otext = str_replace( "\r\n", "\n", $otext ); $ntext = str_replace( "\r\n", "\n", $ntext ); - + if ( $wgExternalDiffEngine == 'wikidiff' ) { # For historical reasons, external diff engine expects # input text to be HTML-escaped already @@ -483,7 +483,7 @@ CONTROL; } return $wgContLang->unsegementForDiff( wikidiff_do_diff( $otext, $ntext, 2 ) ); } - + if ( $wgExternalDiffEngine == 'wikidiff2' ) { # Better external diff engine, the 2 may some day be dropped # This one does the escaping and segmenting itself @@ -527,7 +527,7 @@ CONTROL; unlink( $tempName2 ); return $difftext; } - + # Native PHP diff $ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) ); $nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) ); @@ -535,7 +535,7 @@ CONTROL; $formatter = new TableDiffFormatter(); return $wgContLang->unsegmentForDiff( $formatter->format( $diffs ) ); } - + /** * Replace line numbers with the text in the user's language @@ -550,19 +550,19 @@ CONTROL; return wfMsgExt( 'lineno', array('parseinline'), $wgLang->formatNum( $matches[1] ) ); } - + /** * If there are revisions between the ones being compared, return a note saying so. */ function getMultiNotice() { if ( !is_object($this->mOldRev) || !is_object($this->mNewRev) ) return ''; - + if( !$this->mOldPage->equals( $this->mNewPage ) ) { // Comparing two different pages? Count would be meaningless. return ''; } - + $oldid = $this->mOldRev->getId(); $newid = $this->mNewRev->getId(); if ( $oldid > $newid ) { @@ -635,13 +635,13 @@ CONTROL; : Revision::newFromTitle( $this->mTitle ); if( !$this->mNewRev instanceof Revision ) return false; - + // Update the new revision ID in case it was 0 (makes life easier doing UI stuff) $this->mNewid = $this->mNewRev->getId(); // Check if page is editable $editable = $this->mNewRev->getTitle()->userCan( 'edit' ); - + // Set assorted variables $timestamp = $wgLang->timeanddate( $this->mNewRev->getTimestamp(), true ); $this->mNewPage = $this->mNewRev->getTitle(); @@ -694,14 +694,14 @@ CONTROL; $oldLink = $this->mOldPage->escapeLocalUrl( 'oldid=' . $this->mOldid ); $oldEdit = $this->mOldPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mOldid ); $this->mOldPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $t ) ); - + $this->mOldtitle = "{$this->mOldPagetitle}" . " (" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . ")"; // Add an "undo" link $newUndo = $this->mNewPage->escapeLocalUrl( 'action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid); if ( $editable && $this->mNewRev->userCan(Revision::DELETED_TEXT) ) $this->mNewtitle .= " (" . htmlspecialchars( wfMsg( 'editundo' ) ) . ")"; - + if ( !$this->mOldRev->userCan(Revision::DELETED_TEXT) ) { $this->mOldtitle = "{$this->mOldPagetitle}"; } else if ( $this->mOldRev->isDeleted(Revision::DELETED_TEXT) ) { @@ -1663,7 +1663,7 @@ class DiffFormatter { class UnifiedDiffFormatter extends DiffFormatter { var $leading_context_lines = 2; var $trailing_context_lines = 2; - + function _added($lines) { $this->_lines($lines, '+'); } @@ -1926,7 +1926,7 @@ class TableDiffFormatter extends DiffFormatter { function contextLine( $line ) { return $this->wrapLine( ' ', 'diff-context', $line ); } - + private function wrapLine( $marker, $class, $line ) { if( $line !== '' ) { // The
    wrapper is needed for 'overflow: auto' style to scroll properly @@ -1985,6 +1985,3 @@ class TableDiffFormatter extends DiffFormatter { wfProfileOut( __METHOD__ ); } } - - - diff --git a/includes/DjVuImage.php b/includes/DjVuImage.php index b48aaffdc0..5086f99f9d 100644 --- a/includes/DjVuImage.php +++ b/includes/DjVuImage.php @@ -35,7 +35,7 @@ class DjVuImage { function __construct( $filename ) { $this->mFilename = $filename; } - + /** * Check if the given file is indeed a valid DjVu image file * @return bool @@ -44,27 +44,27 @@ class DjVuImage { $info = $this->getInfo(); return $info !== false; } - - + + /** * Return data in the style of getimagesize() * @return array or false on failure */ public function getImageSize() { $data = $this->getInfo(); - + if( $data !== false ) { $width = $data['width']; $height = $data['height']; - + return array( $width, $height, 'DjVu', "width=\"$width\" height=\"$height\"" ); } return false; } - + // --------- - + /** * For debugging; dump the IFF chunk structure */ @@ -77,7 +77,7 @@ class DjVuImage { $this->dumpForm( $file, $chunkLength, 1 ); fclose( $file ); } - + private function dumpForm( $file, $length, $indent ) { $start = ftell( $file ); $secondary = fread( $file, 4 ); @@ -90,7 +90,7 @@ class DjVuImage { // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. extract( unpack( 'a4chunk/NchunkLength', $chunkHeader ) ); echo str_repeat( ' ', $indent * 4 ) . "$chunk $chunkLength\n"; - + if( $chunk == 'FORM' ) { $this->dumpForm( $file, $chunkLength, $indent + 1 ); } else { @@ -102,7 +102,7 @@ class DjVuImage { } } } - + function getInfo() { wfSuppressWarnings(); $file = fopen( $this->mFilename, 'rb' ); @@ -111,16 +111,16 @@ class DjVuImage { wfDebug( __METHOD__ . ": missing or failed file read\n" ); return false; } - + $header = fread( $file, 16 ); $info = false; - + if( strlen( $header ) < 16 ) { wfDebug( __METHOD__ . ": too short file header\n" ); } else { // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. extract( unpack( 'a4magic/a4form/NformLength/a4subtype', $header ) ); - + if( $magic != 'AT&T' ) { wfDebug( __METHOD__ . ": not a DjVu file\n" ); } elseif( $subtype == 'DJVU' ) { @@ -136,7 +136,7 @@ class DjVuImage { fclose( $file ); return $info; } - + private function readChunk( $file ) { $header = fread( $file, 8 ); if( strlen( $header ) < 8 ) { @@ -147,16 +147,16 @@ class DjVuImage { return array( $chunk, $length ); } } - + private function skipChunk( $file, $chunkLength ) { fseek( $file, $chunkLength, SEEK_CUR ); - + if( $chunkLength & 0x01 == 1 && !feof( $file ) ) { // padding byte fseek( $file, 1, SEEK_CUR ); } } - + private function getMultiPageInfo( $file, $formLength ) { // For now, we'll just look for the first page in the file // and report its information, hoping others are the same size. @@ -166,7 +166,7 @@ class DjVuImage { if( !$chunk ) { break; } - + if( $chunk == 'FORM' ) { $subtype = fread( $file, 4 ); if( $subtype == 'DJVU' ) { @@ -179,18 +179,18 @@ class DjVuImage { $this->skipChunk( $file, $length ); } } while( $length != 0 && !feof( $file ) && ftell( $file ) - $start < $formLength ); - + wfDebug( __METHOD__ . ": multi-page DJVU file contained no pages\n" ); return false; } - + private function getPageInfo( $file, $formLength ) { list( $chunk, $length ) = $this->readChunk( $file ); if( $chunk != 'INFO' ) { wfDebug( __METHOD__ . ": expected INFO chunk, got '$chunk'\n" ); return false; } - + if( $length < 9 ) { wfDebug( __METHOD__ . ": INFO should be 9 or 10 bytes, found $length\n" ); return false; @@ -200,7 +200,7 @@ class DjVuImage { wfDebug( __METHOD__ . ": INFO chunk cut off\n" ); return false; } - + // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. extract( unpack( 'nwidth/' . @@ -210,7 +210,7 @@ class DjVuImage { 'vresolution/' . 'Cgamma', $data ) ); # Newer files have rotation info in byte 10, but we don't use it yet. - + return array( 'width' => $width, 'height' => $height, @@ -320,14 +320,14 @@ EOT; } if ( preg_match( '/^ *INFO *\[\d*\] *DjVu *(\d+)x(\d+), *\w*, *(\d+) *dpi, *gamma=([0-9.-]+)/', $line, $m ) ) { - $xml .= Xml::tags( 'OBJECT', + $xml .= Xml::tags( 'OBJECT', array( #'data' => '', #'type' => 'image/x.djvu', 'height' => $m[2], 'width' => $m[1], #'usemap' => '', - ), + ), "\n" . Xml::element( 'PARAM', array( 'name' => 'DPI', 'value' => $m[3] ) ) . "\n" . Xml::element( 'PARAM', array( 'name' => 'GAMMA', 'value' => $m[4] ) ) . "\n" @@ -340,6 +340,3 @@ EOT; return false; } } - - -?> diff --git a/includes/EditPage.php b/includes/EditPage.php index cc4086ed81..3c0f2aeb15 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -77,10 +77,10 @@ class EditPage { public $editFormTextAfterWarn; public $editFormTextAfterTools; public $editFormTextBottom; - + /* $didSave should be set to true whenever an article was succesfully altered. */ public $didSave = false; - + public $suppressIntro = false; /** @@ -99,7 +99,7 @@ class EditPage { $this->editFormTextAfterTools = $this->editFormTextBottom = ""; } - + /** * Fetch initial editing page content. * @private @@ -119,7 +119,7 @@ class EditPage { if( !$this->mTitle->exists() ) { if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { $wgMessageCache->loadAllMessages(); - # If this is a system message, get the default text. + # If this is a system message, get the default text. $text = wfMsgWeirdKey ( $this->mTitle->getText() ) ; } else { # If requested, preload some text. @@ -319,11 +319,11 @@ class EditPage { $this->mArticle->mContent = $t ; $this->mMetaData = $s ; } - + protected function wasDeletedSinceLastEdit() { /* Note that we rely on the logging table, which hasn't been always there, * but that doesn't matter, because this only applies to brand new - * deletes. + * deletes. */ if ( $this->deletedSinceEdit ) return true; @@ -374,7 +374,7 @@ class EditPage { wfProfileOut( __METHOD__ ); return; } - + if( wfReadOnly() ) { $this->readOnlyPage( $this->getContent() ); wfProfileOut( __METHOD__ ); @@ -383,7 +383,7 @@ class EditPage { $permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser); if( !$this->mTitle->exists() ) { - $permErrors = array_merge( $permErrors, + $permErrors = array_merge( $permErrors, wfArrayDiff2( $this->mTitle->getUserPermissionsErrors('create', $wgUser), $permErrors ) ); } @@ -441,7 +441,7 @@ class EditPage { # Show applicable editing introductions if( $this->formtype == 'initial' || $this->firsttime ) $this->showIntro(); - + if( $this->mTitle->isTalkPage() ) { $wgOut->addWikiMsg( 'talkpagetext' ); } @@ -468,7 +468,7 @@ class EditPage { wfProfileOut( __METHOD__ ); return; } - if( !$this->mTitle->getArticleId() ) + if( !$this->mTitle->getArticleId() ) wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) ); } @@ -486,7 +486,7 @@ class EditPage { global $wgRequest, $wgOut; if ( $wgRequest->getBool( 'redlink' ) ) { // The edit page was reached via a red link. - // Redirect to the article page and let them click the edit tab if + // Redirect to the article page and let them click the edit tab if // they really want a permission error. $wgOut->redirect( $this->mTitle->getFullUrl() ); } else { @@ -542,7 +542,7 @@ class EditPage { $this->mMetaData = rtrim( $request->getText( 'metadata' ) ); # Truncate for whole multibyte characters. +5 bytes for ellipsis $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250 ); - + # Remove extra headings from summaries and new sections. $this->summary = preg_replace('/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->summary); @@ -602,7 +602,7 @@ class EditPage { $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ); } - $this->autoSumm = $request->getText( 'wpAutoSummary' ); + $this->autoSumm = $request->getText( 'wpAutoSummary' ); } else { # Not a posted form? Start with nothing. wfDebug( "$fname: Not a posted form.\n" ); @@ -664,7 +664,7 @@ class EditPage { $ip = User::isIP( $username ); if ( $id == 0 && !$ip ) { - $wgOut->wrapWikiMsg( '
    $1
    ', + $wgOut->wrapWikiMsg( '
    $1
    ', array( 'userpage-userdoesnotexist', $username ) ); } } @@ -832,7 +832,7 @@ class EditPage { } $isComment = ( $this->section == 'new' ); - + $this->mArticle->insertNewArticle( $this->textbox1, $this->summary, $this->minoredit, $this->watchthis, false, $isComment, $bot); @@ -1011,7 +1011,7 @@ class EditPage { */ function showEditForm( $formCallback=null ) { global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMaxArticleSize, $wgTitle; - + # If $wgTitle is null, that means we're in API mode. # Some hook probably called this function without checking # for is_null($wgTitle) first. Bail out right here so we don't @@ -1056,8 +1056,8 @@ class EditPage { $matches ); if( !empty( $matches[2] ) ) { global $wgParser; - $this->summary = "/* " . - $wgParser->stripSectionName(trim($matches[2])) . + $this->summary = "/* " . + $wgParser->stripSectionName(trim($matches[2])) . " */ "; } } @@ -1088,13 +1088,13 @@ class EditPage { } if ( isset( $this->mArticle ) && isset( $this->mArticle->mRevision ) ) { // Let sysop know that this will make private content public if saved - + if( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) { $wgOut->addWikiMsg( 'rev-deleted-text-permission' ); } else if( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) { $wgOut->addWikiMsg( 'rev-deleted-text-view' ); } - + if( !$this->mArticle->mRevision->isCurrent() ) { $this->mArticle->setOldSubtitle( $this->mArticle->mRevision->getId() ); $wgOut->addWikiMsg( 'editingold' ); @@ -1184,11 +1184,11 @@ class EditPage { global $wgRightsText; if ( $wgRightsText ) { - $copywarnMsg = array( 'copyrightwarning', + $copywarnMsg = array( 'copyrightwarning', '[[' . wfMsgForContent( 'copyrightpage' ) . ']]', $wgRightsText ); } else { - $copywarnMsg = array( 'copyrightwarning2', + $copywarnMsg = array( 'copyrightwarning2', '[[' . wfMsgForContent( 'copyrightpage' ) . ']]' ); } @@ -1237,7 +1237,7 @@ class EditPage { # if this is a comment, show a subject line at the top, which is also the edit summary. # Otherwise, show a summary field at the bottom $summarytext = htmlspecialchars( $wgContLang->recodeForEdit( $this->summary ) ); # FIXME - + # If a blank edit summary was previously provided, and the appropriate # user preference is active, pass a hidden tag as wpIgnoreBlankSummary. This will stop the # user being bounced back more than once in the event that a summary @@ -1574,13 +1574,13 @@ END $previewHTML = $parserOutput->getText(); $wgOut->addParserOutputNoText( $parserOutput ); - + # ParserOutput might have altered the page title, so reset it # Also, use the title defined by DISPLAYTITLE magic word when present if( ( $dt = $parserOutput->getDisplayTitle() ) !== false ) { $wgOut->setPageTitle( wfMsg( 'editing', $dt ) ); } else { - $wgOut->setPageTitle( wfMsg( 'editing', $wgTitle->getPrefixedText() ) ); + $wgOut->setPageTitle( wfMsg( 'editing', $wgTitle->getPrefixedText() ) ); } foreach ( $parserOutput->getTemplates() as $ns => $template) @@ -1597,7 +1597,7 @@ END if ( $this->isConflict ) { $previewhead.='

    ' . htmlspecialchars( wfMsg( 'previewconflict' ) ) . "

    \n"; } - + if( $wgUser->getOption( 'previewontop' ) ) { // Spacer for the edit toolbar $previewfoot = '


    '; @@ -1895,7 +1895,7 @@ END $sample = $tool['sample'], $cssId = $tool['id'], ); - + $paramList = implode( ',', array_map( array( 'Xml', 'encodeJsVar' ), $params ) ); $toolbar.="addButton($paramList);\n"; @@ -2023,7 +2023,7 @@ END 'title' => wfMsg( 'tooltip-diff' ).' ['.wfMsg( 'accesskey-diff' ).']', ); $buttons['diff'] = wfElement('input', $temp, ''); - + wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons ) ); return $buttons; } @@ -2206,7 +2206,7 @@ END $wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) ); $wgOut->addWikiMsg( 'nocreatetext' ); } - + /** * If there are rows in the deletion log for this page, show them, * along with a nice little note for the user @@ -2238,7 +2238,7 @@ END $resultDetails = false; $value = $this->internalAttemptSave( $resultDetails, $wgUser->isAllowed('bot') && $wgRequest->getBool('bot', true) ); - + if( $value == self::AS_SUCCESS_UPDATE || $value == self::AS_SUCCESS_NEW_ARTICLE ) { $this->didSave = true; } @@ -2288,7 +2288,7 @@ END case self::AS_NO_CREATE_PERMISSION; $this->noCreatePermission(); return; - + case self::AS_BLANK_ARTICLE: $wgOut->redirect( $wgTitle->getFullURL() ); return false; diff --git a/includes/EmaillingJob.php b/includes/EmaillingJob.php index 73d71c5627..11620bcdb7 100644 --- a/includes/EmaillingJob.php +++ b/includes/EmaillingJob.php @@ -20,6 +20,5 @@ class EmaillingJob extends Job { ); return true; } - -} +} diff --git a/includes/EnotifNotifyJob.php b/includes/EnotifNotifyJob.php index 70d1de694b..857cd40cb1 100644 --- a/includes/EnotifNotifyJob.php +++ b/includes/EnotifNotifyJob.php @@ -21,6 +21,5 @@ class EnotifNotifyJob extends Job { ); return true; } - -} +} diff --git a/includes/Exception.php b/includes/Exception.php index 742a8de829..7b7254ffd0 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -11,7 +11,7 @@ class MWException extends Exception { * @return bool */ function useOutputPage() { - return !empty( $GLOBALS['wgFullyInitialised'] ) && + return !empty( $GLOBALS['wgFullyInitialised'] ) && !empty( $GLOBALS['wgArticle'] ) && !empty( $GLOBALS['wgTitle'] ); } @@ -33,7 +33,7 @@ class MWException extends Exception { */ function runHooks( $name, $args = array() ) { global $wgExceptionHooks; - if( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) + if( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) return; // Just silently ignore if( !array_key_exists( $name, $wgExceptionHooks ) || !is_array( $wgExceptionHooks[ $name ] ) ) return; @@ -70,7 +70,7 @@ class MWException extends Exception { } /** - * If $wgShowExceptionDetails is true, return a HTML message with a + * If $wgShowExceptionDetails is true, return a HTML message with a * backtrace to the error, otherwise show a message to ask to set it to true * to show that information. * @@ -79,7 +79,7 @@ class MWException extends Exception { function getHTML() { global $wgShowExceptionDetails; if( $wgShowExceptionDetails ) { - return '

    ' . htmlspecialchars( $this->getMessage() ) . + return '

    ' . htmlspecialchars( $this->getMessage() ) . '

    Backtrace:

    ' . nl2br( htmlspecialchars( $this->getTraceAsString() ) ) . "

    \n"; } else { @@ -90,7 +90,7 @@ class MWException extends Exception { } /** - * If $wgShowExceptionDetails is true, return a text message with a + * If $wgShowExceptionDetails is true, return a text message with a * backtrace to the error. */ function getText() { @@ -223,7 +223,7 @@ class FatalError extends MWException { */ class ErrorPageError extends MWException { public $title, $msg; - + /** * Note: these arguments are keys into wfMsg(), not text! */ @@ -299,5 +299,3 @@ function wfExceptionHandler( $e ) { // Exit value should be nonzero for the benefit of shell jobs exit( 1 ); } - - diff --git a/includes/Exif.php b/includes/Exif.php index d98a8e0d01..b5eeb5c16c 100644 --- a/includes/Exif.php +++ b/includes/Exif.php @@ -431,7 +431,7 @@ class Exif { if ( is_array( $in ) ) { return false; } - + if ( preg_match( "/[^\x0a\x20-\x7e]/", $in ) ) { $this->debug( $in, __FUNCTION__, 'found a character not in our whitelist' ); return false; @@ -557,8 +557,8 @@ class Exif { * * @private * - * @param $in Mixed: - * @param $fname String: + * @param $in Mixed: + * @param $fname String: * @param $action Mixed: , default NULL. */ function debug( $in, $fname, $action = NULL ) { @@ -1130,5 +1130,3 @@ define( 'MW_EXIF_RATIONAL', Exif::RATIONAL ); define( 'MW_EXIF_UNDEFINED', Exif::UNDEFINED ); define( 'MW_EXIF_SLONG', Exif::SLONG ); define( 'MW_EXIF_SRATIONAL', Exif::SRATIONAL ); - - diff --git a/includes/Export.php b/includes/Export.php index 5605b660d3..76277e1ed7 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -25,7 +25,7 @@ class WikiExporter { var $list_authors = false ; # Return distinct author list (when not returning full history) var $author_list = "" ; - + var $dumpUploads = false; const FULL = 0; @@ -143,18 +143,18 @@ class WikiExporter { $this->author_list = ""; //rev_deleted $nothidden = '(rev_deleted & '.Revision::DELETED_USER.') = 0'; - + $sql = "SELECT DISTINCT rev_user_text,rev_user FROM {$page},{$revision} WHERE page_id=rev_page AND $nothidden AND " . $cond ; $result = $this->db->query( $sql, $fname ); $resultset = $this->db->resultObject( $result ); while( $row = $resultset->fetchObject() ) { - $this->author_list .= "" . - "" . - htmlentities( $row->rev_user_text ) . - "" . - "" . + $this->author_list .= "" . + "" . + htmlentities( $row->rev_user_text ) . + "" . + "" . $row->rev_user . - "" . + "" . ""; } wfProfileOut( $fname ); @@ -463,12 +463,12 @@ class XmlDumpWriter { wfProfileOut( $fname ); return $out; } - + function writeTimestamp( $timestamp ) { $ts = wfTimestamp( TS_ISO_8601, $timestamp ); return " " . wfElement( 'timestamp', null, $ts ) . "\n"; } - + function writeContributor( $id, $text ) { $out = " \n"; if( $id ) { @@ -480,7 +480,7 @@ class XmlDumpWriter { $out .= " \n"; return $out; } - + /** * Warning! This data is potentially inconsistent. :( */ @@ -498,7 +498,7 @@ class XmlDumpWriter { } return ''; } - + function writeUpload( $file ) { return " \n" . $this->writeTimestamp( $file->getTimestamp() ) . @@ -815,5 +815,3 @@ function xmlsafe( $string ) { wfProfileOut( $fname ); return $string; } - - diff --git a/includes/ExternalEdit.php b/includes/ExternalEdit.php index f5ce5b9d0d..c11e9b732a 100644 --- a/includes/ExternalEdit.php +++ b/includes/ExternalEdit.php @@ -68,4 +68,3 @@ CONTROL; echo $control; } } - diff --git a/includes/ExternalStore.php b/includes/ExternalStore.php index 79937b8535..51f4cdd4c2 100644 --- a/includes/ExternalStore.php +++ b/includes/ExternalStore.php @@ -62,4 +62,3 @@ class ExternalStore { } } } - diff --git a/includes/ExternalStoreDB.php b/includes/ExternalStoreDB.php index ab9cc8db90..ea7c40b18c 100644 --- a/includes/ExternalStoreDB.php +++ b/includes/ExternalStoreDB.php @@ -139,4 +139,3 @@ class ExternalStoreDB { return "DB://$cluster/$id"; } } - diff --git a/includes/ExternalStoreHttp.php b/includes/ExternalStoreHttp.php index ef907df562..ef95f1fc01 100644 --- a/includes/ExternalStoreHttp.php +++ b/includes/ExternalStoreHttp.php @@ -19,4 +19,3 @@ class ExternalStoreHttp { * whatever, for initial ext storage */ } - diff --git a/includes/FakeTitle.php b/includes/FakeTitle.php index b63ae50552..4c2eddc8c4 100644 --- a/includes/FakeTitle.php +++ b/includes/FakeTitle.php @@ -83,5 +83,3 @@ class FakeTitle { function trackbackURL() { $this->error(); } function trackbackRDF() { $this->error(); } } - - diff --git a/includes/Feed.php b/includes/Feed.php index 309b29bda9..512057d937 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -300,5 +300,3 @@ class AtomFeed extends ChannelFeed { diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index 3824d10653..f63b1c96b9 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -13,7 +13,7 @@ class FileDeleteForm { private $oldfile = null; private $oldimage = ''; - + /** * Constructor * @@ -23,7 +23,7 @@ class FileDeleteForm { $this->title = $file->getTitle(); $this->file = $file; } - + /** * Fulfil the request; shows the form or deletes the file, * pending authentication, confirmation, etc. @@ -35,31 +35,31 @@ class FileDeleteForm { if( wfReadOnly() ) { $wgOut->readOnlyPage(); return; - } + } $permission_errors = $this->title->getUserPermissionsErrors('delete', $wgUser); if (count($permission_errors)>0) { $wgOut->showPermissionsErrorPage( $permission_errors ); return; } - + $this->oldimage = $wgRequest->getText( 'oldimage', false ); $token = $wgRequest->getText( 'wpEditToken' ); # Flag to hide all contents of the archived revisions $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed('deleterevision'); - + if( $this->oldimage && !self::isValidOldSpec($this->oldimage) ) { $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars( $this->oldimage ) ); return; } if( $this->oldimage ) $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage ); - + if( !self::haveDeletableFile($this->file, $this->oldfile, $this->oldimage) ) { $wgOut->addHtml( $this->prepareMessage( 'filedelete-nofile' ) ); $wgOut->addReturnTo( $this->title ); return; } - + // Perform the deletion if appropriate if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) { $this->DeleteReasonList = $wgRequest->getText( 'wpDeleteReasonList' ); @@ -71,9 +71,9 @@ class FileDeleteForm { } elseif ( $reason == 'other' ) { $reason = $this->DeleteReason; } - + $status = self::doDelete( $this->title, $this->file, $this->oldimage, $reason, $suppress ); - + if( !$status->isGood() ) $wgOut->addWikiText( $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) ); if( $status->ok ) { @@ -85,11 +85,11 @@ class FileDeleteForm { } return; } - + $this->showForm(); $this->showLogEntries(); } - + public static function doDelete( &$title, &$file, &$oldimage, $reason, $suppress ) { $article = null; if( $oldimage ) { @@ -106,16 +106,16 @@ class FileDeleteForm { $status = $file->delete( $reason, $suppress ); if( $status->ok ) { // Need to delete the associated article - $article = new Article( $title ); - if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)) ) { + $article = new Article( $title ); + if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)) ) { if( $article->doDeleteArticle( $reason, $suppress ) ) wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason)); } } } - if( $status->isGood() ) wfRunHooks('FileDeleteComplete', array( + if( $status->isGood() ) wfRunHooks('FileDeleteComplete', array( &$file, &$oldimage, &$article, &$wgUser, &$reason)); - + return $status; } @@ -146,7 +146,7 @@ class FileDeleteForm { "
  • " . Xml::listDropDown( 'wpDeleteReasonList', - wfMsgForContent( 'filedelete-reason-dropdown' ), + wfMsgForContent( 'filedelete-reason-dropdown' ), wfMsgForContent( 'filedelete-reason-otherlist' ), '', 'wpReasonDropDown', 1 ) . "
    \n"; $fields = $this->getFieldNames(); @@ -634,7 +634,7 @@ abstract class TablePager extends IndexPager { $alt = htmlspecialchars( wfMsg( 'ascending_abbrev' ) ); } $image = htmlspecialchars( "$wgStylePath/common/images/$image" ); - $link = $this->makeLink( + $link = $this->makeLink( "\"$alt\"" . htmlspecialchars( $name ), $query ); $s .= "\n"; @@ -646,7 +646,7 @@ abstract class TablePager extends IndexPager { } } $s .= "\n"; - return $s; + return $s; } function getEndBody() { @@ -752,8 +752,8 @@ abstract class TablePager extends IndexPager { } /** - * Get elements for use in a method="get" form. - * Resubmits all defined elements of the $_GET array, except for a + * Get elements for use in a method="get" form. + * Resubmits all defined elements of the $_GET array, except for a * blacklist, passed in the $blacklist parameter. */ function getHiddenFields( $blacklist = array() ) { @@ -779,10 +779,10 @@ abstract class TablePager extends IndexPager { $url = $this->getTitle()->escapeLocalURL(); $msgSubmit = wfMsgHtml( 'table_pager_limit_submit' ); return - "" . - wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) . + "" . + wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) . "\n\n" . - $this->getHiddenFields( 'limit' ) . + $this->getHiddenFields( 'limit' ) . "\n"; } @@ -796,7 +796,7 @@ abstract class TablePager extends IndexPager { /** * Format a table cell. The return value should be HTML, but use an empty - * string not   for empty cells. Do not include the . + * string not   for empty cells. Do not include the . * * The current result row is available as $this->mCurrentRow, in case you * need more context. diff --git a/includes/Parser.php b/includes/Parser.php index 97e4630376..3e2c80aad3 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -9,7 +9,7 @@ /** - * PHP Parser - Processes wiki markup (which uses a more user-friendly + * PHP Parser - Processes wiki markup (which uses a more user-friendly * syntax, such as "[[link]]" for making links), and provides a one-way * transformation of that wiki markup it into XHTML output / markup * (which in turn the browser understands, and can display). @@ -139,7 +139,7 @@ class Parser $this->mMarkerIndex = 0; $this->mFirstCall = true; } - + /** * Do various kinds of initialisation on the first call of the parser */ @@ -148,7 +148,7 @@ class Parser return; } $this->mFirstCall = false; - + wfProfileIn( __METHOD__ ); $this->setHook( 'pre', array( $this, 'renderPreTag' ) ); @@ -197,7 +197,7 @@ class Parser * since it shouldn't match when butted up against identifier-like * string constructs. * - * Must not consist of all title characters, or else it will change + * Must not consist of all title characters, or else it will change * the behaviour of in a link. */ #$this->mUniqPrefix = "\x07UNIQ" . Parser::getRandomString(); @@ -411,8 +411,8 @@ class Parser global $wgExpensiveParserFunctionLimit; $max = $this->mOptions->getMaxIncludeSize(); $PFreport = "Expensive parser function count: {$this->mExpensiveFunctionCount}/$wgExpensiveParserFunctionLimit\n"; - $limitReport = - "NewPP limit report\n" . + $limitReport = + "NewPP limit report\n" . "Preprocessor node count: {$this->mPPNodeCount}/{$this->mOptions->mMaxPPNodeCount}\n" . "Post-expand include size: {$this->mIncludeSizes['post-expand']}/$max bytes\n" . "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n". @@ -722,7 +722,7 @@ class Parser /** * Use the HTML tidy PECL extension to use the tidy library in-process, - * saving the overhead of spawning a new process. + * saving the overhead of spawning a new process. * * 'pear install tidy' should be able to compile the extension module. * @@ -745,8 +745,8 @@ class Parser $cleansource = tidy_get_output( $tidy ); } if ( $wgDebugTidy && $tidy->getStatus() > 0 ) { - $cleansource .= "', '-->', $tidy->errorBuffer ) . + $cleansource .= "', '-->', $tidy->errorBuffer ) . "\n-->"; } @@ -796,7 +796,7 @@ class Parser } else if ( count ( $td_history ) == 0 ) { // Don't do any of the following continue; - } else if ( substr ( $line , 0 , 2 ) == '|}' ) { + } else if ( substr ( $line , 0 , 2 ) == '|}' ) { // We are ending a table $line = '
    $link
    and and
    ' . substr ( $line , 2 ); $last_tag = array_pop ( $last_tag_history ); @@ -2381,7 +2381,7 @@ class Parser $oldtz = getenv( 'TZ' ); putenv( 'TZ='.$wgLocaltimezone ); } - + wfSuppressWarnings(); // E_STRICT system time bitching $localTimestamp = date( 'YmdHis', $ts ); $localMonth = date( 'm', $ts ); @@ -2590,22 +2590,22 @@ class Parser /** * Preprocess some wikitext and return the document tree. - * This is the ghost of replace_variables(). + * This is the ghost of replace_variables(). * * @param string $text The text to parse * @param integer flags Bitwise combination of: - * self::PTD_FOR_INCLUSION Handle / as if the text is being - * included. Default is to assume a direct page view. + * self::PTD_FOR_INCLUSION Handle / as if the text is being + * included. Default is to assume a direct page view. * * The generated DOM tree must depend only on the input text and the flags. - * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. + * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. * - * Any flag added to the $flags parameter here, or any other parameter liable to cause a - * change in the DOM tree for a given text, must be passed through the section identifier - * in the section edit link and thus back to extractSections(). + * Any flag added to the $flags parameter here, or any other parameter liable to cause a + * change in the DOM tree for a given text, must be passed through the section identifier + * in the section edit link and thus back to extractSections(). * - * The output of this function is currently only cached in process memory, but a persistent - * cache may be implemented at a later date which takes further advantage of these strict + * The output of this function is currently only cached in process memory, but a persistent + * cache may be implemented at a later date which takes further advantage of these strict * dependency requirements. * * @private @@ -2615,7 +2615,7 @@ class Parser return $dom; } - /* + /* * Return a three-element array: leading whitespace, string contents, trailing whitespace */ public static function splitWhitespace( $s ) { @@ -2721,8 +2721,8 @@ class Parser # Title object, where $text came from $title = NULL; - # $part1 is the bit before the first |, and must contain only title characters. - # Various prefixes will be stripped from it later. + # $part1 is the bit before the first |, and must contain only title characters. + # Various prefixes will be stripped from it later. $titleWithSpaces = $frame->expand( $piece['title'] ); $part1 = trim( $titleWithSpaces ); $titleText = false; @@ -2967,10 +2967,10 @@ class Parser elseif ( is_string( $text ) && !$piece['lineStart'] && preg_match('/^(?:{\\||:|;|#|\*)/', $text)) /*}*/{ $text = "\n" . $text; } - + if ( is_string( $text ) && !$this->incrementIncludeSize( 'post-expand', strlen( $text ) ) ) { # Error, oversize inclusion - $text = "[[$originalTitle]]" . + $text = "[[$originalTitle]]" . $this->insertStripItem( '' ); } @@ -2991,7 +2991,7 @@ class Parser function getTemplateDom( $title ) { $cacheTitle = $title; $titleText = $title->getPrefixedDBkey(); - + if ( isset( $this->mTplRedirCache[$titleText] ) ) { list( $ns, $dbk ) = $this->mTplRedirCache[$titleText]; $title = Title::makeTitle( $ns, $dbk ); @@ -3013,7 +3013,7 @@ class Parser $this->mTplDomCache[ $titleText ] = $dom; if (! $title->equals($cacheTitle)) { - $this->mTplRedirCache[$cacheTitle->getPrefixedDBkey()] = + $this->mTplRedirCache[$cacheTitle->getPrefixedDBkey()] = array( $title->getNamespace(),$cdb = $title->getDBkey() ); } @@ -3049,13 +3049,13 @@ class Parser $text = $skip = false; $finalTitle = $title; $deps = array(); - + // Loop to fetch the article, with up to 1 redirect for ( $i = 0; $i < 2 && is_object( $title ); $i++ ) { # Give extensions a chance to select the revision instead $id = false; // Assume current wfRunHooks( 'BeforeParserFetchTemplateAndtitle', array( false, &$title, &$skip, &$id ) ); - + if( $skip ) { $text = false; $deps[] = array( @@ -3067,9 +3067,9 @@ class Parser $rev = $id ? Revision::newFromId( $id ) : Revision::newFromTitle( $title ); $rev_id = $rev ? $rev->getId() : 0; - $deps[] = array( - 'title' => $title, - 'page_id' => $title->getArticleID(), + $deps[] = array( + 'title' => $title, + 'page_id' => $title->getArticleID(), 'rev_id' => $rev_id ); if( $rev ) { @@ -3153,10 +3153,10 @@ class Parser $argName = trim( $nameWithSpaces ); $object = false; $text = $frame->getArgument( $argName ); - if ( $text === false && $parts->getLength() > 0 - && ( - $this->ot['html'] - || $this->ot['pre'] + if ( $text === false && $parts->getLength() > 0 + && ( + $this->ot['html'] + || $this->ot['pre'] || ( $this->ot['wiki'] && $frame->isTemplate() ) ) ) { @@ -3204,7 +3204,7 @@ class Parser $content = !isset( $params['inner'] ) ? null : $frame->expand( $params['inner'] ); $marker = "{$this->mUniqPrefix}-$name-" . sprintf('%08X', $this->mMarkerIndex++) . self::MARKER_SUFFIX; - + if ( $this->ot['html'] ) { $name = strtolower( $name ); @@ -3542,7 +3542,7 @@ class Parser # give headline the correct tag if( $showEditLink && $sectionIndex !== false ) { if( $isTemplate ) { - # Put a T flag in the section identifier, to indicate to extractSections() + # Put a T flag in the section identifier, to indicate to extractSections() # that sections inside should be counted. $editlink = $sk->editSectionLinkForOther($titleText, "T-$sectionIndex"); } else { @@ -3562,7 +3562,7 @@ class Parser if( $numVisible < 1 ) { $enoughToc = false; } - + if( $enoughToc ) { if( $prevtoclevel > 0 && $prevtoclevel < $wgMaxTocLevel ) { $toc .= $sk->tocUnindent( $prevtoclevel - 1 ); @@ -3711,11 +3711,11 @@ class Parser */ function getUserSig( &$user ) { global $wgMaxSigChars; - + $username = $user->getName(); $nickname = $user->getOption( 'nickname' ); $nickname = $nickname === '' ? $username : $nickname; - + if( mb_strlen( $nickname ) > $wgMaxSigChars ) { $nickname = $username; wfDebug( __METHOD__ . ": $username has overlong signature.\n" ); @@ -4300,7 +4300,7 @@ class Parser if( isset( $params['heights'] ) ) { $ig->setHeights( $params['heights'] ); } - + wfRunHooks( 'BeforeParserrenderImageGallery', array( &$this, &$ig ) ); $lines = explode( "\n", $text ); @@ -4347,9 +4347,9 @@ class Parser // Initialise static lists static $internalParamNames = array( 'horizAlign' => array( 'left', 'right', 'center', 'none' ), - 'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle', + 'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle', 'bottom', 'text-bottom' ), - 'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless', + 'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless', 'upright', 'border' ), ); static $internalParamMap; @@ -4402,7 +4402,7 @@ class Parser # * middle # * bottom # * text-bottom - + $parts = array_map( 'trim', explode( '|', $options) ); $sk = $this->mOptions->getSkin(); @@ -4422,7 +4422,7 @@ class Parser # Process the input parameters $caption = ''; - $params = array( 'frame' => array(), 'handler' => array(), + $params = array( 'frame' => array(), 'handler' => array(), 'horizAlign' => array(), 'vertAlign' => array() ); foreach( $parts as $part ) { list( $magicName, $value ) = $mwArray->matchVariableStartToEnd( $part ); @@ -4565,13 +4565,13 @@ class Parser * - - ... -
    * * Currently the only recognised flag is "T", which means the target section number - * was derived during a template inclusion parse, in other words this is a template - * section edit link. If no flags are given, it was an ordinary section edit link. - * This flag is required to avoid a section numbering mismatch when a section is + * was derived during a template inclusion parse, in other words this is a template + * section edit link. If no flags are given, it was an ordinary section edit link. + * This flag is required to avoid a section numbering mismatch when a section is * enclosed by (bug 6563). * - * The section number 0 pulls the text before the first heading; other numbers will - * pull the given section along with its lower-level subsections. If the section is + * The section number 0 pulls the text before the first heading; other numbers will + * pull the given section along with its lower-level subsections. If the section is * not found, $mode=get will return $newtext, and $mode=replace will return $text. * * @param string $mode One of "get" or "replace" @@ -4647,11 +4647,11 @@ class Parser } $node = $node->getNextSibling(); } while ( $node ); - + // Write out the remainder (in replace mode only) if ( $mode == 'replace' ) { // Output the replacement text - // Add two newlines on -- trailing whitespace in $newText is conventionally + // Add two newlines on -- trailing whitespace in $newText is conventionally // stripped by the editor, so we need both newlines to restore the paragraph gap $outText .= $newText . "\n\n"; while ( $node ) { @@ -4745,8 +4745,8 @@ class Parser } /** - * Try to guess the section anchor name based on a wikitext fragment - * presumably extracted from a heading, for example "Header" from + * Try to guess the section anchor name based on a wikitext fragment + * presumably extracted from a heading, for example "Header" from * "== Header ==". */ public function guessSectionNameFromWikiText( $text ) { @@ -4769,14 +4769,14 @@ class Parser /** * Strips a text string of wikitext for use in a section anchor - * + * * Accepts a text string and then removes all wikitext from the * string and leaves only the resultant text (i.e. the result of * [[User:WikiSysop|Sysop]] would be "Sysop" and the result of * [[User:WikiSysop]] would be "User:WikiSysop") - this is intended * to create valid section anchors by mimicing the output of the * parser when headings are parsed. - * + * * @param $text string Text string to be stripped of wikitext * for use in a Section anchor * @return Filtered text string @@ -4785,15 +4785,15 @@ class Parser # Strip internal link markup $text = preg_replace('/\[\[:?([^[|]+)\|([^[]+)\]\]/','$2',$text); $text = preg_replace('/\[\[:?([^[]+)\|?\]\]/','$1',$text); - + # Strip external link markup (FIXME: Not Tolerant to blank link text # I.E. [http://www.mediawiki.org] will render as [1] or something depending # on how many empty links there are on the page - need to figure that out. $text = preg_replace('/\[(?:' . wfUrlProtocols() . ')([^ ]+?) ([^[]+)\]/','$2',$text); - + # Parse wikitext quotes (italics & bold) $text = $this->doQuotes($text); - + # Strip HTML tags $text = StringUtils::delimiterReplace( '<', '>', '', $text ); return $text; @@ -4911,7 +4911,7 @@ class StripState { class OnlyIncludeReplacer { var $output = ''; - function replace( $matches ) { + function replace( $matches ) { if ( substr( $matches[1], -1 ) == "\n" ) { $this->output .= substr( $matches[1], 0, -1 ); } else { @@ -4919,4 +4919,3 @@ class OnlyIncludeReplacer { } } } - diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 129b713213..b3ac519851 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -115,5 +115,3 @@ class ParserCache { } } - - diff --git a/includes/ParserOptions.php b/includes/ParserOptions.php index a9c031a4d5..dbb0925fae 100644 --- a/includes/ParserOptions.php +++ b/includes/ParserOptions.php @@ -64,11 +64,11 @@ class ParserOptions return $this->mDateFormat; } - function getTimestamp() { + function getTimestamp() { if ( !isset( $this->mTimestamp ) ) { $this->mTimestamp = wfTimestampNow(); } - return $this->mTimestamp; + return $this->mTimestamp; } function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); } @@ -147,5 +147,3 @@ class ParserOptions wfProfileOut( $fname ); } } - - diff --git a/includes/ParserOutput.php b/includes/ParserOutput.php index bed56836e1..7117f71eb2 100644 --- a/includes/ParserOutput.php +++ b/includes/ParserOutput.php @@ -84,7 +84,7 @@ class ParserOutput function addExternalLink( $url ) { $this->mExternalLinks[$url] = 1; } function addWarning( $s ) { $this->mWarnings[] = $s; } - function addOutputHook( $hook, $data = false ) { + function addOutputHook( $hook, $data = false ) { $this->mOutputHooks[] = array( $hook, $data ); } @@ -106,7 +106,7 @@ class ParserOutput } $this->mLinks[$ns][$dbk] = $id; } - + function addImage( $name ) { $this->mImages[$name] = 1; } @@ -143,8 +143,8 @@ class ParserOutput } /** - * Add some text to the . - * If $tag is set, the section with that tag will only be included once + * Add some text to the . + * If $tag is set, the section with that tag will only be included once * in a given page. */ function addHeadItem( $section, $tag = false ) { @@ -154,7 +154,7 @@ class ParserOutput $this->mHeadItems[] = $section; } } - + /** * Override the title to be used for display * -- this is assumed to have been validated @@ -165,7 +165,7 @@ class ParserOutput public function setDisplayTitle( $text ) { $this->displayTitle = $text; } - + /** * Get the title to be used for display * @@ -174,14 +174,14 @@ class ParserOutput public function getDisplayTitle() { return $this->displayTitle; } - + /** * Fairly generic flag setter thingy. */ public function setFlag( $flag ) { $this->mFlags[$flag] = true; } - + public function getFlag( $flag ) { return isset( $this->mFlags[$flag] ); } @@ -193,7 +193,7 @@ class ParserOutput $this->mProperties[$name] = $value; } - public function getProperty( $name ){ + public function getProperty( $name ){ return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false; } @@ -204,5 +204,3 @@ class ParserOutput return $this->mProperties; } } - - diff --git a/includes/Parser_DiffTest.php b/includes/Parser_DiffTest.php index d88709f012..863eb25cc2 100644 --- a/includes/Parser_DiffTest.php +++ b/includes/Parser_DiffTest.php @@ -63,7 +63,7 @@ class Parser_DiffTest } if ( $mismatch ) { throw new MWException( "Parser_DiffTest: results mismatch on call to $name\n" . - 'Arguments: ' . var_export( $args, true ) . "\n" . + 'Arguments: ' . var_export( $args, true ) . "\n" . 'Results: ' . var_export( $results, true ) . "\n" ); } return $lastResult; @@ -82,4 +82,3 @@ class Parser_DiffTest return true; } } - diff --git a/includes/Parser_OldPP.php b/includes/Parser_OldPP.php index 92a7e18139..7c337232a5 100644 --- a/includes/Parser_OldPP.php +++ b/includes/Parser_OldPP.php @@ -43,7 +43,7 @@ class Parser_OldPP # Persistent: var $mTagHooks, $mTransparentTagHooks, $mFunctionHooks, $mFunctionSynonyms, $mVariables, $mImageParams, $mImageParamsMagicArray, $mExtLinkBracketedRegex; - + # Cleared with clearState(): var $mOutput, $mAutonumber, $mDTopen, $mStripState; var $mIncludeCount, $mArgStack, $mLastSection, $mInPre; @@ -80,7 +80,7 @@ class Parser_OldPP $this->mExtLinkBracketedRegex = '/\[(\b(' . wfUrlProtocols() . ')'. '[^][<>"\\x00-\\x20\\x7F]+) *([^\]\\x0a\\x0d]*?)\]/S'; } - + /** * Do various kinds of initialisation on the first call of the parser */ @@ -89,12 +89,12 @@ class Parser_OldPP return; } $this->mFirstCall = false; - + wfProfileIn( __METHOD__ ); global $wgAllowDisplayTitle, $wgAllowSlowParserFunctions; - + $this->setHook( 'pre', array( $this, 'renderPreTag' ) ); - + # Syntax for arguments (see self::setFunctionHook): # "name for lookup in localized magic words array", # function callback, @@ -342,7 +342,7 @@ class Parser_OldPP # Information on include size limits, for the benefit of users who try to skirt them if ( $this->mOptions->getEnableLimitReport() ) { $max = $this->mOptions->getMaxIncludeSize(); - $limitReport = + $limitReport = "Pre-expand include size: {$this->mIncludeSizes['pre-expand']}/$max bytes\n" . "Post-expand include size: {$this->mIncludeSizes['post-expand']}/$max bytes\n" . "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n"; @@ -600,7 +600,7 @@ class Parser_OldPP } } # Add the new items to the state - # We do this after the loop instead of during it to avoid slowing + # We do this after the loop instead of during it to avoid slowing # down the recursive unstrip $state->nowiki->mergeArray( $nowikiItems ); $state->general->mergeArray( $generalItems ); @@ -739,7 +739,7 @@ class Parser_OldPP /** * Use the HTML tidy PECL extension to use the tidy library in-process, - * saving the overhead of spawning a new process. + * saving the overhead of spawning a new process. * * 'pear install tidy' should be able to compile the extension module. * @@ -807,7 +807,7 @@ class Parser_OldPP } else if ( count ( $td_history ) == 0 ) { // Don't do any of the following continue; - } else if ( substr ( $line , 0 , 2 ) == '|}' ) { + } else if ( substr ( $line , 0 , 2 ) == '|}' ) { // We are ending a table $line = '' . substr ( $line , 2 ); $last_tag = array_pop ( $last_tag_history ); @@ -2397,7 +2397,7 @@ class Parser_OldPP $oldtz = getenv( 'TZ' ); putenv( 'TZ='.$wgLocaltimezone ); } - + wfSuppressWarnings(); // E_STRICT system time bitching $localTimestamp = date( 'YmdHis', $ts ); $localMonth = date( 'm', $ts ); @@ -3044,7 +3044,7 @@ class Parser_OldPP $titleText = $title->getPrefixedText(); //used by edit section links $replaceHeadings = true; - + } } @@ -3151,7 +3151,7 @@ class Parser_OldPP # If there are any tags, only include them if ( in_string( '', $text ) && in_string( '', $text ) ) { $replacer = new OnlyIncludeReplacer; - StringUtils::delimiterReplaceCallback( '', '', + StringUtils::delimiterReplaceCallback( '', '', array( &$replacer, 'replace' ), $text ); $text = $replacer->output; } @@ -3285,13 +3285,13 @@ class Parser_OldPP $text = $skip = false; $finalTitle = $title; $deps = array(); - + // Loop to fetch the article, with up to 1 redirect for ( $i = 0; $i < 2 && is_object( $title ); $i++ ) { # Give extensions a chance to select the revision instead $id = false; // Assume current wfRunHooks( 'BeforeParserFetchTemplateAndtitle', array( false, &$title, &$skip, &$id ) ); - + if( $skip ) { $text = false; $deps[] = array( @@ -3303,9 +3303,9 @@ class Parser_OldPP $rev = $id ? Revision::newFromId( $id ) : Revision::newFromTitle( $title ); $rev_id = $rev ? $rev->getId() : 0; - $deps[] = array( - 'title' => $title, - 'page_id' => $title->getArticleID(), + $deps[] = array( + 'title' => $title, + 'page_id' => $title->getArticleID(), 'rev_id' => $rev_id ); if( $rev ) { @@ -3688,7 +3688,7 @@ class Parser_OldPP if( $numVisible < 1 ) { $enoughToc = false; } - + if( $enoughToc ) { if( $prevtoclevel > 0 && $prevtoclevel < $wgMaxTocLevel ) { $toc .= $sk->tocUnindent( $prevtoclevel - 1 ); @@ -3842,7 +3842,7 @@ class Parser_OldPP $username = $user->getName(); $nickname = $user->getOption( 'nickname' ); $nickname = $nickname === '' ? $username : $nickname; - + if( mb_strlen( $nickname ) > $wgMaxSigChars ) { $nickname = $username; wfDebug( __METHOD__ . ": $username has overlong signature.\n" ); @@ -4432,7 +4432,7 @@ class Parser_OldPP if( isset( $params['heights'] ) ) { $ig->setHeights( $params['heights'] ); } - + wfRunHooks( 'BeforeParserrenderImageGallery', array( &$this, &$ig ) ); $lines = explode( "\n", $text ); @@ -4485,9 +4485,9 @@ class Parser_OldPP // Initialise static lists static $internalParamNames = array( 'horizAlign' => array( 'left', 'right', 'center', 'none' ), - 'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle', + 'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle', 'bottom', 'text-bottom' ), - 'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless', + 'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless', 'upright', 'border' ), ); static $internalParamMap; @@ -4542,7 +4542,7 @@ class Parser_OldPP # * middle # * bottom # * text-bottom - + $parts = array_map( 'trim', explode( '|', $options) ); $sk = $this->mOptions->getSkin(); @@ -4562,14 +4562,14 @@ class Parser_OldPP # Process the input parameters $caption = ''; - $params = array( 'frame' => array(), 'handler' => array(), + $params = array( 'frame' => array(), 'handler' => array(), 'horizAlign' => array(), 'vertAlign' => array() ); foreach( $parts as $part ) { list( $magicName, $value ) = $mwArray->matchVariableStartToEnd( $part ); if ( isset( $paramMap[$magicName] ) ) { list( $type, $paramName ) = $paramMap[$magicName]; $params[$type][$paramName] = $value; - + // Special case; width and height come in one variable together if( $type == 'handler' && $paramName == 'width' ) { $m = array(); @@ -4684,7 +4684,7 @@ class Parser_OldPP # I.... _hope_ this is right. # Otherwise, sometimes we don't have things initialized properly. $this->clearState(); - + # strip NOWIKI etc. to avoid confusion (true-parameter causes HTML # comments to be stripped as well) $stripState = new StripState; @@ -4867,8 +4867,8 @@ class Parser_OldPP } /** - * Try to guess the section anchor name based on a wikitext fragment - * presumably extracted from a heading, for example "Header" from + * Try to guess the section anchor name based on a wikitext fragment + * presumably extracted from a heading, for example "Header" from * "== Header ==". */ public function guessSectionNameFromWikiText( $text ) { @@ -4891,14 +4891,14 @@ class Parser_OldPP /** * Strips a text string of wikitext for use in a section anchor - * + * * Accepts a text string and then removes all wikitext from the * string and leaves only the resultant text (i.e. the result of * [[User:WikiSysop|Sysop]] would be "Sysop" and the result of * [[User:WikiSysop]] would be "User:WikiSysop") - this is intended * to create valid section anchors by mimicing the output of the * parser when headings are parsed. - * + * * @param $text string Text string to be stripped of wikitext * for use in a Section anchor * @return Filtered text string @@ -4907,15 +4907,15 @@ class Parser_OldPP # Strip internal link markup $text = preg_replace('/\[\[:?([^[|]+)\|([^[]+)\]\]/','$2',$text); $text = preg_replace('/\[\[:?([^[]+)\|?\]\]/','$1',$text); - + # Strip external link markup (FIXME: Not Tolerant to blank link text # I.E. [http://www.mediawiki.org] will render as [1] or something depending # on how many empty links there are on the page - need to figure that out. $text = preg_replace('/\[(?:' . wfUrlProtocols() . ')([^ ]+?) ([^[]+)\]/','$2',$text); - + # Parse wikitext quotes (italics & bold) $text = $this->doQuotes($text); - + # Strip HTML tags $text = StringUtils::delimiterReplace( '<', '>', '', $text ); return $text; @@ -4933,4 +4933,3 @@ class Parser_OldPP return $text; } } - diff --git a/includes/PatrolLog.php b/includes/PatrolLog.php index 35cb4a0237..5f305c1006 100644 --- a/includes/PatrolLog.php +++ b/includes/PatrolLog.php @@ -31,7 +31,7 @@ class PatrolLog { return false; } } - + /** * Generate the log action text corresponding to a patrol log item * @@ -67,7 +67,7 @@ class PatrolLog { return ''; } } - + /** * Prepare log parameters for a patrolled change * @@ -82,6 +82,4 @@ class PatrolLog { (int)$auto ); } - } - diff --git a/includes/PrefixSearch.php b/includes/PrefixSearch.php index bddfb9f1e1..1a43afe7f6 100644 --- a/includes/PrefixSearch.php +++ b/includes/PrefixSearch.php @@ -31,8 +31,8 @@ class PrefixSearch { return self::searchBackend( 0, $search, $limit ); } - - + + /** * Do a prefix search of titles and return a list of matching page names. * @param string $search @@ -45,21 +45,21 @@ class PrefixSearch { } elseif( $ns == NS_SPECIAL ) { return self::specialSearch( $search, $limit ); } - + $srchres = array(); if( wfRunHooks( 'PrefixSearchBackend', array( $ns, $search, $limit, &$srchres ) ) ) { return self::defaultSearchBackend( $ns, $search, $limit ); } return $srchres; } - + /** * Prefix search special-case for Special: namespace. */ protected static function specialSearch( $search, $limit ) { global $wgContLang; $searchKey = $wgContLang->caseFold( $search ); - + // Unlike SpecialPage itself, we want the canonical forms of both // canonical and alias title forms... SpecialPage::initList(); @@ -74,7 +74,7 @@ class PrefixSearch { } } ksort( $keys ); - + $srchres = array(); foreach( $keys as $pageKey => $page ) { if( $searchKey === '' || strpos( $pageKey, $searchKey ) === 0 ) { @@ -86,7 +86,7 @@ class PrefixSearch { } return $srchres; } - + /** * Unless overridden by PrefixSearchBackend hook... * This is case-sensitive except the first letter (per $wgCapitalLinks) @@ -98,11 +98,11 @@ class PrefixSearch { */ protected static function defaultSearchBackend( $ns, $search, $limit ) { global $wgCapitalLinks, $wgContLang; - + if( $wgCapitalLinks ) { $search = $wgContLang->ucfirst( $search ); } - + // Prepare nested request $req = new FauxRequest(array ( 'action' => 'query', @@ -126,10 +126,8 @@ class PrefixSearch { // because it does not support lists of unnamed items $srchres[] = $pageinfo['title']; } - + return $srchres; } } - -?> \ No newline at end of file diff --git a/includes/Preprocessor.php b/includes/Preprocessor.php index 34bc1e5b3a..69d20409e7 100644 --- a/includes/Preprocessor.php +++ b/includes/Preprocessor.php @@ -29,7 +29,7 @@ interface PPFrame { * Expand a document tree node */ function expand( $root, $flags = 0 ); - + /** * Implode with flags for expand() */ @@ -41,9 +41,9 @@ interface PPFrame { function implode( $sep /*, ... */ ); /** - * Makes an object that, when expand()ed, will be the same as one obtained + * Makes an object that, when expand()ed, will be the same as one obtained * with implode() - */ + */ function virtualImplode( $sep /*, ... */ ); /** @@ -57,7 +57,7 @@ interface PPFrame { function isEmpty(); /** - * Get an argument to this frame by name + * Get an argument to this frame by name */ function getArgument( $name ); @@ -79,13 +79,13 @@ interface PPFrame { * * Leaf nodes, which contain the actual data * * This interface provides access to the tree structure and to the contents of array nodes, - * but it does not provide access to the internal structure of leaf nodes. Access to leaf + * but it does not provide access to the internal structure of leaf nodes. Access to leaf * data is provided via two means: * * PPFrame::expand(), which provides expanded text * * The PPNode::split*() functions, which provide metadata about certain types of tree node */ interface PPNode { - /** + /** * Get an array-type node containing the children of this node. * Returns false if this is not a tree node. */ @@ -118,7 +118,7 @@ interface PPNode { */ function item( $i ); - /** + /** * Get the name of this node. The following names are defined here: * * h A heading node. @@ -136,7 +136,7 @@ interface PPNode { * Split a node into an associative array containing: * name PPNode name * index String index - * value PPNode value + * value PPNode value */ function splitArg(); @@ -151,4 +151,3 @@ interface PPNode { */ function splitHeading(); } - diff --git a/includes/Preprocessor_DOM.php b/includes/Preprocessor_DOM.php index 526bd71f1a..a4a490c287 100644 --- a/includes/Preprocessor_DOM.php +++ b/includes/Preprocessor_DOM.php @@ -34,22 +34,22 @@ class Preprocessor_DOM implements Preprocessor { /** * Preprocess some wikitext and return the document tree. - * This is the ghost of Parser::replace_variables(). + * This is the ghost of Parser::replace_variables(). * * @param string $text The text to parse * @param integer flags Bitwise combination of: - * Parser::PTD_FOR_INCLUSION Handle / as if the text is being - * included. Default is to assume a direct page view. + * Parser::PTD_FOR_INCLUSION Handle / as if the text is being + * included. Default is to assume a direct page view. * * The generated DOM tree must depend only on the input text and the flags. - * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. + * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. * - * Any flag added to the $flags parameter here, or any other parameter liable to cause a - * change in the DOM tree for a given text, must be passed through the section identifier - * in the section edit link and thus back to extractSections(). + * Any flag added to the $flags parameter here, or any other parameter liable to cause a + * change in the DOM tree for a given text, must be passed through the section identifier + * in the section edit link and thus back to extractSections(). * - * The output of this function is currently only cached in process memory, but a persistent - * cache may be implemented at a later date which takes further advantage of these strict + * The output of this function is currently only cached in process memory, but a persistent + * cache may be implemented at a later date which takes further advantage of these strict * dependency requirements. * * @private @@ -96,7 +96,7 @@ class Preprocessor_DOM implements Preprocessor { // Use "A" modifier (anchored) instead of "^", because ^ doesn't work with an offset $elementsRegex = "~($xmlishRegex)(?:\s|\/>|>)|(!--)~iA"; - + $stack = new PPDStack; $searchBase = "[{<\n"; #} @@ -213,7 +213,7 @@ class Preprocessor_DOM implements Preprocessor { // To avoid leaving blank lines, when a comment is both preceded // and followed by a newline (ignoring spaces), trim leading and // trailing spaces and one of the newlines. - + // Find the end $endPos = strpos( $text, '-->', $i + 4 ); if ( $endPos === false ) { @@ -228,10 +228,10 @@ class Preprocessor_DOM implements Preprocessor { // $wsEnd will be the position of the last space $wsEnd = $endPos + 2 + strspn( $text, ' ', $endPos + 3 ); // Eat the line if possible - // TODO: This could theoretically be done if $wsStart == 0, i.e. for comments at - // the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but + // TODO: This could theoretically be done if $wsStart == 0, i.e. for comments at + // the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but // it's a possible beneficial b/c break. - if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n" + if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n" && substr( $text, $wsEnd + 1, 1 ) == "\n" ) { $startPos = $wsStart; @@ -310,7 +310,7 @@ class Preprocessor_DOM implements Preprocessor { } // and just become tags if ( in_array( $lowerName, $ignoredElements ) ) { - $accum .= '' . htmlspecialchars( substr( $text, $tagStartPos, $i - $tagStartPos ) ) + $accum .= '' . htmlspecialchars( substr( $text, $tagStartPos, $i - $tagStartPos ) ) . ''; continue; } @@ -322,7 +322,7 @@ class Preprocessor_DOM implements Preprocessor { $attr = substr( $text, $attrStart, $attrEnd - $attrStart ); } $accum .= '' . htmlspecialchars( $name ) . '' . - // Note that the attr element contains the whitespace between name and attribute, + // Note that the attr element contains the whitespace between name and attribute, // this is necessary for precise reconstruction during pre-save transform. '' . htmlspecialchars( $attr ) . ''; if ( $inner !== null ) { @@ -332,7 +332,7 @@ class Preprocessor_DOM implements Preprocessor { } elseif ( $found == 'line-start' ) { - // Is this the start of a heading? + // Is this the start of a heading? // Line break belongs before the heading element in any case if ( $fakeLineStart ) { $fakeLineStart = false; @@ -340,7 +340,7 @@ class Preprocessor_DOM implements Preprocessor { $accum .= $curChar; $i++; } - + $count = strspn( $text, '=', $i, 6 ); if ( $count == 1 && $findEquals ) { // DWIM: This looks kind of like a name/value separator @@ -411,12 +411,12 @@ class Preprocessor_DOM implements Preprocessor { // Append the result to the enclosing accumulator $accum .= $element; // Note that we do NOT increment the input pointer. - // This is because the closing linebreak could be the opening linebreak of + // This is because the closing linebreak could be the opening linebreak of // another heading. Infinite loops are avoided because the next iteration MUST - // hit the heading open case above, which unconditionally increments the + // hit the heading open case above, which unconditionally increments the // input pointer. } - + elseif ( $found == 'open' ) { # count opening brace characters $count = strspn( $text, $curChar, $i ); @@ -483,7 +483,7 @@ class Preprocessor_DOM implements Preprocessor { $title = $parts[0]->out; unset( $parts[0] ); - # The invocation is at the start of the line if lineStart is set in + # The invocation is at the start of the line if lineStart is set in # the stack, and all opening brackets are used up. if ( $maxCount == $matchingCount && !empty( $piece->lineStart ) ) { $attr = ' lineStart="1"'; @@ -539,14 +539,14 @@ class Preprocessor_DOM implements Preprocessor { # Add XML element to the enclosing accumulator $accum .= $element; } - + elseif ( $found == 'pipe' ) { $findEquals = true; // shortcut for getFlags() $stack->addPart(); $accum =& $stack->getAccum(); ++$i; } - + elseif ( $found == 'equals' ) { $findEquals = false; // shortcut for getFlags() $stack->getCurrentPart()->eqpos = strlen( $accum ); @@ -590,7 +590,7 @@ class PPDStack { var $stack, $rootAccum, $top; var $out; var $elementClass = 'PPDStackElement'; - + static $false = false; function __construct() { @@ -650,8 +650,8 @@ class PPDStack { function getFlags() { if ( !count( $this->stack ) ) { - return array( - 'findEquals' => false, + return array( + 'findEquals' => false, 'findPipe' => false, 'inHeading' => false, ); @@ -730,7 +730,7 @@ class PPDStackElement { class PPDPart { var $out; // Output accumulator string - // Optional member variables: + // Optional member variables: // eqpos Position of equals sign in output accumulator // commentEnd Past-the-end input pointer for the last comment encountered // visualEnd Past-the-end input pointer for the end of the accumulator minus comments @@ -816,7 +816,7 @@ class PPFrame_DOM implements PPFrame { return $root; } - if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->mMaxPPNodeCount ) + if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->mMaxPPNodeCount ) { return 'Node-count limit exceeded'; } @@ -864,7 +864,7 @@ class PPFrame_DOM implements PPFrame { $index++; } } else { - // Copy to $contextNode and then delete from iterator stack, + // Copy to $contextNode and then delete from iterator stack, // because this is not an iterator but we do have to execute it once $contextNode = $iteratorStack[$level]; $iteratorStack[$level] = false; @@ -893,9 +893,9 @@ class PPFrame_DOM implements PPFrame { $newIterator = $this->virtualBracketedImplode( '{{', '|', '}}', $title, $parts ); } else { $lineStart = $contextNode->getAttribute( 'lineStart' ); - $params = array( - 'title' => new PPNode_DOM( $title ), - 'parts' => new PPNode_DOM( $parts ), + $params = array( + 'title' => new PPNode_DOM( $title ), + 'parts' => new PPNode_DOM( $parts ), 'lineStart' => $lineStart ); $ret = $this->parser->braceSubstitution( $params, $this ); if ( isset( $ret['object'] ) ) { @@ -913,8 +913,8 @@ class PPFrame_DOM implements PPFrame { if ( $flags & self::NO_ARGS ) { $newIterator = $this->virtualBracketedImplode( '{{{', '|', '}}}', $title, $parts ); } else { - $params = array( - 'title' => new PPNode_DOM( $title ), + $params = array( + 'title' => new PPNode_DOM( $title ), 'parts' => new PPNode_DOM( $parts ) ); $ret = $this->parser->argSubstitution( $params, $this ); if ( isset( $ret['object'] ) ) { @@ -926,9 +926,9 @@ class PPFrame_DOM implements PPFrame { } elseif ( $contextNode->nodeName == 'comment' ) { # HTML-style comment # Remove it in HTML, pre+remove and STRIP_COMMENTS modes - if ( $this->parser->ot['html'] - || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() ) - || ( $flags & self::STRIP_COMMENTS ) ) + if ( $this->parser->ot['html'] + || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() ) + || ( $flags & self::STRIP_COMMENTS ) ) { $out .= ''; } @@ -944,7 +944,7 @@ class PPFrame_DOM implements PPFrame { } elseif ( $contextNode->nodeName == 'ignore' ) { # Output suppression used by etc. # OT_WIKI will only respect in substed templates. - # The other output types respect it unless NO_IGNORE is set. + # The other output types respect it unless NO_IGNORE is set. # extractSections() sets NO_IGNORE and so never respects it. if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & self::NO_IGNORE ) ) { $out .= $contextNode->textContent; @@ -971,8 +971,8 @@ class PPFrame_DOM implements PPFrame { # Insert a heading marker only for children of # This is to stop extractSections from going over multiple tree levels - if ( $contextNode->parentNode->nodeName == 'root' - && $this->parser->ot['html'] ) + if ( $contextNode->parentNode->nodeName == 'root' + && $this->parser->ot['html'] ) { # Insert heading index marker $headingIndex = $contextNode->getAttribute( 'i' ); @@ -1065,7 +1065,7 @@ class PPFrame_DOM implements PPFrame { } /** - * Makes an object that, when expand()ed, will be the same as one obtained + * Makes an object that, when expand()ed, will be the same as one obtained * with implode() */ function virtualImplode( $sep /*, ... */ ) { @@ -1189,7 +1189,7 @@ class PPTemplateFrame_DOM extends PPFrame_DOM { } else { $s .= ', '; } - $s .= "\"$name\":\"" . + $s .= "\"$name\":\"" . str_replace( '"', '\\"', $value->ownerDocument->saveXML( $value ) ) . '"'; } $s .= '}'; @@ -1219,7 +1219,7 @@ class PPTemplateFrame_DOM extends PPFrame_DOM { } if ( !isset( $this->namedExpansionCache[$name] ) ) { # Trim named arguments post-expand, for backwards compatibility - $this->namedExpansionCache[$name] = trim( + $this->namedExpansionCache[$name] = trim( $this->parent->expand( $this->namedArgs[$name], self::STRIP_COMMENTS ) ); } return $this->namedExpansionCache[$name]; @@ -1308,7 +1308,7 @@ class PPNode_DOM implements PPNode { * Split a node into an associative array containing: * name PPNode name * index String index - * value PPNode value + * value PPNode value */ function splitArg() { $names = $this->xpath->query( 'name', $this->node ); @@ -1318,12 +1318,12 @@ class PPNode_DOM implements PPNode { } $name = $names->item( 0 ); $index = $name->getAttribute( 'index' ); - return array( + return array( 'name' => new self( $name ), - 'index' => $index, + 'index' => $index, 'value' => new self( $values->item( 0 ) ) ); } - + /** * Split an node into an associative array containing name, attr, inner and close * All values in the resulting array are PPNodes. Inner and close are optional. diff --git a/includes/Preprocessor_Hash.php b/includes/Preprocessor_Hash.php index ee3539aecb..cb2d255b21 100644 --- a/includes/Preprocessor_Hash.php +++ b/includes/Preprocessor_Hash.php @@ -19,22 +19,22 @@ class Preprocessor_Hash implements Preprocessor { /** * Preprocess some wikitext and return the document tree. - * This is the ghost of Parser::replace_variables(). + * This is the ghost of Parser::replace_variables(). * * @param string $text The text to parse * @param integer flags Bitwise combination of: - * Parser::PTD_FOR_INCLUSION Handle / as if the text is being - * included. Default is to assume a direct page view. + * Parser::PTD_FOR_INCLUSION Handle / as if the text is being + * included. Default is to assume a direct page view. * * The generated DOM tree must depend only on the input text and the flags. - * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. + * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. * - * Any flag added to the $flags parameter here, or any other parameter liable to cause a - * change in the DOM tree for a given text, must be passed through the section identifier - * in the section edit link and thus back to extractSections(). + * Any flag added to the $flags parameter here, or any other parameter liable to cause a + * change in the DOM tree for a given text, must be passed through the section identifier + * in the section edit link and thus back to extractSections(). * - * The output of this function is currently only cached in process memory, but a persistent - * cache may be implemented at a later date which takes further advantage of these strict + * The output of this function is currently only cached in process memory, but a persistent + * cache may be implemented at a later date which takes further advantage of these strict * dependency requirements. * * @private @@ -81,7 +81,7 @@ class Preprocessor_Hash implements Preprocessor { // Use "A" modifier (anchored) instead of "^", because ^ doesn't work with an offset $elementsRegex = "~($xmlishRegex)(?:\s|\/>|>)|(!--)~iA"; - + $stack = new PPDStack_Hash; $searchBase = "[{<\n"; @@ -197,7 +197,7 @@ class Preprocessor_Hash implements Preprocessor { // To avoid leaving blank lines, when a comment is both preceded // and followed by a newline (ignoring spaces), trim leading and // trailing spaces and one of the newlines. - + // Find the end $endPos = strpos( $text, '-->', $i + 4 ); if ( $endPos === false ) { @@ -212,10 +212,10 @@ class Preprocessor_Hash implements Preprocessor { // $wsEnd will be the position of the last space $wsEnd = $endPos + 2 + strspn( $text, ' ', $endPos + 3 ); // Eat the line if possible - // TODO: This could theoretically be done if $wsStart == 0, i.e. for comments at - // the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but + // TODO: This could theoretically be done if $wsStart == 0, i.e. for comments at + // the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but // it's a possible beneficial b/c break. - if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n" + if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n" && substr( $text, $wsEnd + 1, 1 ) == "\n" ) { $startPos = $wsStart; @@ -223,9 +223,9 @@ class Preprocessor_Hash implements Preprocessor { // Remove leading whitespace from the end of the accumulator // Sanity check first though $wsLength = $i - $wsStart; - if ( $wsLength > 0 + if ( $wsLength > 0 && $accum->lastNode instanceof PPNode_Hash_Text - && substr( $accum->lastNode->value, -$wsLength ) === str_repeat( ' ', $wsLength ) ) + && substr( $accum->lastNode->value, -$wsLength ) === str_repeat( ' ', $wsLength ) ) { $accum->lastNode->value = substr( $accum->lastNode->value, 0, -$wsLength ); } @@ -305,7 +305,7 @@ class Preprocessor_Hash implements Preprocessor { if ( $attrEnd <= $attrStart ) { $attr = ''; } else { - // Note that the attr element contains the whitespace between name and attribute, + // Note that the attr element contains the whitespace between name and attribute, // this is necessary for precise reconstruction during pre-save transform. $attr = substr( $text, $attrStart, $attrEnd - $attrStart ); } @@ -323,7 +323,7 @@ class Preprocessor_Hash implements Preprocessor { } elseif ( $found == 'line-start' ) { - // Is this the start of a heading? + // Is this the start of a heading? // Line break belongs before the heading element in any case if ( $fakeLineStart ) { $fakeLineStart = false; @@ -331,7 +331,7 @@ class Preprocessor_Hash implements Preprocessor { $accum->addLiteral( $curChar ); $i++; } - + $count = strspn( $text, '=', $i, 6 ); if ( $count == 1 && $findEquals ) { // DWIM: This looks kind of like a name/value separator @@ -409,12 +409,12 @@ class Preprocessor_Hash implements Preprocessor { $accum->addAccum( $element ); } // Note that we do NOT increment the input pointer. - // This is because the closing linebreak could be the opening linebreak of + // This is because the closing linebreak could be the opening linebreak of // another heading. Infinite loops are avoided because the next iteration MUST - // hit the heading open case above, which unconditionally increments the + // hit the heading open case above, which unconditionally increments the // input pointer. } - + elseif ( $found == 'open' ) { # count opening brace characters $count = strspn( $text, $curChar, $i ); @@ -484,7 +484,7 @@ class Preprocessor_Hash implements Preprocessor { $element = new PPNode_Hash_Tree( $name ); - # The invocation is at the start of the line if lineStart is set in + # The invocation is at the start of the line if lineStart is set in # the stack, and all opening brackets are used up. if ( $maxCount == $matchingCount && !empty( $piece->lineStart ) ) { $element->addChild( new PPNode_Hash_Attr( 'lineStart', 1 ) ); @@ -581,14 +581,14 @@ class Preprocessor_Hash implements Preprocessor { $accum->addAccum( $element ); } } - + elseif ( $found == 'pipe' ) { $findEquals = true; // shortcut for getFlags() $stack->addPart(); $accum =& $stack->getAccum(); ++$i; } - + elseif ( $found == 'equals' ) { $findEquals = false; // shortcut for getFlags() $accum->addNodeWithText( 'equals', '=' ); @@ -713,7 +713,7 @@ class PPDAccum_Hash { /** * Append a PPAccum_Hash - * Takes over ownership of the nodes in the source argument. These nodes may + * Takes over ownership of the nodes in the source argument. These nodes may * subsequently be modified, especially nextSibling. */ function addAccum( $accum ) { @@ -800,7 +800,7 @@ class PPFrame_Hash implements PPFrame { return $root; } - if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->mMaxPPNodeCount ) + if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->mMaxPPNodeCount ) { return 'Node-count limit exceeded'; } @@ -838,7 +838,7 @@ class PPFrame_Hash implements PPFrame { $index++; } } else { - // Copy to $contextNode and then delete from iterator stack, + // Copy to $contextNode and then delete from iterator stack, // because this is not an iterator but we do have to execute it once $contextNode = $iteratorStack[$level]; $iteratorStack[$level] = false; @@ -886,9 +886,9 @@ class PPFrame_Hash implements PPFrame { } elseif ( $contextNode->name == 'comment' ) { # HTML-style comment # Remove it in HTML, pre+remove and STRIP_COMMENTS modes - if ( $this->parser->ot['html'] - || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() ) - || ( $flags & self::STRIP_COMMENTS ) ) + if ( $this->parser->ot['html'] + || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() ) + || ( $flags & self::STRIP_COMMENTS ) ) { $out .= ''; } @@ -904,7 +904,7 @@ class PPFrame_Hash implements PPFrame { } elseif ( $contextNode->name == 'ignore' ) { # Output suppression used by etc. # OT_WIKI will only respect in substed templates. - # The other output types respect it unless NO_IGNORE is set. + # The other output types respect it unless NO_IGNORE is set. # extractSections() sets NO_IGNORE and so never respects it. if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & self::NO_IGNORE ) ) { $out .= $contextNode->firstChild->value; @@ -1017,7 +1017,7 @@ class PPFrame_Hash implements PPFrame { } /** - * Makes an object that, when expand()ed, will be the same as one obtained + * Makes an object that, when expand()ed, will be the same as one obtained * with implode() */ function virtualImplode( $sep /*, ... */ ) { @@ -1145,7 +1145,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { } else { $s .= ', '; } - $s .= "\"$name\":\"" . + $s .= "\"$name\":\"" . str_replace( '"', '\\"', $value->__toString() ) . '"'; } $s .= '}'; @@ -1175,7 +1175,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { } if ( !isset( $this->namedExpansionCache[$name] ) ) { # Trim named arguments post-expand, for backwards compatibility - $this->namedExpansionCache[$name] = trim( + $this->namedExpansionCache[$name] = trim( $this->parent->expand( $this->namedArgs[$name], self::STRIP_COMMENTS ) ); } return $this->namedExpansionCache[$name]; @@ -1274,7 +1274,7 @@ class PPNode_Hash_Tree implements PPNode { * Split a node into an associative array containing: * name PPNode name * index String index - * value PPNode value + * value PPNode value */ function splitArg() { $bits = array(); @@ -1284,7 +1284,7 @@ class PPNode_Hash_Tree implements PPNode { } if ( $child->name === 'name' ) { $bits['name'] = $child; - if ( $child->firstChild instanceof PPNode_Hash_Attr + if ( $child->firstChild instanceof PPNode_Hash_Attr && $child->firstChild->name === 'index' ) { $bits['index'] = $child->firstChild->value; @@ -1302,7 +1302,7 @@ class PPNode_Hash_Tree implements PPNode { } return $bits; } - + /** * Split an node into an associative array containing name, attr, inner and close * All values in the resulting array are PPNodes. Inner and close are optional. @@ -1423,12 +1423,12 @@ class PPNode_Hash_Array implements PPNode { return var_export( $this, true ); } - function getLength() { - return count( $this->value ); + function getLength() { + return count( $this->value ); } - function item( $i ) { - return $this->value[$i]; + function item( $i ) { + return $this->value[$i]; } function getName() { return '#nodelist'; } @@ -1457,7 +1457,7 @@ class PPNode_Hash_Attr implements PPNode { return "<@{$this->name}>" . htmlspecialchars( $this->value ) . "name}>"; } - function getName() { + function getName() { return $this->name; } @@ -1474,4 +1474,3 @@ class PPNode_Hash_Attr implements PPNode { function splitExt() { throw new MWException( __METHOD__ . ': not supported' ); } function splitHeading() { throw new MWException( __METHOD__ . ': not supported' ); } } - diff --git a/includes/Profiler.php b/includes/Profiler.php index 8e1cd14743..b1f9b7aeaa 100644 --- a/includes/Profiler.php +++ b/includes/Profiler.php @@ -316,7 +316,7 @@ class Profiler { $name = substr($name, 0, 255); $encname = $dbw->strencode($name); - + if ($wgProfilePerHost) { $pfhost = $wguname['nodename']; } else { @@ -347,7 +347,7 @@ class Profiler { $elt = end($this->mWorkStack); return $elt[0]; } - + static function getCaller( $level ) { $backtrace = wfDebugBacktrace(); if ( isset( $backtrace[$level] ) ) { @@ -363,5 +363,3 @@ class Profiler { } } - - diff --git a/includes/ProfilerSimple.php b/includes/ProfilerSimple.php index 20ab99c04d..479a92eaec 100644 --- a/includes/ProfilerSimple.php +++ b/includes/ProfilerSimple.php @@ -105,7 +105,7 @@ class ProfilerSimple extends Profiler { if ( function_exists( 'getrusage' ) ) { if ( $ru == null ) $ru = getrusage(); - return ($ru['ru_utime.tv_sec'] + $ru['ru_stime.tv_sec'] + ($ru['ru_utime.tv_usec'] + + return ($ru['ru_utime.tv_sec'] + $ru['ru_stime.tv_sec'] + ($ru['ru_utime.tv_usec'] + $ru['ru_stime.tv_usec']) * 1e-6); } else { return 0; @@ -126,4 +126,3 @@ class ProfilerSimple extends Profiler { } } } - diff --git a/includes/ProfilerSimpleText.php b/includes/ProfilerSimpleText.php index e1cd921036..af29f199ad 100644 --- a/includes/ProfilerSimpleText.php +++ b/includes/ProfilerSimpleText.php @@ -21,6 +21,5 @@ class ProfilerSimpleText extends ProfilerSimple { } /* dense is good */ static function sort($a,$b) { return $a['real']<$b['real']; /* sort descending by time elapsed */ } - static function format($item,$key) { printf("%3.6f %6d - %s\n",$item['real'],$item['count'], $key); } + static function format($item,$key) { printf("%3.6f %6d - %s\n",$item['real'],$item['count'], $key); } } -?> diff --git a/includes/ProfilerSimpleUDP.php b/includes/ProfilerSimpleUDP.php index 7d2f7e21b3..66f7085f71 100644 --- a/includes/ProfilerSimpleUDP.php +++ b/includes/ProfilerSimpleUDP.php @@ -37,4 +37,3 @@ class ProfilerSimpleUDP extends ProfilerSimple { socket_sendto($sock,$packet,$plength,0x100,$wgUDPProfilerHost,$wgUDPProfilerPort); } } - diff --git a/includes/ProfilerStub.php b/includes/ProfilerStub.php index c41845a4d0..abcfb34868 100644 --- a/includes/ProfilerStub.php +++ b/includes/ProfilerStub.php @@ -22,5 +22,3 @@ function wfProfileOut( $fn = '' ) { function wfGetProfilingOutput( $s, $e ) {} function wfProfileClose() {} $wgProfiling = false; - - diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 6bcc359b4f..4f40e7ef11 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -77,7 +77,7 @@ class ProtectionForm { } } } - + function execute() { global $wgRequest, $wgOut; if( $wgRequest->wasPosted() ) { @@ -143,7 +143,7 @@ class ProtectionForm { function save() { global $wgRequest, $wgUser, $wgOut; - + if( $this->disabled ) { $this->show(); return false; @@ -185,7 +185,7 @@ class ProtectionForm { $edit_restriction = $this->mRestrictions['edit']; - if ($this->mCascade && ($edit_restriction != 'protect') && + if ($this->mCascade && ($edit_restriction != 'protect') && !(isset($wgGroupPermissions[$edit_restriction]['protect']) && $wgGroupPermissions[$edit_restriction]['protect'] ) ) $this->mCascade = false; @@ -198,13 +198,13 @@ class ProtectionForm { if( !$ok ) { throw new FatalError( "Unknown error at restriction save time." ); } - + if( $wgRequest->getCheck( 'mwProtectWatch' ) ) { $this->mArticle->doWatch(); } elseif( $this->mTitle->userIsWatching() ) { $this->mArticle->doUnwatch(); } - + return $ok; } @@ -379,5 +379,4 @@ class ProtectionForm { $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'protect' ) ) ); LogEventsList::showLogExtract( $out, 'protect', $this->mTitle->getPrefixedText() ); } - } diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 3a4d1d58e2..534ebbc164 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -24,7 +24,7 @@ function wfGetForwardedFor() { $index = 'HTTP_X_FORWARDED_FOR'; $index2 = 'CLIENT-IP'; } - + #Try a couple of headers if( isset( $set[$index] ) ) { return $set[$index]; @@ -90,7 +90,7 @@ function wfGetIP() { $xff = array_reverse( $xff ); $ipchain = array_merge( $ipchain, $xff ); } - + # Step through XFF list and find the last address in the list which is a trusted server # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private) foreach ( $ipchain as $i => $curIP ) { @@ -119,9 +119,9 @@ function wfGetIP() { function wfIsTrustedProxy( $ip ) { global $wgSquidServers, $wgSquidServersNoPurge; - if ( in_array( $ip, $wgSquidServers ) || - in_array( $ip, $wgSquidServersNoPurge ) || - wfIsAOLProxy( $ip ) + if ( in_array( $ip, $wgSquidServers ) || + in_array( $ip, $wgSquidServersNoPurge ) || + wfIsAOLProxy( $ip ) ) { $trusted = true; } else { @@ -257,7 +257,3 @@ function wfIsAOLProxy( $ip ) { } return false; } - - - - diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 63c57cb1a8..f171fc5b41 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -4,10 +4,10 @@ */ /** - * List of query page classes and their associated special pages, + * List of query page classes and their associated special pages, * for periodic updates. * - * DO NOT CHANGE THIS LIST without testing that + * DO NOT CHANGE THIS LIST without testing that * maintenance/updateSpecialPages.php still works. */ global $wgQueryPages; // not redundant @@ -304,7 +304,7 @@ class QueryPage { # Fetch the timestamp of this update $tRes = $dbr->select( 'querycache_info', array( 'qci_timestamp' ), array( 'qci_type' => $type ), $fname ); $tRow = $dbr->fetchObject( $tRes ); - + if( $tRow ) { $updated = $wgLang->timeAndDate( $tRow->qci_timestamp, true, true ); $wgOut->addMeta( 'Data-Cache-Time', $tRow->qci_timestamp ); @@ -313,14 +313,14 @@ class QueryPage { } else { $wgOut->addWikiMsg( 'perfcached' ); } - + # If updates on this page have been disabled, let the user know # that the data set won't be refreshed for now global $wgDisableQueryPageUpdate; if( is_array( $wgDisableQueryPageUpdate ) && in_array( $this->getName(), $wgDisableQueryPageUpdate ) ) { $wgOut->addWikiMsg( 'querypage-no-updates' ); } - + } } @@ -333,7 +333,7 @@ class QueryPage { $this->preprocessResults( $dbr, $res ); $wgOut->addHtml( XML::openElement( 'div', array('class' => 'mw-spcontent') ) ); - + # Top header and navigation if( $shownavigation ) { $wgOut->addHtml( $this->getPageHeader() ); @@ -351,7 +351,7 @@ class QueryPage { return; } } - + # The actual results; specialist subclasses will want to handle this # with more than a straight list, so we hand them the info, plus # an OutputPage, and let them get on with it @@ -368,10 +368,10 @@ class QueryPage { } $wgOut->addHtml( XML::closeElement( 'div' ) ); - + return $num; } - + /** * Format and output report results using the given information plus * OutputPage @@ -385,12 +385,12 @@ class QueryPage { */ protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) { global $wgContLang; - + if( $num > 0 ) { $html = array(); if( !$this->listoutput ) $html[] = $this->openList( $offset ); - + # $res might contain the whole 1,000 rows, so we read up to # $num [should update this to use a Pager] for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) { @@ -404,7 +404,7 @@ class QueryPage { : "{$line}\n"; } } - + # Flush the final result if( $this->tryLastResult() ) { $row = null; @@ -418,22 +418,22 @@ class QueryPage { : "{$line}\n"; } } - + if( !$this->listoutput ) $html[] = $this->closeList(); - + $html = $this->listoutput ? $wgContLang->listToText( $html ) : implode( '', $html ); - + $out->addHtml( $html ); } } - + function openList( $offset ) { return "\n
      \n"; } - + function closeList() { return "
    \n"; } @@ -448,7 +448,7 @@ class QueryPage { */ function doFeed( $class = '', $limit = 50 ) { global $wgFeed, $wgFeedClasses; - + if ( !$wgFeed ) { global $wgOut; $wgOut->addWikiMsg( 'feed-unavailable' ); @@ -532,5 +532,3 @@ class QueryPage { return $title->getFullURL(); } } - - diff --git a/includes/RawPage.php b/includes/RawPage.php index 909c300b30..2cb24a0a75 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -35,7 +35,7 @@ class RawPage { $ctype = $this->mRequest->getVal( 'ctype' ); $smaxage = $this->mRequest->getIntOrNull( 'smaxage', $wgSquidMaxage ); $maxage = $this->mRequest->getInt( 'maxage', $wgSquidMaxage ); - + $this->mExpandTemplates = $this->mRequest->getVal( 'templates' ) === 'expand'; $this->mUseMessageCache = $this->mRequest->getBool( 'usemsgcache' ); @@ -66,7 +66,7 @@ class RawPage { break; } $this->mOldId = $oldid; - + # special case for 'generated' raw things: user css/js $gen = $this->mRequest->getVal( 'gen' ); @@ -82,7 +82,7 @@ class RawPage { $this->mGen = false; } $this->mCharset = $wgInputEncoding; - + # Force caching for CSS and JS raw content, default: 5 minutes if (is_null($smaxage) and ($ctype=='text/css' or $ctype==$wgJsMimeType)) { $this->mSmaxage = intval($wgForcedRawSMaxage); @@ -90,8 +90,8 @@ class RawPage { $this->mSmaxage = intval( $smaxage ); } $this->mMaxage = $maxage; - - # Output may contain user-specific data; + + # Output may contain user-specific data; # vary generated content for open sessions and private wikis if ($this->mGen or !$wgGroupPermissions['*']['read']) { $this->mPrivateCache = ( $this->mSmaxage == 0 ) || @@ -99,7 +99,7 @@ class RawPage { } else { $this->mPrivateCache = false; } - + if ( $ctype == '' or ! in_array( $ctype, $allowedCTypes ) ) { $this->mContentType = 'text/x-wiki'; } else { @@ -125,7 +125,7 @@ class RawPage { } else { $url = $_SERVER['PHP_SELF']; } - + if( strcmp( $wgScript, $url ) ) { # Internet Explorer will ignore the Content-Type header if it # thinks it sees a file extension it recognizes. Make sure that @@ -210,7 +210,7 @@ class RawPage { # have the pages. header( "HTTP/1.0 404 Not Found" ); } - + // Special-case for empty CSS/JS // // Internet Explorer for Mac handles empty files badly; @@ -224,7 +224,7 @@ class RawPage { $this->mContentType == 'text/javascript' ) ) { return "/* Empty */"; } - + return $this->parseArticleText( $text ); } @@ -239,4 +239,3 @@ class RawPage { return $text; } } - diff --git a/includes/RecentChange.php b/includes/RecentChange.php index b83b54eced..845b4294a2 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -67,7 +67,7 @@ class RecentChange $rc->numberofWatchingusers = false; return $rc; } - + /** * Obtain the recent change with a given rc_id value * @@ -85,7 +85,7 @@ class RecentChange return NULL; } } - + /** * Find the first recent change matching some specific conditions * @@ -652,5 +652,3 @@ class RecentChange } } } - - diff --git a/includes/RefreshLinksJob.php b/includes/RefreshLinksJob.php index d6e12212cd..cc94ed9606 100644 --- a/includes/RefreshLinksJob.php +++ b/includes/RefreshLinksJob.php @@ -45,4 +45,3 @@ class RefreshLinksJob extends Job { return true; } } - diff --git a/includes/Revision.php b/includes/Revision.php index 20f2d0de86..3eaf50b6f5 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -240,11 +240,11 @@ class Revision { } /** - * Return the list of revision fields that should be selected to create + * Return the list of revision fields that should be selected to create * a new revision. */ static function selectFields() { - return array( + return array( 'rev_id', 'rev_page', 'rev_text_id', @@ -274,16 +274,16 @@ class Revision { $this->mMinorEdit = intval( $row->rev_minor_edit ); $this->mTimestamp = $row->rev_timestamp; $this->mDeleted = intval( $row->rev_deleted ); - + if( !isset( $row->rev_parent_id ) ) $this->mParentId = is_null($row->rev_parent_id) ? null : 0; else $this->mParentId = intval( $row->rev_parent_id ); - + if( !isset( $row->rev_len ) || is_null( $row->rev_len ) ) $this->mSize = null; else - $this->mSize = intval( $row->rev_len ); + $this->mSize = intval( $row->rev_len ); if( isset( $row->page_latest ) ) { $this->mCurrent = ( $row->rev_id == $row->page_latest ); @@ -316,7 +316,7 @@ class Revision { $this->mDeleted = isset( $row['deleted'] ) ? intval( $row['deleted'] ) : 0; $this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : null; $this->mParentId = isset( $row['parent_id'] ) ? intval( $row['parent_id'] ) : null; - + // Enforce spacing trimming on supplied text $this->mComment = isset( $row['comment'] ) ? trim( strval( $row['comment'] ) ) : null; $this->mText = isset( $row['text'] ) ? rtrim( strval( $row['text'] ) ) : null; @@ -351,7 +351,7 @@ class Revision { public function getTextId() { return $this->mTextId; } - + /** * Get parent revision ID (the original previous page revision) * @return int @@ -445,7 +445,7 @@ class Revision { public function getRawUserText() { return $this->mUserText; } - + /** * Fetch revision comment if it's available to all users * @return string @@ -492,7 +492,7 @@ class Revision { return $this->getRawText(); } } - + /** * Fetch revision text without regard for view restrictions * @return string @@ -504,7 +504,7 @@ class Revision { } return $this->mText; } - + /** * Fetch revision text if it's available to THIS user * @return string @@ -555,7 +555,7 @@ class Revision { return null; } } - + /** * Get previous revision Id for this page_id * This is used to populate rev_parent_id on save @@ -762,7 +762,7 @@ class Revision { */ private function loadText() { wfProfileIn( __METHOD__ ); - + // Caching may be beneficial for massive use of external storage global $wgRevisionCacheExpiry, $wgMemc; $key = wfMemcKey( 'revisiontext', 'textid', $this->getTextId() ); @@ -773,7 +773,7 @@ class Revision { return $text; } } - + // If we kept data for lazy extraction, use it now... if ( isset( $this->mTextRow ) ) { $row = $this->mTextRow; @@ -781,7 +781,7 @@ class Revision { } else { $row = null; } - + if( !$row ) { // Text data is immutable; check slaves first. $dbr = wfGetDB( DB_SLAVE ); @@ -801,11 +801,11 @@ class Revision { } $text = self::getRevisionText( $row ); - + if( $wgRevisionCacheExpiry ) { $wgMemc->set( $key, $text, $wgRevisionCacheExpiry ); } - + wfProfileOut( __METHOD__ ); return $text; @@ -852,7 +852,7 @@ class Revision { wfProfileOut( __METHOD__ ); return $revision; } - + /** * Determine if the current user is allowed to view a particular * field of this revision, if it's marked as deleted. @@ -881,17 +881,17 @@ class Revision { */ static function getTimestampFromID( $id ) { $dbr = wfGetDB( DB_SLAVE ); - $timestamp = $dbr->selectField( 'revision', 'rev_timestamp', + $timestamp = $dbr->selectField( 'revision', 'rev_timestamp', array( 'rev_id' => $id ), __METHOD__ ); if ( $timestamp === false ) { # Not in slave, try master $dbw = wfGetDB( DB_MASTER ); - $timestamp = $dbw->selectField( 'revision', 'rev_timestamp', + $timestamp = $dbw->selectField( 'revision', 'rev_timestamp', array( 'rev_id' => $id ), __METHOD__ ); } return $timestamp; } - + /** * Get count of revisions per page...not very efficient * @param Database $db @@ -905,7 +905,7 @@ class Revision { } return 0; } - + /** * Get count of revisions per page...not very efficient * @param Database $db @@ -927,6 +927,3 @@ define( 'MW_REV_DELETED_TEXT', Revision::DELETED_TEXT ); define( 'MW_REV_DELETED_COMMENT', Revision::DELETED_COMMENT ); define( 'MW_REV_DELETED_USER', Revision::DELETED_USER ); define( 'MW_REV_DELETED_RESTRICTED', Revision::DELETED_RESTRICTED ); - - - diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index fd6b987304..4f1e9e1f54 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -383,7 +383,7 @@ class Sanitizer { $htmlelements = array_merge( $htmlsingle, $htmlpairs, $htmlnest ); # Convert them all to hashtables for faster lookup - $vars = array( 'htmlpairs', 'htmlsingle', 'htmlsingleonly', 'htmlnest', 'tabletags', + $vars = array( 'htmlpairs', 'htmlsingle', 'htmlsingleonly', 'htmlnest', 'tabletags', 'htmllist', 'listtags', 'htmlsingleallowed', 'htmlelements' ); foreach ( $vars as $var ) { $$var = array_flip( $$var ); @@ -419,7 +419,7 @@ class Sanitizer { $optstack = array(); array_push ($optstack, $ot); while ( ( ( $ot = @array_pop( $tagstack ) ) != $t ) && - isset( $htmlsingleallowed[$ot] ) ) + isset( $htmlsingleallowed[$ot] ) ) { array_push ($optstack, $ot); } @@ -582,7 +582,7 @@ class Sanitizer { return Sanitizer::validateAttributes( $attribs, Sanitizer::attributeWhitelist( $element ) ); } - + /** * Take an array of attribute names and values and normalize or discard * illegal values for the given whitelist. @@ -624,7 +624,7 @@ class Sanitizer { } return $out; } - + /** * Merge two sets of HTML attributes. * Conflicting items in the second set will override those @@ -641,7 +641,7 @@ class Sanitizer { if( isset( $a['class'] ) && isset( $b['class'] ) && $a['class'] !== $b['class'] ) { - + $out['class'] = implode( ' ', array_unique( preg_split( '/\s+/', @@ -651,7 +651,7 @@ class Sanitizer { } return $out; } - + /** * Pick apart some CSS and check it for forbidden or unsafe structures. * Returns a sanitized string, or false if it was just too evil. @@ -666,7 +666,7 @@ class Sanitizer { // Remove any comments; IE gets token splitting wrong $stripped = StringUtils::delimiterReplace( '/*', '*/', ' ', $stripped ); - + $value = $stripped; // ... and continue checks @@ -678,7 +678,7 @@ class Sanitizer { # haxx0r return false; } - + return $value; } @@ -920,7 +920,7 @@ class Sanitizer { self::normalizeWhitespace( Sanitizer::normalizeCharReferences( $text ) ) ); } - + private static function normalizeWhitespace( $text ) { return preg_replace( '/\r\n|[\x20\x0d\x0a\x09]/', @@ -972,8 +972,8 @@ class Sanitizer { /** * If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD, - * return the named entity reference as is. If the entity is a - * MediaWiki-specific alias, returns the HTML equivalent. Otherwise, + * return the named entity reference as is. If the entity is a + * MediaWiki-specific alias, returns the HTML equivalent. Otherwise, * returns HTML-escaped text of pseudo-entity source (eg &foo;) * * @param string $name @@ -1219,7 +1219,7 @@ class Sanitizer { # 11.2.6 'td' => array_merge( $common, $tablecell, $tablealign ), 'th' => array_merge( $common, $tablecell, $tablealign ), - + # 13.2 # Not usually allowed, but may be used for extension-style hooks # such as when it is rasterized @@ -1250,7 +1250,7 @@ class Sanitizer { 'rb' => $common, 'rt' => $common, #array_merge( $common, array( 'rbspan' ) ), 'rp' => $common, - + # MathML root element, where used for extensions # 'title' may not be 100% valid here; it's XHTML # http://www.w3.org/TR/REC-MathML/ @@ -1343,5 +1343,3 @@ class Sanitizer { } } - - diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index a2c92a426e..4d8909c456 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -51,7 +51,7 @@ class SearchEngine { if($wgContLang->hasVariants()){ $allSearchTerms = array_merge($allSearchTerms,$wgContLang->convertLinkToAllVariants($searchterm)); } - + foreach($allSearchTerms as $term){ # Exact match? No need to look further. @@ -123,7 +123,7 @@ class SearchEngine { if ( $title->getNamespace() == NS_USER ) { return $title; } - + # Go to images that exist even if there's no local page. # There may have been a funny upload, or it may be on a shared # file repository such as Wikimedia Commons. @@ -145,7 +145,7 @@ class SearchEngine { if( preg_match( '/^"([^"]+)"$/', $searchterm, $matches ) ) { return SearchEngine::getNearMatch( $matches[1] ); } - + return NULL; } @@ -176,7 +176,7 @@ class SearchEngine { function setNamespaces( $namespaces ) { $this->namespaces = $namespaces; } - + /** * Parse some common prefixes: all (search everything) * or namespace names @@ -185,10 +185,10 @@ class SearchEngine { */ function replacePrefixes( $query ){ global $wgContLang; - + if( strpos($query,':') === false ) return $query; // nothing to do - + $parsed = $query; $allkeyword = wfMsg('searchall').":"; if( strncmp($query, $allkeyword, strlen($allkeyword)) == 0 ){ @@ -204,7 +204,7 @@ class SearchEngine { } if(trim($parsed) == '') return $query; // prefix was the whole query - + return $parsed; } @@ -345,7 +345,7 @@ class SearchResultSet { function getSuggestionQuery(){ return null; } - + /** * @return string highlighted suggested query, '' if none */ @@ -362,7 +362,7 @@ class SearchResultSet { function next() { return false; } - + /** * Frees the result set, if applicable. * @ access public @@ -404,63 +404,63 @@ class SearchResult { function getScore() { return null; } - + /** - * @return string highlighted text snippet, null if not supported + * @return string highlighted text snippet, null if not supported */ function getTextSnippet(){ - return null; + return null; } - + /** * @return string highlighted title, '' if not supported */ function getTitleSnippet(){ return ''; } - + /** * @return string highlighted redirect name (redirect to this page), '' if none or not supported */ function getRedirectSnippet(){ return ''; } - + /** * @return Title object for the redirect to this page, null if none or not supported */ function getRedirectTitle(){ return null; } - + /** * @return string highlighted relevant section name, null if none or not supported */ function getSectionSnippet(){ return ''; } - + /** - * @return Title object (pagename+fragment) for the section, null if none or not supported + * @return Title object (pagename+fragment) for the section, null if none or not supported */ function getSectionTitle(){ return null; } - + /** * @return string timestamp, null if not supported */ function getTimestamp(){ return null; } - + /** * @return int number of words, null if not supported */ function getWordCount(){ return null; } - + /** * @return int size in bytes, null if not supported */ @@ -483,4 +483,3 @@ class SearchEngineDummy { function searchtitle() {} function searchtext() {} } - diff --git a/includes/SearchMySQL.php b/includes/SearchMySQL.php index ecbb528680..f3a7e16c93 100644 --- a/includes/SearchMySQL.php +++ b/includes/SearchMySQL.php @@ -250,10 +250,8 @@ class MySQLSearchResultSet extends SearchResultSet { return new SearchResult( $row ); } } - + function free() { $this->mResultSet->free(); } } - - diff --git a/includes/SearchOracle.php b/includes/SearchOracle.php index c9eeb3bc02..f8204c1440 100644 --- a/includes/SearchOracle.php +++ b/includes/SearchOracle.php @@ -233,5 +233,3 @@ class OracleSearchResultSet extends SearchResultSet { return new SearchResult($row); } } - - diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php index 18a02a8f50..715b71dfbd 100644 --- a/includes/SearchPostgres.php +++ b/includes/SearchPostgres.php @@ -29,7 +29,7 @@ class SearchPostgres extends SearchEngine { /** * Perform a full text search query via tsearch2 and return a result set. - * Currently searches a page's current title (page.page_title) and + * Currently searches a page's current title (page.page_title) and * latest revision article text (pagecontent.old_text) * * @param string $term - Raw search term @@ -248,6 +248,3 @@ class PostgresSearchResultSet extends SearchResultSet { } } } - - - diff --git a/includes/SearchTsearch2.php b/includes/SearchTsearch2.php index d4c6cee509..c922b1f878 100644 --- a/includes/SearchTsearch2.php +++ b/includes/SearchTsearch2.php @@ -116,7 +116,4 @@ class SearchTsearch2 extends SearchEngine { $dbw->query( $sql, __METHOD__ ); } - } - - diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index 849d6dc71c..a436c357a1 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -95,11 +95,11 @@ class SearchUpdate { wfProfileOut( "$fname-regexps" ); wfRunHooks( 'SearchUpdate', array( $this->mId, $this->mNamespace, $this->mTitle, &$text ) ); - + # Perform the actual update $search->update($this->mId, Title::indexTitle( $this->mNamespace, $this->mTitle ), $text); - + wfProfileOut( $fname ); } } @@ -111,5 +111,3 @@ class SearchUpdate { class SearchUpdateMyISAM extends SearchUpdate { # Inherits everything } - - diff --git a/includes/Setup.php b/includes/Setup.php index 44137410f3..ecdb819158 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -10,7 +10,7 @@ if( !defined( 'MEDIAWIKI' ) ) { echo "This file is part of MediaWiki, it is not a valid entry point.\n"; exit( 1 ); -} +} # The main wiki script and things like database # conversion and maintenance scripts all share a @@ -63,7 +63,7 @@ if ( empty( $wgFileStore['deleted']['directory'] ) ) { * Initialise $wgLocalFileRepo from backwards-compatible settings */ if ( !$wgLocalFileRepo ) { - $wgLocalFileRepo = array( + $wgLocalFileRepo = array( 'class' => 'LocalRepo', 'name' => 'local', 'directory' => $wgUploadDirectory, @@ -101,7 +101,7 @@ if ( $wgUseSharedUploads ) { 'fetchDescription' => $wgFetchCommonsDescriptions, ); } else { - $wgForeignFileRepos[] = array( + $wgForeignFileRepos[] = array( 'class' => 'FSRepo', 'name' => 'shared', 'directory' => $wgSharedUploadDirectory, @@ -223,7 +223,7 @@ $wgLang = new StubUserLang; $wgOut = new StubObject( 'wgOut', 'OutputPage' ); $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); -$wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache', +$wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache', array( $parserMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry, wfWikiID() ) ); wfProfileOut( $fname.'-globals' ); @@ -232,7 +232,7 @@ wfProfileIn( $fname.'-User' ); # Skin setup functions # Entries can be added to this variable during the inclusion # of the extension file. Skins can then perform any necessary initialisation. -# +# foreach ( $wgSkinExtensionFunctions as $func ) { call_user_func( $func ); } @@ -286,5 +286,3 @@ wfDebug( "Fully initialised\n" ); $wgFullyInitialised = true; wfProfileOut( $fname.'-extensions' ); wfProfileOut( $fname ); - - diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index d9629a0dd3..6cdd508222 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -54,7 +54,7 @@ class SiteConfiguration { } return $retval; } - + /** Type-safe string replace; won't do replacements on non-strings */ function doReplace( $from, $to, $in ) { if( is_string( $in ) ) { @@ -146,5 +146,3 @@ class SiteConfiguration { } } } - - diff --git a/includes/SiteStats.php b/includes/SiteStats.php index d7b9161ab0..3b10f4a0c2 100644 --- a/includes/SiteStats.php +++ b/includes/SiteStats.php @@ -27,10 +27,10 @@ class SiteStats { $dbr = wfGetDB( DB_SLAVE ); self::$row = $dbr->selectRow( 'site_stats', '*', false, __METHOD__ ); } - + self::$loaded = true; } - + static function loadAndLazyInit() { wfDebug( __METHOD__ . ": reading site_stats from slave\n" ); $row = self::doLoad( wfGetDB( DB_SLAVE ) ); @@ -40,24 +40,24 @@ class SiteStats { wfDebug( __METHOD__ . ": site_stats damaged or missing on slave\n" ); $row = self::doLoad( wfGetDB( DB_MASTER ) ); } - + if( !self::isSane( $row ) ) { // Normally the site_stats table is initialized at install time. // Some manual construction scenarios may leave the table empty or // broken, however, for instance when importing from a dump into a // clean schema with mwdumper. wfDebug( __METHOD__ . ": initializing damaged or missing site_stats\n" ); - + global $IP; require_once "$IP/maintenance/initStats.inc"; - + ob_start(); wfInitStats(); ob_end_clean(); - + $row = self::doLoad( wfGetDB( DB_MASTER ) ); } - + if( !self::isSane( $row ) ) { wfDebug( __METHOD__ . ": site_stats persistently nonsensical o_O\n" ); } @@ -92,7 +92,7 @@ class SiteStats { self::load(); return self::$row->ss_users; } - + static function images() { self::load(); return self::$row->ss_images; @@ -117,7 +117,7 @@ class SiteStats { } return self::$jobs; } - + static function pagesInNs( $ns ) { wfProfileIn( __METHOD__ ); if( !isset( self::$pageCount[$ns] ) ) { @@ -236,4 +236,3 @@ class SiteStatsUpdate { */ } } - diff --git a/includes/Skin.php b/includes/Skin.php index 4aaf86122f..1cc1c3f731 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -105,7 +105,7 @@ class Skin extends Linker { */ static function &newFromKey( $key ) { global $wgStyleDirectory; - + $key = Skin::normalizeKey( $key ); $skinNames = Skin::getSkinNames(); @@ -160,14 +160,14 @@ class Skin extends Linker { if( false !== $wgFavicon ) { $out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) ); } - + if( false !== $wgAppleTouchIcon ) { $out->addLink( array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) ); - } + } # OpenSearch description link - $out->addLink( array( - 'rel' => 'search', + $out->addLink( array( + 'rel' => 'search', 'type' => 'application/opensearchdescription+xml', 'href' => "$wgScriptPath/opensearch_desc{$wgScriptExtension}", 'title' => wfMsgForContent( 'opensearch-desc' ), @@ -176,7 +176,7 @@ class Skin extends Linker { $this->addMetadataLinks($out); $this->mRevisionId = $out->mRevisionId; - + $this->preloadExistence(); wfProfileOut( __METHOD__ ); @@ -203,7 +203,7 @@ class Skin extends Linker { $lb = new LinkBatch( $titles ); $lb->execute(); } - + function addMetadataLinks( &$out ) { global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf; global $wgRightsPage, $wgRightsUrl; @@ -304,7 +304,7 @@ class Skin extends Linker { $ns = $wgTitle->getNamespace(); $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText(); - $vars = array( + $vars = array( 'skin' => $data['skinname'], 'stylepath' => $wgStylePath, 'wgArticlePath' => $wgArticlePath, @@ -646,7 +646,7 @@ END; $colon = wfMsgExt( 'colon-separator', 'escapenoentities' ); if ( !empty( $allCats['normal'] ) ) { $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $allCats['normal'] ) . $pop; - + $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escapenoentities' ), count( $allCats['normal'] ) ); $s .= '