jenkins-bot has submitted this change and it was merged.

Change subject: change global name, fix whitespace, rename alias file, modernize
......................................................................


change global name, fix whitespace, rename alias file, modernize

Change-Id: Ie3651ad9d7c5f3c4c837575ca8087e9b2c98e731
---
R SimpleChanges.alias.php
M SimpleChanges.php
M SpecialSimpleChanges.php
M i18n/qqq.json
4 files changed, 46 insertions(+), 55 deletions(-)

Approvals:
  Siebrand: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SpecialSimpleChanges.alias.php b/SimpleChanges.alias.php
similarity index 100%
rename from SpecialSimpleChanges.alias.php
rename to SimpleChanges.alias.php
diff --git a/SimpleChanges.php b/SimpleChanges.php
index 63a2f3b..70aff9f 100644
--- a/SimpleChanges.php
+++ b/SimpleChanges.php
@@ -3,36 +3,34 @@
  * SimpleChanges - Special page that displays a barebones Recent Changes list
  *
  * To activate this extension, add the following into your LocalSettings.php 
file:
- * require_once('$IP/SimpleChanges/SimpleChanges.php');
+ * require_once "$IP/extensions/SimpleChanges/SimpleChanges.php";
  *
  * @ingroup Extensions
  * @author Ike Hecht
