WordPress.org

Plugin Directory

Changeset 416334


Ignore:
Timestamp:
07/28/11 11:59:55 (3 years ago)
Author:
pross
Message:

(hopefully) textdomain fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • theme-check/trunk/checks/textdomain.php

    r415480 r416334  
    1313 
    1414        $checks = array( 
    15         '/[\s|\(]_[e|_]\s?\(\s?[\'|"][^\'|"]*[\'|"]\s?\)/' => __( 'You have not included a text domain!', 'themecheck' ), 
    16         '/[\s|\(]_x\s?\(\s?[\'|"][^\'|"]*[\'|"]\s?,\s?[\'|"][^\'|"]*[\'|"]\s?\)/' => __( 'You have not included a text domain!', 'themecheck' ) 
     15        '/[\s|\(]_[e|_]\s?\(\s?[\'|"][^\'|"]*[\'|"]\s?\)/' => __( 'You have not included a text domain!', 'themecheck' ) 
    1716         ); 
    1817 
    1918        foreach ( $php_files as $php_key => $phpfile ) { 
    20         foreach ( $checks as $key => $check ) { 
    21         checkcount(); 
    22             if ( preg_match_all( $key, $phpfile, $matches ) ) { 
     19            $error = ''; 
     20            foreach ( $checks as $key => $check ) { 
     21                checkcount(); 
     22                if ( preg_match_all( $key, $phpfile, $matches ) || preg_match_all( '/[\s|\(]_x\s?\(\s?[\'|"][^\'|"]*[\'|"]\s?,\s?[\'|"][^\'|"]*[\'|"]\s?\)/', $phpfile, $matches )) { 
    2323                 
    2424                    $filename = tc_filename( $php_key ); 
    25                      
    26                     foreach ($matches[0] as $match ) {           
    27                         $error .= tc_grep( ltrim( $match ), $php_key ); 
     25                    foreach ($matches[0] as $match ) { 
     26                        $grep = tc_grep( ltrim( $match ), $php_key ); 
     27                        preg_match( '/Line\s[0-9]+/', $grep, $line); 
     28                        $error .= ( !strpos( $error, $line[0] ) ) ? $grep : '';      
    2829                    } 
    29                     $this->error[] = __( "<span class='tc-lead tc-recommended'>RECOMMENDED</span>: Text domain problems in <strong>{$filename}</strong>. {$check}{$error}", "themecheck" ); 
     30                $this->error[] = __( "<span class='tc-lead tc-recommended'>RECOMMENDED</span>: Text domain problems in <strong>{$filename}</strong>. {$check}{$error}", "themecheck" ); 
    3031                } 
    3132            } 
Note: See TracChangeset for help on using the changeset viewer.