MediaWiki  REL1_21
digit2html.php
Go to the documentation of this file.
00001 <?php
00024 require_once( __DIR__ . '/../Maintenance.php' );
00025 
00031 class Digit2Html extends Maintenance {
00032 
00033         # A list of unicode numerals is available at:
00034         # http://www.fileformat.info/info/unicode/category/Nd/list.htm
00035         private $mLangs = array(
00036                 'Ar', 'As', 'Bh', 'Bo', 'Dz',
00037                 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
00038                 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
00039                 'New', 'Or', 'Pa', 'Pi', 'Sa'
00040         );
00041 
00042         public function __construct() {
00043                 parent::__construct();
00044                 $this->mDescription = "Check digit transformation";
00045         }
00046 
00047         public function execute() {
00048                 foreach ( $this->mLangs as $code ) {
00049                         $filename = Language::getMessagesFileName( $code );
00050                         $this->output( "Loading language [$code] ... " );
00051                         unset( $digitTransformTable );
00052                         require_once( $filename );
00053                         if ( !isset( $digitTransformTable ) ) {
00054                                 $this->error( "\$digitTransformTable not found for lang: $code" );
00055                                 continue;
00056                         }
00057 
00058                         $this->output( "OK\n\$digitTransformTable = array(\n" );
00059                         foreach ( $digitTransformTable as $latin => $translation ) {
00060                                 $htmlent = utf8ToHexSequence( $translation );
00061                                 $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
00062                         }
00063                         $this->output( ");\n" );
00064                 }
00065         }
00066 }
00067 
00068 $maintClass = "Digit2Html";
00069 require_once( RUN_MAINTENANCE_IF_MAIN );