Created
January 15, 2011 16:46
-
-
Save Pross/781036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TextDomainCheck implements themecheck { | |
protected $error = array(); | |
function check( $php_files, $css_files, $other_files) { | |
$ret = true; | |
$php = implode(' ', $php_files); | |
$css = implode(' ', $css_files); | |
checkcount(); | |
if ( strpos( $css, 'Theme Name: Twenty Ten' ) ) return $ret; | |
if ( preg_match( '/[__|_e]\(\s?[\'|"].*[\'|"],\s?[\'|"]twentyten[\'|"]\s?\)/', $php ) ) { | |
$this->error[] = "<span class='tc-lead tc-warning'>WARNING</span>: Theme is using <strong>twentyten</strong> as the textdomain!"; | |
$ret = false; | |
return $ret; | |
} | |
if ( preg_match( '/[__|_e]\(/', $php ) && !preg_match( '/_[_|e]\(\s?["|\'].*[\'|"],\s[\'|"][a-z-?]+["|\']\s?\)/', $php, $out) ) { | |
$this->error[] = "<span class='tc-lead tc-warning'>WARNING</span>: Theme is using i18n but there is no textdomain!"; | |
$ret = false; | |
return $ret; | |
} | |
return $ret; | |
} | |
function getError() { return $this->error; } | |
} | |
$themechecks[] = new TextDomainCheck; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment