? hook_filter_tips.patch ? hook_profile_alter_removed.patch ? hook_user_complete_removed.patch ? optional_block_review.patch ? t_format_plural_signature_change.patch ? coder_review/tests/coder_review_tests ? coder_review/tests/coder_review_tests.tar.gz Index: coder_review/includes/coder_review_7x.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/coder/coder_review/includes/coder_review_7x.inc,v retrieving revision 1.36 diff -u -p -r1.36 coder_review_7x.inc --- coder_review/includes/coder_review_7x.inc 1 Sep 2009 14:34:02 -0000 1.36 +++ coder_review/includes/coder_review_7x.inc 1 Sep 2009 19:31:13 -0000 @@ -11,6 +11,7 @@ */ function coder_review_7x_reviews() { $argex = '(((&?\$?)[a-zA-Z_]+((\([^)]*\))|\[[^\]]*\])?)|[0-9]+(\.[0-9]*)?|\'\'|"")'; + $argsep = '\s*,\s*'; $taxonomy_tables = '\{(term_data|term_hierarchy|term_node|term_relation|term_synonym|vocabulary|vocabulary_node_types)\}'; $rules = array( @@ -788,6 +789,17 @@ function coder_review_7x_reviews() { // Multilingual // http://drupal.org/node/224333#locale_context --- Added string context support to t() and format_plural(), changed parameters + array( + '#type' => 'regex', + '#value' => '[\s\(]t\s*\(\s*(.*?' . $argsep . '){2,}([\'"].*?[\'"])\s*\)', + '#warning_callback' => '_coder_review_7x_t_signature_warning', + ), + + array( + '#type' => 'regex', + '#value' => '[\s\(]format_plural\s*\(\s*(.*?' . $argsep . '){4,}([\'"].*?[\'"])\s*\)', + '#warning_callback' => '_coder_review_7x_format_plural_signature_warning', + ), // Misc @@ -1912,3 +1924,23 @@ function _coder_review_7x_select_count_w '#link' => 'http://drupal.org/node/224333#select_count', ); } + +function _coder_review_7x_t_signature_warning() { + return array( + '#warning' => t('Context has been added to !t() as the third parameter, locale has to be an element in the array. Example: array("context" => "frontpage", "locale" => "de").', + array( + '!t()' => theme('drupalapi', 't()', 7), + )), + '#link' => 'http://drupal.org/node/224333#locale_context', + ); +} + +function _coder_review_7x_format_plural_signature_warning() { + return array( + '#warning' => t('Context has been added to !format_plural() as the fifth parameter, locale has to be an element in the array. Example: array("context" => "frontpage", "locale" => "de").', + array( + '!format_plural()' => theme('drupalapi', 'format_plural()', 7), + )), + '#link' => 'http://drupal.org/node/224333#locale_context', + ); +} Index: coder_review/tests/coder_review_7x.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/coder/coder_review/tests/coder_review_7x.test,v retrieving revision 1.32 diff -u -p -r1.32 coder_review_7x.test --- coder_review/tests/coder_review_7x.test 1 Sep 2009 14:26:22 -0000 1.32 +++ coder_review/tests/coder_review_7x.test 1 Sep 2009 19:31:14 -0000 @@ -559,6 +559,14 @@ class CoderReviewUpgrade7xTest extends C function testMultilingual7x() { // http://drupal.org/node/224333#locale_context + $this->assertCoderReviewFail(" t('Welcome to our site', array(), 'de');"); + $this->assertCoderReviewFail(' t("Welcome to our site", array(), "de");'); + $this->assertCoderReviewFail(" t('!user, welcome to our site', array('!user' => theme('username', \$user)), 'de');"); + $this->assertCoderReviewPass(" t('Welcome to our site', array(), array('langcode' => 'de'));"); + $this->assertCoderReviewPass(" t('!user, welcome to our site', array('!user' => theme('username', \$user)), array('langcode' => 'de'));"); + + $this->assertCoderReviewFail(" format_plural(\$count, '1 comment', '@count comments', array(), 'de');"); + $this->assertCoderReviewPass(" format_plural(\$count, '1 comment', '@count comments', array(), array('langcode' => 'de'));"); } function testMisc7x() {