MediaWiki  master
digit2html.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/../Maintenance.php';
25 
31 class Digit2Html extends Maintenance {
32 
37  private $mLangs = [
38  'Ar', 'As', 'Bh', 'Bo', 'Dz',
39  'Fa', 'Gu', 'Hi', 'Km', 'Kn',
40  'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
41  'New', 'Or', 'Pa', 'Pi', 'Sa'
42  ];
43 
44  public function __construct() {
45  parent::__construct();
46  $this->addDescription( 'Check digit transformation' );
47  }
48 
49  public function execute() {
50  foreach ( $this->mLangs as $code ) {
51  $filename = Language::getMessagesFileName( $code );
52  $this->output( "Loading language [$code] ..." );
53  unset( $digitTransformTable );
54  require_once $filename;
55  if ( !isset( $digitTransformTable ) ) {
56  $this->error( "\$digitTransformTable not found for lang: $code" );
57  continue;
58  }
59 
60  $this->output( "OK\n\$digitTransformTable = [\n" );
61  foreach ( $digitTransformTable as $latin => $translation ) {
62  $htmlent = bin2hex( $translation );
63  $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
64  }
65  $this->output( "];\n" );
66  }
67  }
68 }
69 
70 $maintClass = Digit2Html::class;
71 require_once RUN_MAINTENANCE_IF_MAIN;
$digitTransformTable
Definition: MessagesAr.php:86
Maintenance script that check digit transformation.
Definition: digit2html.php:31
execute()
Do the actual work.
Definition: digit2html.php:49
__construct()
Default constructor.
Definition: digit2html.php:44
static getMessagesFileName( $code)
Definition: Language.php:4438
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: Maintenance.php:66
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
addDescription( $text)
Set the description text.
$maintClass
Definition: digit2html.php:70