/** * Constructs a suitable checker for given message group. * @param $group MessageGroup */ public function __construct( MessageGroup $group ) { if ( self::$globalBlacklist === null ) { $file = dirname( __FILE__ ) . '/check-blacklist.php'; $list = PHPVariableLoader::loadVariableFromPHPFile( $file, 'checkBlacklist' ); $keys = array( 'group', 'check', 'subcheck', 'code', 'message' ); foreach ( $list as $key => $pattern ) { foreach ( $keys as $checkKey ) { if ( !isset( $pattern[$checkKey] ) ) { $list[$key][$checkKey] = '#'; } elseif ( is_array( $pattern[$checkKey] ) ) { $list[$key][$checkKey] = array_map( array( $this, 'foldValue' ), $pattern[$checkKey] ); } else { $list[$key][$checkKey] = $this->foldValue( $pattern[$checkKey] ); } } } self::$globalBlacklist = $list; } $this->group = $group; }
public function load($code) { $file = $this->getMessageFileWithPath($code); // Can return null, convert to array. $messages = (array) $this->mangler->mangle(PHPVariableLoader::loadVariableFromPHPFile($file, 'messages')); if ($this->parentId) { if (!$this->isSourceLanguage($code)) { // For branches, load newer compatible messages for missing entries, if any. $trunk = MessageGroups::getGroup($this->parentId); $messages += $trunk->mangler->unmangle($trunk->load($code)); } } return $messages; }