MediaWiki master
digit2html.php
Go to the documentation of this file.
1<?php
25
26// @codeCoverageIgnoreStart
27require_once __DIR__ . '/../Maintenance.php';
28// @codeCoverageIgnoreEnd
29
35class Digit2Html extends Maintenance {
36
41 private $mLangs = [
42 'Ar', 'As', 'Bh', 'Bo', 'Dz',
43 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
44 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
45 'New', 'Or', 'Pa', 'Pi', 'Sa'
46 ];
47
48 public function __construct() {
49 parent::__construct();
50 $this->addDescription( 'Check digit transformation' );
51 }
52
53 public function execute() {
54 $languageNameUtils = $this->getServiceContainer()->getLanguageNameUtils();
55 foreach ( $this->mLangs as $code ) {
56 $filename = $languageNameUtils->getMessagesFileName( $code );
57 $this->output( "Loading language [$code] ..." );
58 unset( $digitTransformTable );
59 require_once $filename;
60 if ( !isset( $digitTransformTable ) ) {
61 $this->error( "\$digitTransformTable not found for lang: $code" );
62 continue;
63 }
64
65 $this->output( "OK\n\$digitTransformTable = [\n" );
66 foreach ( $digitTransformTable as $latin => $translation ) {
67 $htmlent = bin2hex( $translation );
68 $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
69 }
70 $this->output( "];\n" );
71 }
72 }
73}
74
75// @codeCoverageIgnoreStart
76$maintClass = Digit2Html::class;
77require_once RUN_MAINTENANCE_IF_MAIN;
78// @codeCoverageIgnoreEnd
$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...
output( $out, $channel=null)
Throw some output to the user.
error( $err, $die=0)
Throw an error to the user.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.
$maintClass