MediaWiki REL1_34
digit2html.php
Go to the documentation of this file.
1<?php
24require_once __DIR__ . '/../Maintenance.php';
25
31class Digit2Html extends Maintenance {
32
33 # A list of unicode numerals is available at:
34 # https://www.fileformat.info/info/unicode/category/Nd/list.htm
35 private $mLangs = [
36 'Ar', 'As', 'Bh', 'Bo', 'Dz',
37 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
38 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
39 'New', 'Or', 'Pa', 'Pi', 'Sa'
40 ];
41
42 public function __construct() {
43 parent::__construct();
44 $this->addDescription( 'Check digit transformation' );
45 }
46
47 public function execute() {
48 foreach ( $this->mLangs as $code ) {
49 $filename = Language::getMessagesFileName( $code );
50 $this->output( "Loading language [$code] ... " );
51 unset( $digitTransformTable );
52 require_once $filename;
53 if ( !isset( $digitTransformTable ) ) {
54 $this->error( "\$digitTransformTable not found for lang: $code" );
55 continue;
56 }
57
58 $this->output( "OK\n\$digitTransformTable = [\n" );
59 foreach ( $digitTransformTable as $latin => $translation ) {
60 $htmlent = bin2hex( $translation );
61 $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
62 }
63 $this->output( "];\n" );
64 }
65 }
66}
67
68$maintClass = Digit2Html::class;
69require_once RUN_MAINTENANCE_IF_MAIN;
const RUN_MAINTENANCE_IF_MAIN
$digitTransformTable
Maintenance script that check digit transformation.
execute()
Do the actual work.
__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