- * @version 0.1
+ * @version 0.2
  * @link https://www.mediawiki.org/wiki/Extension:SimpleChanges Documentation
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
-
-if( !defined( 'MEDIAWIKI' ) ) {
-        echo( "This is an extension to the MediaWiki package and cannot be run 
standalone.\n" );
-        die( -1 );
+if ( !defined( 'MEDIAWIKI' ) ) {
+       echo( "This is an extension to the MediaWiki package and cannot be run 
standalone.\n" );
+       die( -1 );
 }
 
 // Extension credits that will show up on Special:Version
 $wgExtensionCredits['specialpage'][] = array(
-        'path'           => __FILE__,
-        'name'           => 'SimpleChanges',
-        'version'        => '0.1',
-        'author'         => 'Ike Hecht for [http://www.wikiworks.com/ 
WikiWorks]',
-        'url'            => 
'https://www.mediawiki.org/wiki/Extension:SimpleChanges',
-        'descriptionmsg' => 'simplechanges-desc',
+       'path' => __FILE__,
+       'name' => 'SimpleChanges',
+       'version' => '0.2',
+       'author' => 'Ike Hecht for [http://www.wikiworks.com/ WikiWorks]',
+       'url' => 'https://www.mediawiki.org/wiki/Extension:SimpleChanges',
+       'descriptionmsg' => 'simplechanges-desc',
 );
 
 $wgAutoloadClasses['SpecialSimpleChanges'] = __DIR__ . 
'/SpecialSimpleChanges.php';
 $wgSpecialPages['SimpleChanges'] = 'SpecialSimpleChanges';
-$wgSpecialPageGroups['SimpleChanges'] = 'redirects';
 $wgExtensionMessagesFiles['SimpleChanges'] = __DIR__ . 
'/SimpleChanges.i18n.php';
 $wgMessageDirs['SimpleChanges'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['SimpleChangesAlias'] = __DIR__ . 
'/SpecialSimpleChanges.alias.php';
+$wgExtensionMessagesFiles['SimpleChangesAlias'] = __DIR__ . 
'/SimpleChanges.alias.php';
 
 # Restrict list of changes to $wgContentNamespaces?
-$scOnlyContentNamespaces = false;
+$wgSimpleChangesOnlyContentNamespaces = false;
diff --git a/SpecialSimpleChanges.php b/SpecialSimpleChanges.php
index 9993ea2..052d125 100644
--- a/SpecialSimpleChanges.php
+++ b/SpecialSimpleChanges.php
@@ -1,7 +1,6 @@
 <?php
 
 class SpecialSimpleChanges extends SpecialRecentChanges {
-
        public function __construct( $name = 'SimpleChanges' ) {
                parent::__construct( $name );
        }
@@ -13,14 +12,15 @@
         * @return array
         */
        public function buildMainQueryConds( FormOptions $opts ) {
-               global $wgContentNamespaces, $scOnlyContentNamespaces;
+               global $wgContentNamespaces, 
$wgSimpleChangesOnlyContentNamespaces;
 
                $conds = parent::buildMainQueryConds( $opts );
 
                # don't count log entries toward limit of number of changes 
displayed
                $conds[] = 'rc_type != ' . RC_LOG;
 
-               if( $opts['namespace'] == '' && $scOnlyContentNamespaces && 
$wgContentNamespaces != null ) {
+               if ( $opts['namespace'] == '' && 
$wgSimpleChangesOnlyContentNamespaces &&
+                       $wgContentNamespaces != null ) {
                        $contentNamespaces = $wgContentNamespaces;
 
                        $condition = '(rc_namespace = ' . array_shift( 
$contentNamespaces );
@@ -31,39 +31,38 @@
                        $conds[] = $condition;
                }
 
-               return  $conds;
+               return $conds;
        }
 
        /**
         * Creates the choose namespace selection
         *
-        * @todo Uses radio buttons (HASHAR)
         * @param FormOptions $opts
         * @return string
         */
        protected function namespaceFilterForm( FormOptions $opts ) {
-               global $scOnlyContentNamespaces;
+               global $wgSimpleChangesOnlyContentNamespaces;
 
-               if ( !$scOnlyContentNamespaces ) {
+               if ( !$wgSimpleChangesOnlyContentNamespaces ) {
                        return parent::namespaceFilterForm( $opts );
                }
-               $nonContentNamespaces = array_diff ( 
MWNamespace::getValidNamespaces(), MWNamespace::getContentNamespaces() );
-               //borrowed from parent class
-               //If scOnlyContentNamespaces is true, we need to change the 
namespace selector to only show content namespaces.
+               $nonContentNamespaces = array_diff( 
MWNamespace::getValidNamespaces(),
+                       MWNamespace::getContentNamespaces() );
+               //Borrowed from parent class.
+               //If $wgSimpleChangesOnlyContentNamespaces is true, we need to 
change the namespace
+               //selector to only show content namespaces.
                $nsSelect = Html::namespaceSelector(
-                       array( 'selected' => $opts['namespace'], 'all' => '', 
'exclude' => $nonContentNamespaces ),
-                       array( 'name' => 'namespace', 'id' => 'namespace' )
+                               array( 'selected' => $opts['namespace'], 'all' 
=> '', 'exclude' => $nonContentNamespaces ),
+                               array( 'name' => 'namespace', 'id' => 
'namespace' )
                );
                $nsLabel = Xml::label( $this->msg( 
'simplechanges-contentnamespace' )->text(), 'namespace' );
                $invert = Xml::checkLabel(
-                       $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
-                       $opts['invert'],
-                       array( 'title' => $this->msg( 'tooltip-invert' 
)->text() )
+                               $this->msg( 'invert' )->text(), 'invert', 
'nsinvert', $opts['invert'],
+                               array( 'title' => $this->msg( 'tooltip-invert' 
)->text() )
                );
                $associated = Xml::checkLabel(
-                       $this->msg( 'namespace_association' )->text(), 
'associated', 'nsassociated',
-                       $opts['associated'],
-                       array( 'title' => $this->msg( 
'tooltip-namespace_association' )->text() )
+                               $this->msg( 'namespace_association' )->text(), 
'associated', 'nsassociated',
+                               $opts['associated'], array( 'title' => 
$this->msg( 'tooltip-namespace_association' )->text() )
                );
 
                return array( $nsLabel, "$nsSelect $invert $associated" );
@@ -71,52 +70,46 @@
 
        /**
         * Send output to the OutputPage object, only called if not used feeds
-        * This function is a modified combination of 
SpecialRecentchanges::webOutput() (the parent) &
+        * This function is a modified combination of 
SpecialRecentchanges::outputChangesList() &
         * ChangesList::recentChangesLine()
         *
         * @param $rows Array of database rows
         * @param $opts FormOptions
         */
-       public function webOutput( $rows, $opts ) {
+       public function outputChangesList( $rows, $opts ) {
                $limit = $opts['limit'];
-
-               if( !$this->including() ) {
-                       // Output options box - the legend will use message 
'recentchanges-legend' which is not ideal.
-                       $this->doHeader( $opts );
-               }
 
                $counter = 1;
                $list = ChangesList::newFromContext( $this->getContext() );
 
-               $s = $list->beginRecentChangesList();
+               $rclistOutput = $list->beginRecentChangesList();
 
-               $s .= "\n<ul class=\"special\">\n";
-               foreach( $rows as $obj ) {
-                       if( $limit == 0 ) {
+               $rclistOutput .= "\n<ul class=\"special\">\n";
+               foreach ( $rows as $obj ) {
+                       if ( $limit == 0 ) {
                                break;
                        }
                        $rc = RecentChange::newFromRow( $obj );
                        $rc->counter = $counter++;
 
-                       $classes = array();
                        $changeLine = false;
 
-                       if( $rc->mAttribs['rc_log_type'] ) {
-                       // Log entries (old format) or log targets, and special 
pages
-                       } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) 
{
-                       // Regular entries
+                       if ( $rc->mAttribs['rc_log_type'] ) {
+                               // Log entries (old format) or log targets, and 
special pages
+                       } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL 
) {
+                               // Regular entries
                        } else {
                                $list->insertArticleLink( $changeLine, $rc, 
false, false );
-                               $changeLine = "<li class=\"" . implode( ' ', 
$classes ) . "\">" . $changeLine . "</li>\n";
+                               $changeLine = "<li>" . $changeLine . "</li>\n";
                        }
 
                        if ( $changeLine !== false ) {
-                               $s .= $changeLine;
+                               $rclistOutput .= $changeLine;
                                --$limit;
                        }
                }
-               $s .= "\n</ul>\n";
-               $s .= $list->endRecentChangesList();
-               $this->getOutput()->addHTML( $s );
+               $rclistOutput .= "\n</ul>\n";
+               $rclistOutput .= $list->endRecentChangesList();
+               $this->getOutput()->addHTML( $rclistOutput );
        }
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 80cf7e8..8f1e249 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -8,5 +8,5 @@
        "simplechanges": "{{doc-special|SimpleChanges}}",
        "simplechanges-desc": "{{desc|name=Simple 
Changes|url=http://www.mediawiki.org/wiki/Extension:SimpleChanges}}";,
        "simplechanges-summary": "Summary of [[Special:SimpleChanges]].",
-       "simplechanges-contentnamespace": "Displayed in the namespace form 
instead of {{msg-mw|Namespace}} when extension set to only display content 
namespaces (<code>$scOnlyContentNamespaces</code>)."
+       "simplechanges-contentnamespace": "Displayed in the namespace form 
instead of {{msg-mw|Namespace}} when extension set to only display content 
namespaces (<code>$wgSimpleChangesOnlyContentNamespaces</code>)."
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/160914
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3651ad9d7c5f3c4c837575ca8087e9b2c98e731
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/SimpleChanges
Gerrit-Branch: master
Gerrit-Owner: tosfos <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
Gerrit-Reviewer: tosfos <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to