WP_Translation_File::create
Creates a new WP_Translation_File instance for a given file.
Метод класса: WP_Translation_File{}
Хуков нет.
Возвращает
false|WP_Translation_File.
Использование
$result = WP_Translation_File::create( $file, ?string $filetype );
- $file(строка) (обязательный)
- File name.
- ?string $filetype
- .
По умолчанию: null
Список изменений
| С версии 6.5.0 | Введена. |
Код WP_Translation_File::create() WP Translation File::create WP 6.8.3
public static function create( string $file, ?string $filetype = null ) {
if ( ! is_readable( $file ) ) {
return false;
}
if ( null === $filetype ) {
$pos = strrpos( $file, '.' );
if ( false !== $pos ) {
$filetype = substr( $file, $pos + 1 );
}
}
switch ( $filetype ) {
case 'mo':
return new WP_Translation_File_MO( $file );
case 'php':
return new WP_Translation_File_PHP( $file );
default:
return false;
}
}