https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115615
Revision: 115615
Author: reedy
Date: 2012-07-17 21:25:44 +0000 (Tue, 17 Jul 2012)
Log Message:
-----------
Stylize stuff and trailing whitespace
Modified Paths:
--------------
trunk/extensions/CommentPages/CommentPages.php
Modified: trunk/extensions/CommentPages/CommentPages.php
===================================================================
--- trunk/extensions/CommentPages/CommentPages.php 2012-07-16 18:46:39 UTC
(rev 115614)
+++ trunk/extensions/CommentPages/CommentPages.php 2012-07-17 21:25:44 UTC
(rev 115615)
@@ -38,45 +38,45 @@
$page = '';
$query = '';
- if ($namespace == $wgCommentPagesContentNamespace ||
+ if ( $namespace == $wgCommentPagesContentNamespace ||
$namespace == $wgCommentPagesContentNamespace + 1 ) {
- $comments = Title::makeTitleSafe( $wgCommentPagesNS, $pagename);
+ $comments = Title::makeTitleSafe( $wgCommentPagesNS, $pagename
);
$newcontent_actions = array();
- if (!$comments->exists()) {
+ if ( !$comments->exists() ) {
$class = 'new';
$query = array( 'action' => 'edit', 'redlink' => 1 );
- if (wfMsg('commenttab-preload') != '') {
+ if ( wfMsg('commenttab-preload') != '' ) {
$query['preload'] = wfMsg('commenttab-preload');
}
- if (wfMsg('commenttab-editintro') != '') {
+ if ( wfMsg('commenttab-editintro') != '' ) {
$query['editintro'] =
wfMsg('commenttab-editintro');
}
} else {
$class = '';
}
-
+
$newcontent_actions['comments'] = array(
'class' => $class,
'text' => wfMsg('nstab-comments'),
- 'href' => $comments->getFullURL($query),
+ 'href' => $comments->getFullURL( $query ),
);
-
+
$insertAfter = $title->getNamespaceKey();
- if ( isset($content_actions['talk']) ) {
+ if ( isset( $content_actions['talk'] ) ) {
$insertAfter = 'talk';
}
-
+
$content_actions = efCommentPagesArrayInsertAfter(
$content_actions,
$newcontent_actions,
$insertAfter );
- } elseif ($namespace == $wgCommentPagesNS) {
- $main = Title::makeTitleSafe( $wgCommentPagesContentNamespace,
$pagename);
+ } elseif ( $namespace == $wgCommentPagesNS ) {
+ $main = Title::makeTitleSafe( $wgCommentPagesContentNamespace,
$pagename );
$talk = $main->getTalkPage();
$newcontent_actions = array();
- if (!$main->exists()) {
+ if ( !$main->exists() ) {
$class = 'new';
$query = 'action=edit&redlink=1';
} else {
@@ -93,10 +93,10 @@
$newcontent_actions['article'] = array(
'class' => $class,
'text' => $articleText,
- 'href' => $main->getFullURL($query),
+ 'href' => $main->getFullURL( $query ),
);
- if (!$talk->exists()) {
+ if ( !$talk->exists() ) {
$class = 'new';
$query = 'action=edit';
} else {
@@ -106,15 +106,17 @@
$newcontent_actions['talk'] = array(
'class' => $class,
'text' => wfMsg( 'talk' ),
- 'href' => $talk->getFullURL($query),
+ 'href' => $talk->getFullURL( $query ),
);
foreach ($content_actions as $key => $value) {
- if ($key != 'talk')
+ if ( $key != 'talk' ) {
$newcontent_actions[$key] = $value;
+ }
- if ($key == 'nstab-comments')
+ if ( $key == 'nstab-comments' ) {
$newcontent_actions['nstab-comments']['text'] =
wfMsg( 'nstab-comments' );
+ }
}
$content_actions = $newcontent_actions;
@@ -134,14 +136,14 @@
// Find the offset of the element to insert after.
$keys = array_keys($array);
$offsetByKey = array_flip( $keys );
-
+
$offset = $offsetByKey[$after];
-
+
// Insert at the specified offset
$before = array_slice( $array, 0, $offset + 1, true );
$after = array_slice( $array, $offset + 1, count($array)-$offset, true
);
-
+
$output = $before + $insert + $after;
-
+
return $output;
}
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits