Changeset 19321


Ignore:
Timestamp:
02/21/12 16:12:47 (3 years ago)
Author:
nacin
Message:

Allow PotExtMeta::append() to accept an array of headers to extract. Allows for the extraction of, say, Template Name.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/trunk/pot-ext-meta.php

    r12019 r19321  
    4848        } 
    4949 
    50         function append($ext_filename, $pot_filename) { 
    51             if (is_dir($ext_filename)) { 
    52             $pot = implode('', array_map(array(&$this, 'load_from_file'), glob("$ext_filename/*.php"))); 
    53             } else { 
    54                     $pot = $this->load_from_file($ext_filename); 
     50        function append( $ext_filename, $pot_filename, $headers = null ) { 
     51                if ( $headers ) 
     52                        $this->headers = (array) $headers; 
     53                if ( is_dir( $ext_filename ) ) { 
     54                        $pot = implode('', array_map(array(&$this, 'load_from_file'), glob("$ext_filename/*.php"))); 
     55                } else { 
     56                        $pot = $this->load_from_file($ext_filename); 
    5557                } 
    5658                $potf = '-' == $pot_filename? STDOUT : fopen($pot_filename, 'a'); 
     
    6466$included_files = get_included_files(); 
    6567if ($included_files[0] == __FILE__) { 
    66     ini_set('display_errors', 1); 
     68        ini_set('display_errors', 1); 
    6769        $potextmeta = new PotExtMeta; 
    6870        if (!isset($argv[1])) { 
    6971                $potextmeta->usage(); 
    7072        } 
    71         $potextmeta->append($argv[1], isset($argv[2])? $argv[2] : '-'); 
     73        $potextmeta->append( $argv[1], isset( $argv[2] ) ? $argv[2] : '-', isset( $argv[3] ) ? $argv[3] : null ); 
    7274} 
    7375 
Note: See TracChangeset for help on using the changeset viewer.