wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_get_pomo_file_data › WordPress Function
Since3.7.0
已弃用n/a
› wp_get_pomo_file_data ( $po_file )
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Extracts headers from a PO file.
Related Functions: wp_get_l10n_php_file_data, get_file_data, wp_get_update_data, get_inline_data, get_theme_file_path
源码
function wp_get_pomo_file_data( $po_file ) {
$headers = get_file_data(
$po_file,
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 ( array_keys( $result ) as $header ) {
$value = $headers[ $header ];
// Remove possible closing double quote and the contextual '\n' preceding it.
if ( str_ends_with( $value, '"' ) ) {
$value = substr( $value, 0, -1 );
if ( str_ends_with( $value, '\n' ) ) {
$value = substr( $value, 0, -2 );
}
}
$result[ $header ] = $value;
}
return $result;
}