wp_get_l10n_php_file_data()WP 6.6.0

Extracts headers from a PHP translation file.

Хуков нет.

Возвращает

Строку[]. Array of file header values keyed by header name.

Использование

wp_get_l10n_php_file_data( $php_file );
$php_file(строка) (обязательный)
Path to a .l10n.php file.

Список изменений

С версии 6.6.0 Введена.

Код wp_get_l10n_php_file_data() WP 6.6.2

function wp_get_l10n_php_file_data( $php_file ) {
	$data = (array) include $php_file;

	unset( $data['messages'] );
	$headers = array(
		'POT-Creation-Date'  => 'pot-creation-date',
		'PO-Revision-Date'   => 'po-revision-date',
		'Project-Id-Version' => 'project-id-version',
		'X-Generator'        => 'x-generator',
	);

	$result = array(
		'POT-Creation-Date'  => '',
		'PO-Revision-Date'   => '',
		'Project-Id-Version' => '',
		'X-Generator'        => '',
	);

	foreach ( $headers as $po_header => $php_header ) {
		if ( isset( $data[ $php_header ] ) ) {
			$result[ $po_header ] = $data[ $php_header ];
		}
	}

	return $result;
}