WP_Translation_File_PHP::parse_file
Parses the file.
Method of the class: WP_Translation_File_PHP{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->parse_file();
Changelog
| Since 6.5.0 | Introduced. |
WP_Translation_File_PHP::parse_file() WP Translation File PHP::parse file code WP 6.9
protected function parse_file() {
$this->parsed = true;
$result = include $this->file;
if ( ! $result || ! is_array( $result ) ) {
$this->error = 'Invalid data';
return;
}
if ( isset( $result['messages'] ) && is_array( $result['messages'] ) ) {
foreach ( $result['messages'] as $original => $translation ) {
$this->entries[ (string) $original ] = $translation;
}
unset( $result['messages'] );
}
$this->headers = array_change_key_case( $result );
}