http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65343
Revision: 65343
Author: siebrand
Date: 2010-04-20 21:24:33 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
stylize.php, indentation updated
Modified Paths:
--------------
trunk/extensions/CategoryOnUpload/CategoryOnUpload.php
Modified: trunk/extensions/CategoryOnUpload/CategoryOnUpload.php
===================================================================
--- trunk/extensions/CategoryOnUpload/CategoryOnUpload.php 2010-04-20
21:19:10 UTC (rev 65342)
+++ trunk/extensions/CategoryOnUpload/CategoryOnUpload.php 2010-04-20
21:24:33 UTC (rev 65343)
@@ -1,5 +1,4 @@
<?php
-
/**
* CategoryOnUpload Extension
*
@@ -8,7 +7,7 @@
* Warning: Should not be enabled on wikis with lots of categories.
*
* @ingroup Extensions
- *
+ *
* @link http://www.mediawiki.org/wiki/Extension:CategoryOnUpload
*
* @author Robert Leverington <[email protected]>
@@ -17,7 +16,7 @@
*/
// Ensure accessed via a valid entry point.
-if( !defined( 'MEDIAWIKI' ) ) die( 'Invalid entry point.' );
+if ( !defined( 'MEDIAWIKI' ) ) die( 'Invalid entry point.' );
// Register extension credits.
$wgExtensionCredits[ 'other' ][] = array(
@@ -45,7 +44,6 @@
* Adds a category selection box to the end of the default UploadForm table.
*/
function efCategoryOnUploadForm( $uploadFormObj ) {
-
/* Get the database prefix, needed for 1.12 to do custom query. When
1.13
* is released it can be removed and the category table used instead.
*/
@@ -73,11 +71,8 @@
/* If permitted output the "none" option.
*/
- if( $wgCategoryOnUploadAllowNone ) {
-
- $cat .=
- Xml::option( wfMsg(
'categoryonupload-none' ), '#' );
-
+ if ( $wgCategoryOnUploadAllowNone ) {
+ $cat .= Xml::option( wfMsg( 'categoryonupload-none' ), '#' );
}
/* Get deault category, to compare with category option being output,
so the
@@ -85,8 +80,7 @@
*/
global $wgCategoryOnUploadDefault, $wgCategoryOnUploadList;
- if( !is_array( $wgCategoryOnUploadList ) ) {
-
+ if ( !is_array( $wgCategoryOnUploadList ) ) {
/* Get a database read object.
*/
$dbr = wfGetDB( DB_SLAVE );
@@ -98,7 +92,7 @@
* interface could be created; but when it was developed only a
few needed
* to be displayed so this was not an issue. Fallback to the
select box is
* essential no matter what improvements are made.
- *
+ *
* It would be nice to use the category table to avoid having
to do a
* manual query and perhaps improve performance, but it appears
to not
* descriminate between existing and non-existing categories,
this would be
@@ -114,23 +108,21 @@
* of resources. If this becomes an issue simply remove the #
comments and
* comment out the first line.
*/
- while( $row = $dbr->fetchObject( $res ) ) {
-
+ while ( $row = $dbr->fetchObject( $res ) ) {
$text = str_replace( '_', ' ', $row->cl_to );
- #$title = Title::newFromText( $row->cl_to, NS_CATEGORY
);
- #$text = $title->getText();
+ # $title = Title::newFromText( $row->cl_to, NS_CATEGORY
);
+ # $text = $title->getText();
/* Add option to output, if it is the default then make
it selected too.
*/
$cat .= Xml::option( $text, $row->cl_to, ( $text ==
$wgCategoryOnUploadDefault ) );
}
-
} else {
- foreach( $wgCategoryOnUploadList as $category ) {
+ foreach ( $wgCategoryOnUploadList as $category ) {
$text = str_replace( '_', ' ', $category );
- #$title = Title::newFromText( $row->cl_to, NS_CATEGORY
);
- #$text = $title->getText();
+ # $title = Title::newFromText( $row->cl_to, NS_CATEGORY
);
+ # $text = $title->getText();
/* Add option to output, if it is the default then make
it selected too.
*/
@@ -140,9 +132,8 @@
/* Close all the open elements, finished generation.
*/
- $cat .=
- Xml::closeElement( 'select' ) .
- Xml::closeElement( 'td' ) .
+ $cat .= Xml::closeElement( 'select' ) .
+ Xml::closeElement( 'td' ) .
Xml::closeElement( 'tr' );
/* Add the category selector to the start of the form so that other
@@ -156,14 +147,12 @@
* generated.
*/
return true;
-
}
/**
* Append the category statement to the end of the upload summary.
*/
function efCategoryOnUploadProcess( $uploadFormObj ) {
-
/* Get the request object.
*/
global $wgRequest;
@@ -175,7 +164,7 @@
/* Append the category statement to the end of the upload summary if the
* cateogry is not '#' (indicating no category to be added).
*/
- if( $cat != '#' ) {
+ if ( $cat != '#' ) {
$uploadFormObj->mComment .= "\n" . '[[Category:' .
$wgRequest->getText( 'wpUploadCategory' ) . ']]';
}
@@ -183,5 +172,4 @@
* generated.
*/
return true;
-
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs