summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/scripts/poimport.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/scripts/poimport.php')
-rw-r--r--www/wiki/extensions/Translate/scripts/poimport.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/www/wiki/extensions/Translate/scripts/poimport.php b/www/wiki/extensions/Translate/scripts/poimport.php
index df32a2fb..a07481d5 100644
--- a/www/wiki/extensions/Translate/scripts/poimport.php
+++ b/www/wiki/extensions/Translate/scripts/poimport.php
@@ -5,7 +5,7 @@
* @author Niklas Laxström
* @author Siebrand Mazeland
* @copyright Copyright © 2007-2013 Niklas Laxström, Siebrand Mazeland
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
* @file
*/
@@ -18,7 +18,7 @@ if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
}
require_once "$IP/maintenance/Maintenance.php";
-class PoImport extends Maintenance {
+class Poimport extends Maintenance {
public function __construct() {
parent::__construct();
$this->mDescription = 'Po file importer (does not make changes unless specified).';
@@ -45,7 +45,7 @@ class PoImport extends Maintenance {
public function execute() {
// Parse the po file.
$p = new PoImporter( $this->getOption( 'file' ) );
- $p->setProgressCallback( array( $this, 'myOutput' ) );
+ $p->setProgressCallback( [ $this, 'myOutput' ] );
list( $changes, $group ) = $p->parse();
if ( !count( $changes ) ) {
@@ -61,7 +61,7 @@ class PoImport extends Maintenance {
!$this->hasOption( 'really' )
);
- $w->setProgressCallback( array( $this, 'myOutput' ) );
+ $w->setProgressCallback( [ $this, 'myOutput' ] );
$w->execute();
}
@@ -69,7 +69,7 @@ class PoImport extends Maintenance {
* Public alternative for protected Maintenance::output() as we need to get
* messages from the ChangeSyncer class to the commandline.
* @param string $text The text to show to the user
- * @param string $channel Unique identifier for the channel.
+ * @param string|null $channel Unique identifier for the channel.
* @param bool $error Whether this is an error message
*/
public function myOutput( $text, $channel = null, $error = false ) {
@@ -138,7 +138,7 @@ class PoImporter {
$data = file_get_contents( $this->file );
$data = str_replace( "\r\n", "\n", $data );
- $matches = array();
+ $matches = [];
if ( preg_match( '/X-Language-Code:\s+(.*)\\\n/', $data, $matches ) ) {
$code = $matches[1];
$this->reportProgress( "Detected language as $code", 'code' );
@@ -165,9 +165,9 @@ class PoImporter {
$quotePattern = '/(^"|"$\n?)/m';
$sections = preg_split( '/\n{2,}/', $data );
- $changes = array();
+ $changes = [];
foreach ( $sections as $section ) {
- $matches = array();
+ $matches = [];
if ( preg_match( "/^msgctxt\s($poformat)/mx", $section, $matches ) ) {
// Remove quoting
$key = preg_replace( $quotePattern, '', $matches[1] );
@@ -179,7 +179,7 @@ class PoImporter {
} else {
continue;
}
- $matches = array();
+ $matches = [];
if ( preg_match( "/^msgstr\s($poformat)/mx", $section, $matches ) ) {
// Remove quoting
$translation = preg_replace( $quotePattern, '', $matches[1] );
@@ -210,7 +210,7 @@ class PoImporter {
}
}
- return array( $changes, $groupId );
+ return [ $changes, $groupId ];
}
}
@@ -223,7 +223,7 @@ class WikiWriter {
protected $user;
- private $changes = array();
+ private $changes = [];
private $dryrun = true;
private $group = null;
@@ -318,5 +318,5 @@ class WikiWriter {
}
}
-$maintClass = 'PoImport';
+$maintClass = Poimport::class;
require_once RUN_MAINTENANCE_IF_MAIN;