WordPress.org

Plugin Directory

Changeset 415475


Ignore:
Timestamp:
07/26/11 15:53:37 (3 years ago)
Author:
pross
Message:

new regex checking for _x() props Vicky.

File:
1 edited

Legend:

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

    r413393 r415475  
    99        $error = ''; 
    1010        checkcount(); 
    11         if ( $data['Name'] === 'Twenty Ten' ) return $ret; 
     11        if ( $data['Name'] === 'Twenty Ten' || $data['Name'] === 'Twenty Eleven') 
     12            return $ret; 
    1213 
    1314        $checks = array( 
     
    3031 
    3132        $checks = array( 
    32         '/_[e|_]\([^,|;]*,\s?[\'|"]([^\'|"]*)[\'|"]\s?\)/' => __( 'Text domain should match theme slug: <strong>' . $themename . '</strong>', 'themecheck' ) ); 
     33        '/_[e|_]\([^,|;]*,\s?[\'|"]([^\'|"]*)[\'|"]\s?\)/' => __( 'Text domain should match theme slug: <strong>' . $themename . '</strong>', 'themecheck' ), 
     34        '/_x\s?\([^,]*,\s[^\'|"]*[\'|"][^\'|"]*[\'|"],\s?[\'|"]([^\'|"]*)[\'|"]\s?\)/' => __( 'Text domain should match theme slug: <strong>' . $themename . '</strong>', 'themecheck' ) 
     35         ); 
    3336        foreach ( $php_files as $php_key => $phpfile ) { 
    3437            foreach ( $checks as $key => $check ) { 
     
    3639                if ( preg_match_all( $key, $phpfile, $matches ) ) { 
    3740                    foreach ($matches[0] as $count => $domaincheck) { 
    38                         if ( preg_match( '/_[e|_]\(\s?[\'|"][^\'|"]*[\'|"]\s?\)/', $domaincheck ) ) unset( $matches[1][$count] ); //filter out false positives 
     41                        if ( preg_match( '/_[e|_]\(\s?[\'|"][^\'|"]*[\'|"]\s?\)/', $domaincheck ) ) 
     42                            unset( $matches[1][$count] ); //filter out false positives 
    3943                    } 
    4044                    $filename = tc_filename( $php_key ); 
     
    4347                        if ( $matches[1][$count] !== $themename ) { 
    4448                            $error = tc_grep( $matches[0][$count], $php_key ); 
    45                             if ( $matches[1][$count] === 'twentyten' ): 
     49                            if ( $matches[1][$count] === 'twentyten' || $matches[1][$count] === 'twentyeleven' ): 
    4650                                $this->error[] = __( "<span class='tc-lead tc-recommended'>RECOMMENDED</span>: Text domain problems in <strong>{$filename}</strong>. The twentyten text domain is being used!{$error}", "themecheck" ); 
    4751                            else: 
Note: See TracChangeset for help on using the changeset viewer.