$phpfile ) { $error=''; $stmts = array(); foreach ( array('_e(', '__(', '_e (', '__ (') as $finder) { $search = $phpfile; while ( ( $pos = strpos($search, $finder) ) !== false ) { $search = substr($search,$pos); $open=1; $i=strpos($search,'(')+1; while( $open>0 ) { switch($search[$i]) { case '(': $open++; break; case ')': $open--; break; } $i++; } $stmts[] = substr($search,0,$i); $search = substr($search,$i); } } foreach ( $stmts as $match ) { $tokens = @token_get_all('error[] = sprintf(''.__('RECOMMENDED','theme-check').': '.__('Possible variable %1$s found in translation function in %2$s. Translation function calls must NOT contain PHP variables. %3$s','theme-check'), '' . $token[1] . '', '' . $filename . '', $error ); break; // stop looking at the tokens on this line once a variable is found } } } } } return $ret; } function getError() { return $this->error; } } $themechecks[] = new I18NCheck;