wp_get_pomo_file_data

Extract headers from a PO file.

Description

(array) wp_get_pomo_file_data( (string) $po_file ); 

Returns (array)

PO file headers.

Parameters (1)

0. $po_file (string)
Path to PO file.

Usage

  1. if ( !function_exists( 'wp_get_pomo_file_data' ) ) { 
  2. require_once ABSPATH . WPINC . '/l10n.php'; 
  3.  
  4. // Path to PO file. 
  5. $po_file = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_get_pomo_file_data($po_file); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/l10n.php  
  1. function wp_get_pomo_file_data( $po_file ) { 
  2. $headers = get_file_data( $po_file, array( 
  3. 'POT-Creation-Date' => '"POT-Creation-Date',  
  4. 'PO-Revision-Date' => '"PO-Revision-Date',  
  5. 'Project-Id-Version' => '"Project-Id-Version',  
  6. 'X-Generator' => '"X-Generator',  
  7. ) ); 
  8. foreach ( $headers as $header => $value ) { 
  9. // Remove possible contextual '\n' and closing double quote. 
  10. $headers[ $header ] = preg_replace( '~(\\\n)?"$~', '', $value ); 
  11. return $headers;