WordPress.org

Make WordPress Core

Changeset 36600


Ignore:
Timestamp:
02/20/2016 09:02:33 PM (5 years ago)
Author:
ocean90
Message:

i18n-tools: Add the ability to parse a whole directory with add-textdomain.php.

Props iamntz.
Fixes #35499.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/i18n/add-textdomain.php

    r36599 r36600  
    9494$included_files = get_included_files();
    9595if ($included_files[0] == __FILE__) {
    96     $adddomain = new AddTextdomain;
     96    $adddomain = new AddTextdomain();
    9797
    9898    if (!isset($argv[1]) || !isset($argv[2])) {
     
    107107    }
    108108
    109     $adddomain->process_file($argv[1], $argv[2], $inplace);
     109    if ( is_dir( $argv[2] ) ) {
     110        $directory = new RecursiveDirectoryIterator( $argv[2], RecursiveDirectoryIterator::SKIP_DOTS );
     111        $files = new RecursiveIteratorIterator( $directory );
     112        foreach ( $files as $file ) {
     113            if ( 'php' === $file->getExtension() ) {
     114                $adddomain->process_file( $argv[1], $file->getPathname(), $inplace );
     115            }
     116        }
     117    } else {
     118        $adddomain->process_file( $argv[1], $argv[2], $inplace );
     119    }
    110120}
    111 
    112 ?>
Note: See TracChangeset for help on using the changeset viewer.