MediaWikiMessageGroup.php
Go to the documentation of this file.00001 <?php
00016 class MediaWikiMessageGroup extends FileBasedMessageGroup {
00017 public function mapCode( $code ) {
00018 return ucfirst( str_replace( '-', '_', parent::mapCode( $code ) ) );
00019 }
00020
00021 public function getTags( $type = null ) {
00022 $path = $this->getFromConf( 'BASIC', 'metadataPath' );
00023
00024 if ( $path === null ) {
00025 throw new MWException( "metadataPath is not configured." );
00026 }
00027
00028 $filename = "$path/messageTypes.inc";
00029
00030 if ( !is_readable( $filename ) ) {
00031 throw new MWException( "$filename is not readable." );
00032 }
00033
00034 $data = file_get_contents( $filename );
00035
00036 if ( $data === false ) {
00037 throw new MWException( "Failed to read $filename." );
00038 }
00039
00040 $reader = new ConfEditor( $data );
00041 $vars = $reader->getVars();
00042
00043 $tags = array();
00044 $tags['optional'] = $vars['wgOptionalMessages'];
00045 $tags['ignored'] = $vars['wgIgnoredMessages'];
00046
00047 if ( !$type ) {
00048 return $tags;
00049 }
00050
00051 if ( isset( $tags[$type] ) ) {
00052 return $tags[$type];
00053 }
00054
00055 return array();
00056 }
00057 }