Fix strict notices in makepot.

props jdgrimes.
fixes #29254.

git-svn-id: https://develop.svn.wordpress.org/trunk@29563 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-08-21 02:53:16 +00:00
parent 2736174b9b
commit 2b3bf48338
2 changed files with 9 additions and 5 deletions

View File

@ -28,10 +28,12 @@ class StringExtractor {
foreach ( $file_names as $file_name ) {
if ( '.' == $file_name || '..' == $file_name ) continue;
if ( preg_match( '/\.php$/', $file_name ) && $this->does_file_name_match( $prefix . $file_name, $excludes, $includes ) ) {
$translations->merge_originals_with( $this->extract_from_file( $file_name, $prefix ) );
$extracted = $this->extract_from_file( $file_name, $prefix );
$translations->merge_originals_with( $extracted );
}
if ( is_dir( $file_name ) ) {
$translations->merge_originals_with( $this->extract_from_directory( $file_name, $excludes, $includes, $prefix . $file_name . '/' ) );
$extracted = $this->extract_from_directory( $file_name, $excludes, $includes, $prefix . $file_name . '/' );
$translations->merge_originals_with( $extracted );
}
}
chdir( $old_cwd );

View File

@ -32,17 +32,19 @@ class PotExtMeta {
}
function load_from_file($ext_filename) {
$source = MakePOT::get_first_lines($ext_filename);
$makepot = new MakePOT;
$source = $makepot->get_first_lines($ext_filename);
$pot = '';
$po = new PO;
foreach($this->headers as $header) {
$string = MakePOT::get_addon_header($header, $source);
$string = $makepot->get_addon_header($header, $source);
if (!$string) continue;
$args = array(
'singular' => $string,
'extracted_comments' => $header.' of the plugin/theme',
);
$entry = new Translation_Entry($args);
$pot .= "\n".PO::export_entry($entry)."\n";
$pot .= "\n".$po->export_entry($entry)."\n";
}
return $pot;
}