MediaWiki REL1_37
digit2html.php
Go to the documentation of this file.
1<?php
24require_once __DIR__ . '/../Maintenance.php';
25
31class 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;
71require_once RUN_MAINTENANCE_IF_MAIN;
$digitTransformTable
Maintenance script that check digit transformation.
execute()
Do the actual work.
string[] $mLangs
A list of unicode numerals is available at: https://www.fileformat.info/info/unicode/category/Nd/list...
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
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