=== modified file 'coder_review/coder_review.css'
--- coder_review/coder_review.css 2009-10-17 19:22:01 +0000
+++ coder_review/coder_review.css 2009-10-18 02:17:41 +0000
@@ -45,3 +45,11 @@ code.good {
.admin-coder {
font-size: 0.9em;
}
+
+pre {
+ white-space: pre-wrap; /* css-3 */
+ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
+}
=== modified file 'coder_review/coder_review.module'
--- coder_review/coder_review.module 2009-10-17 19:22:01 +0000
+++ coder_review/coder_review.module 2009-10-18 03:20:51 +0000
@@ -162,7 +162,7 @@ function coder_review_menu_alter(&$callb
* Modify the module display view by adding a Coder Review link to every
* module description.
*/
-function coder_review_form_alter(&$form, $form_state, $form_id) {
+function coder_review_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'system_modules' && (!isset($form['#theme']) || $form['#theme'] != 'confirm_form')) {
if (user_access('view code review')) {
$path = drupal_get_path('module', 'coder_review');
@@ -520,7 +520,8 @@ function _coder_review_settings_form($se
* Implement theme_cols to theme the radiobuttons and checkboxes form
* elements in a table column.
*/
-function theme_coder_review_table_cols($form) {
+function theme_coder_review_table_cols($variables) {
+ $form = $variables['form'];
$total = 0;
$cols = isset($form['#cols']) ? $form['#cols'] : 3;
foreach ($form as $element_id => $element) {
@@ -531,6 +532,7 @@ function theme_coder_review_table_cols($
$total = (int) (($total % $cols) ? (($total + $cols - 1) / $cols) : ($total / $cols));
$pos = 0;
$rows = array();
+
foreach ($form as $element_id => $element) {
if ($element_id[0] != '#') {
$pos ++;
@@ -539,10 +541,12 @@ function theme_coder_review_table_cols($
if (!isset($rows[$row])) {
$rows[$row] = array();
}
- $rows[$row][$col] = drupal_render($element);
+ $rows[$row][$col] = drupal_render($element);
}
}
- return theme('table', array(), $rows);
+
+ $output = theme('table', array('rows' => $rows, 'attributes' => array('id' => 'filter-order')));
+ return $output;
}
/**
@@ -730,8 +734,7 @@ function coder_review_page_form($form, &
if ($coder_form = _coder_review_settings_form($settings, $system, $files)) {
// Add style sheet.
- $path = drupal_get_path('module', 'coder_review');
- drupal_add_css($path . '/coder_review.css', 'module');
+ drupal_add_css(drupal_get_path('module', 'coder_review') . '/coder_review.css');
// Get the includes_exclusions settings once, it is used multiple times.
$coder_includes_exclusions = isset($settings['coder_includes_exclusions']) ? $settings['coder_includes_exclusions'] : '';
@@ -783,7 +786,7 @@ function coder_review_page_form($form, &
foreach ($system as $name => $checked) {
if ($checked) {
// Process this one file.
- $filename = $files[$name];
+ $filename = isset($files[$name]) ? $files[$name] : FALSE;
if (!$filename) {
drupal_set_message(t('Code Review file for %module not found', array('%module' => $name)));
continue;
@@ -819,7 +822,7 @@ function coder_review_page_form($form, &
$form[$name]['#collapsed'] = FALSE;
}
$form[$name]['output'] = array(
- '#markup' => theme('coder_review', $name, $filename, $results),
+ '#markup' => theme('coder_review', array('name' => $name, 'filename' => $filename, 'results' => $results)),
'#weight' => -1,
);
@@ -952,7 +955,7 @@ function _coder_review_page_form_include
$form[$name]['#collapsed'] = FALSE;
}
$form[$name][$filename]['output'] = array(
- '#markup' => theme('coder_review', $name, $filename, $results),
+ '#markup' => theme('coder_review', array('name' => $name, 'filename' => $filename, 'results' => $results)),
);
}
return $stats;
@@ -1034,7 +1037,8 @@ function do_coder_reviews($coder_args) {
// Theme the error messages.
foreach ($errors as $key => $error) {
if (is_numeric($key)) {
- $results[$key] = theme('coder_review_warning_msg', $error);
+ $error['warning'] = _coder_review_warning($error['rule']);
+ $results[$key] = theme('coder_review_warning_msg', array('error' => $error));
}
}
@@ -1042,7 +1046,7 @@ function do_coder_reviews($coder_args) {
ksort($results, SORT_NUMERIC);
}
else {
- $results[] = theme('coder_review_warning', t('Could not read the file'), 'critical');
+ $results[] = theme('coder_review_warning', array('warning' => t('Could not read the file'), 'severity_name' => 'critical'));
}
// Save the results in the cache if we're not reviewing a patch.
@@ -1598,6 +1602,9 @@ function do_coder_review($coder_args, $r
case 'callback':
do_coder_review_callback($coder_args, $review, $rule, $lines, $results);
break;
+ case 'hook':
+ do_coder_review_hook($coder_args, $review, $rule, $lines, $results);
+ break;
}
}
}
@@ -1771,6 +1778,27 @@ function do_coder_review_callback(&$code
}
/**
+ * Check for the presence of a hook.
+ *
+ * @note
+ * See do_coder_review_regex() for arguments.
+ */
+function do_coder_review_hook(&$coder_args, $review, $rule, $lines, &$results) {
+ if (($module_name = basename($coder_args['#filename'], '.module')) && !empty($rule['#value'])) {
+ $hook = array('#value' => ' ' . $module_name . '_' . $rule['#value'] . '(');
+ foreach ($lines as $lineno => $line_array) {
+ foreach ($line_array as $line) {
+ if (_coder_review_search_string($line, $hook)) {
+ $line = $coder_args['#all_lines'][$lineno];
+ $severity_name = _coder_review_severity_name($coder_args, $review, $rule);
+ _coder_review_error($results, $rule, $severity_name, $lineno, $line);
+ }
+ }
+ }
+ }
+}
+
+/**
* Search for a string.
*
* Uses the fastest available php function for searching.
@@ -1880,11 +1908,42 @@ function coder_review_simpletest() {
*/
function coder_review_theme() {
return array(
- 'coder_review' => array('arguments' => array('name', 'filename', 'results')),
- 'coder_review_warning' => array('arguments' => array('warning', 'severity_name', 'lineno', 'line')),
- 'coder_review_warning_msg' => array('arguments' => array('error')),
- 'coder_review_table_cols' => array('arguments' => array('form')),
- 'drupalapi' => array('arguments' => array('function', 'version')),
+ 'coder_review' => array(
+ 'arguments' => array(
+ 'name' => NULL,
+ 'filename' => NULL,
+ 'results' => NULL,
+ ),
+ ),
+ 'coder_review_warning' => array(
+ 'arguments' => array(
+ 'warning' => NULL,
+ 'severity_name' => NULL,
+ 'lineno' => NULL,
+ 'line' => NULL,
+ ),
+ ),
+ 'coder_review_warning_msg' => array(
+ 'arguments' => array(
+ 'error' => NULL,
+ ),
+ ),
+ 'coder_review_table_cols' => array(
+ 'arguments' => array(
+ 'form' => NULL,
+ ),
+ ),
+ 'drupalapi' => array(
+ 'arguments' => array(
+ 'function' => NULL,
+ 'version' => substr(VERSION, 0,1),
+ ),
+ ),
+ 'phpapi' => array(
+ 'arguments' => array(
+ 'function' => NULL,
+ ),
+ ),
);
}
@@ -1898,15 +1957,19 @@ function coder_review_theme() {
* @param $results
* Array list of results HTML to display. See do_coder_reviews() for format.
*/
-function theme_coder_review($name, $filename, $results) {
+function theme_coder_review($variables) {
+ $name = $variables['name'];
+ $filename = $variables['filename'];
+ $results = $variables['results'];
+
// theme the output for the Drupal shell
if (function_exists('_coder_review_drush_is_option') && _coder_review_drush_is_option('drush')) {
- return theme_drush_coder_review($name, $filename, $results);
+ return theme_drush_coder_review(array('name' => $name, 'filename' => $filename, 'results' => $results));
}
$output = '
' . basename($filename) . '
';
if (!empty($results)) {
- $output .= theme('item_list', $results);
+ $output .= theme('item_list', array('items' => $results));
}
$output .= '';
return $output;
@@ -1920,10 +1983,17 @@ function theme_coder_review($name, $file
* @param $error
* Error array from _coder_review_error().
*/
-function theme_coder_review_warning_msg($error) {
+function theme_coder_review_warning_msg($variables) {
+ $error = $variables['error'];
// @TODO: we can combine theme_coder_review_warning() and theme_coder_review_warning_msg(),
// But let's do this on the 7.x upgrade in case anyone's actually using it.
- return theme('coder_review_warning', _coder_review_warning($error['rule']), $error['severity_name'], $error['lineno'], $error['line']);
+
+ return theme('coder_review_warning', array(
+ 'warning' => _coder_review_warning($error['rule']),
+ 'severity_name' => $error['severity_name'],
+ 'lineno' => $error['lineno'],
+ 'line' => $error['line']
+ ));
}
/**
@@ -1959,10 +2029,20 @@ function _coder_review_warning($rule) {
* @param $line
* String contents of line.
*/
-function theme_coder_review_warning($warning, $severity_name, $lineno = 0, $line = '') {
+function theme_coder_review_warning($variables) {
+ $warning = $variables['warning'];
+ $severity_name = $variables['severity_name'];
+ $lineno = $variables['lineno'];
+ $line = $variables['line'];
+
// theme the output for the Drupal shell
if (function_exists('_coder_review_drush_is_option') && _coder_review_drush_is_option('drush')) {
- return theme_drush_coder_review_warning($warning, $severity_name, $lineno, $line);
+ return theme_drush_coder_review_warning(array(
+ 'warning' => $warning,
+ 'severity_name' => $severity_name,
+ 'lineno' => $lineno,
+ 'line' => $line
+ ));
}
// Extract description from warning.
@@ -1986,9 +2066,14 @@ function theme_coder_review_warning($war
}
$path = drupal_get_path('module', 'coder');
$title = t('severity: @severity', array('@severity' => $severity_name));
- $img = theme('image', $path . "/images/$severity_name.png", $title, $title, array('align' => 'right', 'class' => 'coder'), FALSE);
+ $img = theme('image', array(
+ 'path' => $path . "/images/$severity_name.png",
+ 'alt' => $title, 'title' => $title,
+ 'attributes' => array('align' => 'right', 'class' => 'coder'),
+ 'getsize' => FALSE
+ ));
if (!empty($description)) {
- $img .= theme('image', $path . '/images/more.png', t('click to read more'), '', array('align' => 'right', 'class' => 'coder-more'), FALSE);
+ $img .= theme('image', array('path' => $path . '/images/more.png', 'alt' => t('click to read more'), 'atributes' => array('align' => 'right', 'class' => 'coder-more'), 'getsize' => FALSE));
$warning .= 'Explanation: ' . $description . '
';
}
return '' . $img . $warning . '
';
@@ -2002,7 +2087,10 @@ function theme_coder_review_warning($war
* @param $version
* Version to link to.
*/
-function theme_drupalapi($function, $version = '') {
+function theme_drupalapi($variables) {
+ $version = $variables['version'];
+ $function = $variables['function'];
+
return l($function, "http://api.drupal.org/api/function/$function/$version");
}
@@ -2012,6 +2100,7 @@ function theme_drupalapi($function, $ver
* @param $function
* Function to link to.
*/
-function theme_phpapi($function) {
+function theme_phpapi($variables) {
+ $function = $variables['function'];
return l($function, "http://us.php.net/$function");
}
=== modified file 'coder_review/includes/coder_review_47.inc'
--- coder_review/includes/coder_review_47.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_47.inc 2009-10-18 02:41:47 +0000
@@ -116,7 +116,7 @@ function coder_review_47_reviews() {
function _coder_review_47_hook_node_info_warning() {
return t('implement !hook_node_info() to create a module which defines node type(s)',
array(
- '!hook_node_info' => theme('drupalapi', 'hook_node_info'),
+ '!hook_node_info' => theme('drupalapi', array('function' => 'hook_node_info', 'version' => '4.7')),
)
);
}
@@ -124,7 +124,7 @@ function _coder_review_47_hook_node_info
function _coder_review_47_node_load_warning() {
return t('use !node_load($nid) instead of !node_load(array(\'nid\' => $nid))',
array(
- '!node_load' => theme('drupalapi', 'node_load'),
+ '!node_load' => theme('drupalapi', array('function' => 'node_load', 'version' => '4.7')),
)
);
}
@@ -132,7 +132,7 @@ function _coder_review_47_node_load_warn
function _coder_review_47_node_list_warning() {
return t('!node_list() became node_get_types and now returns an associative array about node types',
array(
- '!node_list' => theme('drupalapi', 'node_list'),
+ '!node_list' => theme('drupalapi', array('function' => 'node_list', 'version' => '4.7')),
)
);
}
@@ -140,8 +140,8 @@ function _coder_review_47_node_list_warn
function _coder_review_47_module_get_name_warning() {
return t('!module_get_node_name() deprecated and now handled by !node_get_base().',
array(
- '!module_get_node_name' => theme('drupalapi', 'module_get_node_name', '4.6'),
- '!node_get_base' => theme('drupalapi', 'node_get_base'),
+ '!module_get_node_name' => theme('drupalapi', array('function' => 'module_get_node_name', 'version' => '4.6')),
+ '!node_get_base' => theme('drupalapi', array('function' => 'node_get_base', 'version' => '4.7')),
)
);
}
@@ -149,8 +149,8 @@ function _coder_review_47_module_get_nam
function _coder_review_47_format_name_warning() {
return t('!format_name() was renamed to !theme_username()',
array(
- '!format_name' => theme('drupalapi', 'format_name', '4.6'),
- '!theme_username' => theme('drupalapi', 'theme_username'),
+ '!format_name' => theme('drupalapi', array('function' => 'format_name', 'version' => '4.6')),
+ '!theme_username' => theme('drupalapi', array('function' => 'theme_username', 'version' => '4.7')),
)
);
}
@@ -158,7 +158,7 @@ function _coder_review_47_format_name_wa
function _coder_review_47_message_access_warning() {
return t('!message_access() was removed, replace with a nice case error message',
array(
- '!message_access' => theme('drupalapi', 'message_access', '4.6'),
+ '!message_access' => theme('drupalapi', array('function' => 'message_access', 'version' => '4.6')),
)
);
}
@@ -166,8 +166,8 @@ function _coder_review_47_message_access
function _coder_review_47_conf_url_rewrite_warning() {
return t('!conf_url_rewrite() became !custom_url_rewrite()',
array(
- '!conf_url_rewrite' => theme('drupalapi', 'conf_url_rewrite', '4.6'),
- '!custom_url_rewrite' => theme('drupalapi', 'custom_url_rewrite'),
+ '!conf_url_rewrite' => theme('drupalapi', array('function' => 'conf_url_rewrite', 'version' => '4.6')),
+ '!custom_url_rewrite' => theme('drupalapi', array('function' => 'custom_url_rewrite', 'version' => '4.7')),
)
);
}
@@ -175,7 +175,7 @@ function _coder_review_47_conf_url_rewri
function _coder_review_47_node_delete_warning() {
return t('use !node_delete($nid) instead of !node_delete(array(\'nid\' => $nid))',
array(
- '!node_delete' => theme('drupalapi', 'node_delete'),
+ '!node_delete' => theme('drupalapi', array('function' => 'node_delete', 'version' => '4.7')),
)
);
}
@@ -183,7 +183,7 @@ function _coder_review_47_node_delete_wa
function _coder_review_47_file_directory_temp_warning() {
return t('use !file_directory_temp() function instead of variable',
array(
- '!file_directory_temp' => theme('drupalapi', 'file_directory_temp'),
+ '!file_directory_temp' => theme('drupalapi', array('function' => 'file_directory_temp', 'version' => '4.7')),
)
);
}
@@ -191,7 +191,7 @@ function _coder_review_47_file_directory
function _coder_review_47_file_directory_path_warning() {
return t('use !file_directory_path() function instead of variable',
array(
- '!file_directory_path' => theme('drupalapi', 'file_directory_path'),
+ '!file_directory_path' => theme('drupalapi', array('function' => 'file_directory_path', 'version' => '4.7')),
)
);
}
@@ -199,7 +199,7 @@ function _coder_review_47_file_directory
function _coder_review_47_array2object_warning() {
return t('!array2object() replaced by native PHP type conversion (typecase to (object)',
array(
- '!array2object' => theme('drupalapi', 'array2object', '4.6'),
+ '!array2object' => theme('drupalapi', array('function' => 'array2object', 'version' => '4.6')),
)
);
}
@@ -207,7 +207,7 @@ function _coder_review_47_array2object_w
function _coder_review_47_hook_onload_warning() {
return t('!hook_onload() replaced by javascript addLoadEvent()',
array(
- '!hook_onload' => theme('drupalapi', 'hook_onload', '4.6'),
+ '!hook_onload' => theme('drupalapi', array('function' => 'hook_onload', 'version' => '4.6')),
)
);
}
@@ -215,7 +215,7 @@ function _coder_review_47_hook_onload_wa
function _coder_review_47_node_validate_title_warning() {
return t('!node_validate_title() was removed',
array(
- '!node_validate_title' => theme('drupalapi', 'node_validate_title', '4.6'),
+ '!node_validate_title' => theme('drupalapi', array('function' => 'node_validate_title', 'version' => '4.6')),
)
);
}
@@ -223,7 +223,7 @@ function _coder_review_47_node_validate_
function _coder_review_47_node_tablesort_pager_warning() {
return t('!tablesort_pager() was removed',
array(
- '!tablesort_pager' => theme('drupalapi', 'tablesort_pager', '4.6'),
+ '!tablesort_pager' => theme('drupalapi', array('function' => 'tablesort_pager', 'version' => '4.6')),
)
);
}
=== modified file 'coder_review/includes/coder_review_5x.inc'
--- coder_review/includes/coder_review_5x.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_5x.inc 2009-10-17 22:49:49 +0000
@@ -107,8 +107,8 @@ function _coder_review_5x_callback_warni
function _coder_review_5x_user_mail_warning() {
return t('!user_mail() is replaced by !drupal_mail()',
array(
- '!user_mail' => theme('drupalapi', 'user_mail', '4.7'),
- '!drupal_mail' => theme('drupalapi', 'drupal_mail', '5'),
+ '!user_mail' => theme('drupalapi', array('function' => 'user_mail', 'version' => '4.7')),
+ '!drupal_mail' => theme('drupalapi', array('function' => 'drupal_mail', 'version' => '5')),
)
);
}
@@ -116,8 +116,8 @@ function _coder_review_5x_user_mail_warn
function _coder_review_5x_user_mail_wrapper_warning() {
return t('!user_mail_wrapper() changed to !drupal_mail_wrapper()',
array(
- '!user_mail_wrapper' => theme('drupalapi', 'user_mail_wrapper', '4.7'),
- '!drupal_mail_wrapper' => theme('drupalapi', 'drupal_mail_wrapper', '5'),
+ '!user_mail_wrapper' => theme('drupalapi', array('function' => 'user_mail_wrapper', 'version' => '4.7')),
+ '!drupal_mail_wrapper' => theme('drupalapi', array('function' => 'drupal_mail_wrapper', 'version' => '5')),
)
);
}
@@ -125,8 +125,8 @@ function _coder_review_5x_user_mail_wrap
function _coder_review_5x_message_na_warning() {
return t('The function !message_na() was removed, remove it from your modules as well and replace it with !t(\'n/a\')',
array(
- '!message_na' => theme('drupalapi', 'message_na', '4.7'),
- '!t' => theme('drupalapi', 't', '5'),
+ '!message_na' => theme('drupalapi', array('function' => 'message_na', 'version' => '4.7')),
+ '!t' => theme('drupalapi', array('function' => 't', 'version' => '5')),
)
);
}
@@ -134,8 +134,8 @@ function _coder_review_5x_message_na_war
function _coder_review_5x_module_exist_warning() {
return t('!module_exist() is now !module_exists()',
array(
- '!module_exist' => theme('drupalapi', 'module_exist', '4.7'),
- '!module_exists' => theme('drupalapi', 'module_exists', '5'),
+ '!module_exist' => theme('drupalapi', array('function' => 'module_exist', 'version' => '4.7')),
+ '!module_exists' => theme('drupalapi', array('function' => 'module_exists', 'version' => '5')),
)
);
}
@@ -143,8 +143,8 @@ function _coder_review_5x_module_exist_w
function _coder_review_5x_drupal_call_js_warning() {
return t('Remove !drupal_call_js(), use "!drupal_add_js(\'myCustomFunction(your, parameters, here)\', \'inline\');" instead',
array(
- '!drupal_call_js' => theme('drupalapi', 'drupal_call_js', '4.7'),
- '!drupal_add_js' => theme('drupalapi', 'drupal_add_js', '5'),
+ '!drupal_call_js' => theme('drupalapi', array('function' => 'drupal_call_js', 'version' => '4.7')),
+ '!drupal_add_js' => theme('drupalapi', array('function' => 'drupal_add_js', 'version' => '5')),
)
);
}
@@ -152,8 +152,8 @@ function _coder_review_5x_drupal_call_js
function _coder_review_5x_system_listing_warning() {
return t('!system_listing() is now !drupal_system_listing()',
array(
- '!system_listing' => theme('drupalapi', 'system_listing', '4.7'),
- '!drupal_system_listing' => theme('drupalapi', 'drupal_system_listing', '5'),
+ '!system_listing' => theme('drupalapi', array('function' => 'system_listing', 'version' => '4.7')),
+ '!drupal_system_listing' => theme('drupalapi', array('function' => 'drupal_system_listing', 'version' => '5')),
)
);
}
@@ -161,8 +161,8 @@ function _coder_review_5x_system_listing
function _coder_review_5x_theme_add_style_warning() {
return t('Replace !theme_add_style() with !drupal_add_css()',
array(
- '!theme_add_style' => theme('drupalapi', 'theme_add_style', '4.7'),
- '!drupal_add_css' => theme('drupalapi', 'drupal_add_css', '5'),
+ '!theme_add_style' => theme('drupalapi', array('function' => 'theme_add_style', 'version' => '4.7')),
+ '!drupal_add_css' => theme('drupalapi', array('function' => 'drupal_add_css', 'version' => '5')),
)
);
}
@@ -170,8 +170,8 @@ function _coder_review_5x_theme_add_styl
function _coder_review_5x_form_render_warning() {
return t('Replace !form_render() with !drupal_render()',
array(
- '!form_render' => theme('drupalapi', 'form_render', '4.7'),
- '!drupal_render' => theme('drupalapi', 'drupal_render', '5'),
+ '!form_render' => theme('drupalapi', array('function' => 'form_render', 'version' => '4.7')),
+ '!drupal_render' => theme('drupalapi', array('function' => 'drupal_render', 'version' => '5')),
)
);
}
@@ -179,8 +179,8 @@ function _coder_review_5x_form_render_wa
function _coder_review_5x_node_get_name_warning() {
return t('Replace !node_get_name($node) with !node_get_types(\'name\', $node)',
array(
- '!node_get_name' => theme('drupalapi', 'node_get_name', '4.7'),
- '!node_get_types' => theme('drupalapi', 'node_get_types', '5'),
+ '!node_get_name' => theme('drupalapi', array('function' => 'node_get_name', 'version' => '4.7')),
+ '!node_get_types' => theme('drupalapi', array('function' => 'node_get_types', 'version' => '5')),
)
);
}
=== modified file 'coder_review/includes/coder_review_6x.inc'
--- coder_review/includes/coder_review_6x.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_6x.inc 2009-10-17 22:49:49 +0000
@@ -594,7 +594,7 @@ function _coder_review_6x_form_alter_war
return array(
'#warning' => t('!hook_form_alter() parameters have changed',
array(
- '!hook_form_alter' => theme('drupalapi', 'hook_form_alter', '6'),
+ '!hook_form_alter' => theme('drupalapi', array('function' => 'hook_form_alter', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/144132#form-alter',
@@ -605,7 +605,7 @@ function _coder_review_6x_link_alter_war
return array(
'#warning' => t('!hook_link_alter() parameters have changed',
array(
- '!hook_link_alter' => theme('drupalapi', 'hook_link_alter', '6'),
+ '!hook_link_alter' => theme('drupalapi', array('function' => 'hook_link_alter', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#link-alter',
@@ -616,7 +616,7 @@ function _coder_review_6x_profile_alter_
return array(
'#warning' => t('!hook_profile_alter() parameters have changed',
array(
- '!hook_profile_alter' => theme('drupalapi', 'hook_profile_alter', '6'),
+ '!hook_profile_alter' => theme('drupalapi', array('function' => 'hook_profile_alter', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#profile-alter',
@@ -627,7 +627,7 @@ function _coder_review_6x_mail_alter_war
return array(
'#warning' => t('!hook_mail_alter() parameters have changed',
array(
- '!hook_mail_alter' => theme('drupalapi', 'hook_mail_alter', '6'),
+ '!hook_mail_alter' => theme('drupalapi', array('function' => 'hook_mail_alter', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#mail-alter',
@@ -638,7 +638,7 @@ function _coder_review_6x_hook_theme_war
return array(
'#warning' => t('new !hook_theme() function is required to register theme_ functions',
array(
- '!hook_theme' => theme('drupalapi', 'hook_theme', '6'),
+ '!hook_theme' => theme('drupalapi', array('function' => 'hook_theme', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#theme_registry',
@@ -649,8 +649,8 @@ function _coder_review_6x_url_l_warning(
return array(
'#warning' => t('!url() and !l() arguments changed, if you have a lot of these use this conversion script',
array(
- '!url' => theme('drupalapi', 'url', '6'),
- '!l' => theme('drupalapi', 'l', '6'),
+ '!url' => theme('drupalapi', array('function' => 'url', 'version' => '6')),
+ '!l' => theme('drupalapi', array('function' => 'l', 'version' => '6')),
'@script' => 'http://drupal.org/files/issues/replace.php_.txt',
)
),
@@ -662,10 +662,10 @@ function _coder_review_6x_taxonomy_node_
return array(
'#warning' => t('!taxonomy_node_get_terms(), !taxonomy_node_get_terms_by_vocabulary(), !taxonomy_node_save and !taxonomy_node_delete() now take a full $node object, not just a nid (node id).',
array(
- '!taxonomy_node_get_terms' => theme('drupalapi', 'taxonomy_node_get_terms', '6'),
- '!taxonomy_node_get_terms_by_vocabulary' => theme('drupalapi', 'taxonomy_node_get_terms_by_vocabulary', '6'),
- '!taxonomy_node_save' => theme('drupalapi', 'taxonomy_node_save', '6'),
- '!taxonomy_node_delete' => theme('drupalapi', 'taxonomy_node_delete', '6'),
+ '!taxonomy_node_get_terms' => theme('drupalapi', array('function' => 'taxonomy_node_get_terms', 'version' => '6')),
+ '!taxonomy_node_get_terms_by_vocabulary' => theme('drupalapi', array('function' => 'taxonomy_node_get_terms_by_vocabulary', 'version' => '6')),
+ '!taxonomy_node_save' => theme('drupalapi', array('function' => 'taxonomy_node_save', 'version' => '6')),
+ '!taxonomy_node_delete' => theme('drupalapi', array('function' => 'taxonomy_node_delete', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#taxonomy-revisions',
@@ -676,7 +676,7 @@ function _coder_review_6x_format_plural_
return array(
'#warning' => t('!format_plural() accepts replacements, you no longer need to use !strtr()',
array(
- '!format_plural' => theme('drupalapi', 'format_plural', '6'),
+ '!format_plural' => theme('drupalapi', array('function' => 'format_plural', 'version' => '6')),
'!strtr' => theme('phpapi', 'strtr'),
)
),
@@ -688,8 +688,8 @@ function _coder_review_6x_watchdog_warni
return array(
'#warning' => t('Parameters of !watchdog() changed, you must remove calls to !t()',
array(
- '!watchdog' => theme('drupalapi', 'watchdog', '6'),
- '!t' => theme('drupalapi', 't', '6'),
+ '!watchdog' => theme('drupalapi', array('function' => 'watchdog', 'version' => '6')),
+ '!t' => theme('drupalapi', array('function' => 't', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#watchdog_parameters',
@@ -700,7 +700,7 @@ function _coder_review_6x_cache_set_warn
return array(
'#warning' => t('Changes to !cache_set() parameter order',
array(
- '!cache_set' => theme('drupalapi', 'cache_set', '6'),
+ '!cache_set' => theme('drupalapi', array('function' => 'cache_set', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#cache-set-parameter-order',
@@ -711,8 +711,8 @@ function _coder_review_6x_cache_serializ
return array(
'#warning' => t('!cache_set() and !cache_get() automatically (un)serialize complex data types',
array(
- '!cache_set' => theme('drupalapi', 'cache_set', '6'),
- '!cache_get' => theme('drupalapi', 'cache_get', '6'),
+ '!cache_set' => theme('drupalapi', array('function' => 'cache_set', 'version' => '6')),
+ '!cache_get' => theme('drupalapi', array('function' => 'cache_get', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#cache-data-parameter',
@@ -723,7 +723,7 @@ function _coder_review_6x_remote_addr_wa
return array(
'#warning' => t('Use new !ip_address() function instead of $_SERVER[\'REMOTE_ADDR\']',
array(
- '!ip_address' => theme('drupalapi', 'ip_address', '6'),
+ '!ip_address' => theme('drupalapi', array('function' => 'ip_address', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#ip-address',
@@ -734,8 +734,8 @@ function _coder_review_6x_file_check_upl
return array(
'#warning' => t('!file_check_upload() merged into !file_save_upload()',
array(
- '!file_check_upload' => theme('drupalapi', 'file_check_upload', '5'),
- '!file_save_upload' => theme('drupalapi', 'file_save_upload', '6'),
+ '!file_check_upload' => theme('drupalapi', array('function' => 'file_check_upload', 'version' => '5')),
+ '!file_save_upload' => theme('drupalapi', array('function' => 'file_save_upload', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#file-check-upload',
@@ -746,7 +746,7 @@ function _coder_review_6x_file_save_uplo
return array(
'#warning' => t('Parameters for !file_save_upload() have changed',
array(
- '!file_save_upload' => theme('drupalapi', 'file_save_upload', '6'),
+ '!file_save_upload' => theme('drupalapi', array('function' => 'file_save_upload', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#file-check-upload',
@@ -792,7 +792,7 @@ function _coder_review_6x_form_set_value
return array(
'#warning' => t('!form_set_value() parameters have changed',
array(
- '!form_set_value' => theme('drupalapi', 'form_set_value', '6'),
+ '!form_set_value' => theme('drupalapi', array('function' => 'form_set_value', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/144132#set-value',
@@ -803,7 +803,7 @@ function _coder_review_6x_confirm_form_w
return array(
'#warning' => t('The arguments to !confirm_form() have changed',
array(
- '!confirm_form' => theme('drupalapi', 'confirm_form', '6'),
+ '!confirm_form' => theme('drupalapi', array('function' => 'confirm_form', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#confirm-form-args',
@@ -814,9 +814,9 @@ function _coder_review_6x_custom_url_rew
return array(
'#warning' => t('In place of !custom_url_rewrite(), use !custom_url_rewrite_inbound() or !custom_url_rewrite_outbound()',
array(
- '!custom_url_rewrite' => theme('drupalapi', 'custom_url_rewrite', '5'),
- '!custom_url_rewrite_inbound' => theme('drupalapi', 'custom_url_rewrite_inbound', '6'),
- '!custom_url_rewrite_outbound' => theme('drupalapi', 'custom_url_rewrite_outbound', '6'),
+ '!custom_url_rewrite' => theme('drupalapi', array('function' => 'custom_url_rewrite', 'version' => '5')),
+ '!custom_url_rewrite_inbound' => theme('drupalapi', array('function' => 'custom_url_rewrite_inbound', 'version' => '6')),
+ '!custom_url_rewrite_outbound' => theme('drupalapi', array('function' => 'custom_url_rewrite_outbound', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#custom-url-rewrite',
@@ -827,7 +827,7 @@ function _coder_review_6x_hook_info_auth
return array(
'#warning' => t('hook no longer exists, use !hook_form_alter() to swap your own validation handler',
array(
- '!hook_form_alter' => theme('drupalapi', 'hook_form_alter', '6'),
+ '!hook_form_alter' => theme('drupalapi', array('function' => 'hook_form_alter', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#dist-auth',
@@ -838,7 +838,7 @@ function _coder_review_6x_hook_help_warn
return array(
'#warning' => t('The arguments to !hook_help() have changed',
array(
- '!hook_help' => theme('drupalapi', 'hook_help', '6'),
+ '!hook_help' => theme('drupalapi', array('function' => 'hook_help', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#hook-help',
@@ -857,8 +857,8 @@ function _coder_review_6x_schema_api_war
function _coder_review_6x_theme_get_function_warning() {
return t('!theme_get_function() has been deprecated because of template theming; see !theme_get_registry()',
array(
- '!theme_get_function' => theme('drupalapi', 'theme_get_function', '5'),
- '!theme_get_registry' => theme('drupalapi', 'theme_get_registry', '6'),
+ '!theme_get_function' => theme('drupalapi', array('function' => 'theme_get_function', 'version' => '5')),
+ '!theme_get_registry' => theme('drupalapi', array('function' => 'theme_get_registry', 'version' => '6')),
)
);
}
@@ -867,7 +867,7 @@ function _coder_review_6x_db_num_rows_wa
return array(
'#warning' => t('!db_num_rows() has been deprecated',
array(
- '!db_num_rows' => theme('drupalapi', 'db_num_rows', '5'),
+ '!db_num_rows' => theme('drupalapi', array('function' => 'db_num_rows', 'version' => '5')),
)
),
'#link' => 'http://drupal.org/node/114774#db-num-rows',
@@ -879,7 +879,7 @@ function _coder_review_6x_drupal_retriev
return array(
'#warning' => t('Parameters for !drupal_retrieve_form() have changed, add $form_state as a second argument',
array(
- '!drupal_retrieve_form' => theme('drupalapi', 'drupal_retrieve_form', '6'),
+ '!drupal_retrieve_form' => theme('drupalapi', array('function' => 'drupal_retrieve_form', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/144132#retrieve-form',
@@ -908,9 +908,9 @@ function _coder_review_6x_node_access_re
return array(
'#warning' => t('!node_access_rebuild() should not be called from !hook_enable() or !hook_disable() functions any more.',
array(
- '!node_access_rebuild' => theme('drupalapi', 'node_access_rebuild', '6'),
- '!hook_enable' => theme('drupalapi', 'hook_enable', '6'),
- '!hook_disable' => theme('drupalapi', 'hook_disable', '6'),
+ '!node_access_rebuild' => theme('drupalapi', array('function' => 'node_access_rebuild', 'version' => '6')),
+ '!hook_enable' => theme('drupalapi', array('function' => 'hook_enable', 'version' => '6')),
+ '!hook_disable' => theme('drupalapi', array('function' => 'hook_disable', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#node_access_rebuild_batch',
@@ -942,8 +942,8 @@ function _coder_review_6x_locale_refresh
return array(
'#warning' => t('!locale_refresh_cache() is deprecated. Use !cache_clear_all() instead.',
array(
- '!locale_refresh_cache' => theme('drupalapi', 'locale_refresh_cache', '5'),
- '!cache_clear_all' => theme('drupalapi', 'cache_clear_all', '6'),
+ '!locale_refresh_cache' => theme('drupalapi', array('function' => 'locale_refresh_cache', 'version' => '5')),
+ '!cache_clear_all' => theme('drupalapi', array('function' => 'cache_clear_all', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#locale',
@@ -954,8 +954,8 @@ function _coder_review_6x_db_next_id_war
return array(
'#warning' => t('!db_next_id() is deprecated. Use !db_last_insert_id() instead.',
array(
- '!db_next_id' => theme('drupalapi', 'db_next_id', '5'),
- '!db_last_insert_id' => theme('drupalapi', 'db_last_insert_id', '6'),
+ '!db_next_id' => theme('drupalapi', array('function' => 'db_next_id', 'version' => '5')),
+ '!db_last_insert_id' => theme('drupalapi', array('function' => 'db_last_insert_id', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#db_last_insert_id',
@@ -966,9 +966,9 @@ function _coder_review_6x_menu_set_locat
return array(
'#warning' => t('!menu_set_location() is deprecated. Use !drupal_set_breadcrumb() to set a custom breadcrumb or !menu_set_item() to set the current location in the menu tree.',
array(
- '!menu_set_location' => theme('drupalapi', 'menu_set_location', '5'),
- '!drupal_set_breadcrumb' => theme('drupalapi', 'drupal_set_breadcrumb', '6'),
- '!menu_set_item' => theme('drupalapi', 'menu_set_item', '6'),
+ '!menu_set_location' => theme('drupalapi', array('function' => 'menu_set_location', 'version' => '5')),
+ '!drupal_set_breadcrumb' => theme('drupalapi', array('function' => 'drupal_set_breadcrumb', 'version' => '6')),
+ '!menu_set_item' => theme('drupalapi', array('function' => 'menu_set_item', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#menu_set_location',
@@ -979,8 +979,8 @@ function _coder_review_6x_taxonomy_get_v
return array(
'#warning' => t('!taxonomy_get_vocabulary() is deprecated. Use !taxonomy_vocabulary_load() instead.',
array(
- '!taxonomy_get_vocabulary' => theme('drupalapi', 'taxonomy_get_vocabulary', '5'),
- '!taxonomy_vocabulary_load' => theme('drupalapi', 'taxonomy_vocabulary_load', '6'),
+ '!taxonomy_get_vocabulary' => theme('drupalapi', array('function' => 'taxonomy_get_vocabulary', 'version' => '5')),
+ '!taxonomy_vocabulary_load' => theme('drupalapi', array('function' => 'taxonomy_vocabulary_load', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/114774#taxonomy-load',
@@ -991,7 +991,7 @@ function _coder_review_6x_watchdog_debug
return array(
'#warning' => t('Parameters of !watchdog() changed, you use $severity WATCHDOG_DEBUG instead of $type \'debug\'',
array(
- '!watchdog' => theme('drupalapi', 'watchdog', '6')
+ '!watchdog' => theme('drupalapi', array('function' => 'watchdog', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#watchdog_logging',
@@ -1002,7 +1002,7 @@ function _coder_review_6x_book_admin_orp
return array(
'#warning' => t('!book_admin_orphan() is deprecated',
array(
- '!book_admin_orphan' => theme('drupalapi', 'book_admin_orphan', '5')
+ '!book_admin_orphan' => theme('drupalapi', array('function' => 'book_admin_orphan', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1013,7 +1013,7 @@ function _coder_review_6x_book_content_w
return array(
'#warning' => t('!book_content() is deprecated',
array(
- '!book_content' => theme('drupalapi', 'book_content', '5')
+ '!book_content' => theme('drupalapi', array('function' => 'book_content', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1024,7 +1024,7 @@ function _coder_review_6x_book_form_warn
return array(
'#warning' => t('!book_form() is deprecated',
array(
- '!book_form' => theme('drupalapi', 'book_form', '5')
+ '!book_form' => theme('drupalapi', array('function' => 'book_form', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1035,7 +1035,7 @@ function _coder_review_6x_book_insert_wa
return array(
'#warning' => t('!book_insert() is deprecated',
array(
- '!book_insert' => theme('drupalapi', 'book_insert', '5')
+ '!book_insert' => theme('drupalapi', array('function' => 'book_insert', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1046,7 +1046,7 @@ function _coder_review_6x_book_location_
return array(
'#warning' => t('!book_location() is deprecated',
array(
- '!book_location' => theme('drupalapi', 'book_location', '5')
+ '!book_location' => theme('drupalapi', array('function' => 'book_location', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1057,7 +1057,7 @@ function _coder_review_6x_book_location_
return array(
'#warning' => t('!book_location_down() is deprecated',
array(
- '!book_location_down' => theme('drupalapi', 'book_location_down', '5')
+ '!book_location_down' => theme('drupalapi', array('function' => 'book_location_down', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1068,7 +1068,7 @@ function _coder_review_6x_book_node_visi
return array(
'#warning' => t('!book_node_visitor_html_post() is deprecated',
array(
- '!book_node_visitor_html_post' => theme('drupalapi', 'book_node_visitor_html_post', '5')
+ '!book_node_visitor_html_post' => theme('drupalapi', array('function' => 'book_node_visitor_html_post', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1079,7 +1079,7 @@ function _coder_review_6x_book_node_visi
return array(
'#warning' => t('!book_node_visitor_html_pre() is deprecated',
array(
- '!book_node_visitor_html_pre' => theme('drupalapi', 'book_node_visitor_html_pre', '5')
+ '!book_node_visitor_html_pre' => theme('drupalapi', array('function' => 'book_node_visitor_html_pre', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1090,7 +1090,7 @@ function _coder_review_6x_book_recurse_w
return array(
'#warning' => t('!book_recurse() is deprecated',
array(
- '!book_recurse' => theme('drupalapi', 'book_recurse', '5')
+ '!book_recurse' => theme('drupalapi', array('function' => 'book_recurse', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1101,7 +1101,7 @@ function _coder_review_6x_book_toc_recur
return array(
'#warning' => t('!book_toc_recurse() is deprecated',
array(
- '!book_toc_recurse' => theme('drupalapi', 'book_toc_recurse', '5')
+ '!book_toc_recurse' => theme('drupalapi', array('function' => 'book_toc_recurse', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1112,7 +1112,7 @@ function _coder_review_6x_book_tree_warn
return array(
'#warning' => t('!book_tree() is deprecated',
array(
- '!book_tree' => theme('drupalapi', 'book_tree', '5')
+ '!book_tree' => theme('drupalapi', array('function' => 'book_tree', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1123,7 +1123,7 @@ function _coder_review_6x_book_tree_recu
return array(
'#warning' => t('!book_tree_recurse() is deprecated',
array(
- '!book_tree_recurse' => theme('drupalapi', 'book_tree_recurse', '5')
+ '!book_tree_recurse' => theme('drupalapi', array('function' => 'book_tree_recurse', 'version' => '5'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1134,7 +1134,7 @@ function _coder_review_6x_book_admin_edi
return array(
'#warning' => t('Parameters to !book_admin_edit() have changed',
array(
- '!book_admin_edit' => theme('drupalapi', 'book_admin_edit', '6')
+ '!book_admin_edit' => theme('drupalapi', array('function' => 'book_admin_edit', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1145,7 +1145,7 @@ function _coder_review_6x_book_toc_warni
return array(
'#warning' => t('Parameters to !book_toc() have changed',
array(
- '!book_toc' => theme('drupalapi', 'book_toc', '6')
+ '!book_toc' => theme('drupalapi', array('function' => 'book_toc', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1156,7 +1156,7 @@ function _coder_review_6x_book_export_ht
return array(
'#warning' => t('Parameters to !book_export_html() have changed',
array(
- '!book_export_html' => theme('drupalapi', 'book_export_html', '6')
+ '!book_export_html' => theme('drupalapi', array('function' => 'book_export_html', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1167,7 +1167,7 @@ function _coder_review_6x_book_export_wa
return array(
'#warning' => t('Parameters to !book_export() have changed',
array(
- '!book_export' => theme('drupalapi', 'book_export', '6')
+ '!book_export' => theme('drupalapi', array('function' => 'book_export', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1178,7 +1178,7 @@ function _coder_review_6x_book_outline_w
return array(
'#warning' => t('Parameters to !book_outline() have changed',
array(
- '!book_outline' => theme('drupalapi', 'book_outline', '6')
+ '!book_outline' => theme('drupalapi', array('function' => 'book_outline', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1189,7 +1189,7 @@ function _coder_review_6x_book_prev_warn
return array(
'#warning' => t('Parameters to !book_prev() have changed',
array(
- '!book_prev' => theme('drupalapi', 'book_prev', '6')
+ '!book_prev' => theme('drupalapi', array('function' => 'book_prev', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1200,7 +1200,7 @@ function _coder_review_6x_book_next_warn
return array(
'#warning' => t('Parameters to !book_next() have changed',
array(
- '!book_next' => theme('drupalapi', 'book_next', '6')
+ '!book_next' => theme('drupalapi', array('function' => 'book_next', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#book_module',
@@ -1211,7 +1211,7 @@ function _coder_review_6x_nodeapi_submit
return array(
'#warning' => t('!hook_nodeapi(\'submit\') has been replaced by op=\'presave\'',
array(
- '!hook_nodeapi' => theme('drupalapi', 'hook_nodeapi', '6')
+ '!hook_nodeapi' => theme('drupalapi', array('function' => 'hook_nodeapi', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#nodeapi_presave',
@@ -1222,7 +1222,7 @@ function _coder_review_6x_db_result_warn
return array(
'#warning' => t('Remove $row argument from !db_result() method',
array(
- '!db_result' => theme('drupalapi', 'db_result', '6')
+ '!db_result' => theme('drupalapi', array('function' => 'db_result', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#db-result',
@@ -1233,7 +1233,7 @@ function _coder_review_6x_drupal_mail_wa
return array(
'#warning' => t('Parameters to !drupal_mail() have changed',
array(
- '!drupal_mail' => theme('drupalapi', 'drupal_mail', '6')
+ '!drupal_mail' => theme('drupalapi', array('function' => 'drupal_mail', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/189367',
@@ -1251,7 +1251,7 @@ function _coder_review_6x_user_authentic
return array(
'#warning' => t('Parameters to !user_authenticate have changed',
array(
- '!user_authenticate' => theme('drupalapi', 'user_authenticate', '6')
+ '!user_authenticate' => theme('drupalapi', array('function' => 'user_authenticate', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#user_authenticate',
@@ -1262,7 +1262,7 @@ function _coder_review_6x_hook_access_wa
return array(
'#warning' => t('Parameters to !hook_access() have changed',
array(
- '!hook_access' => theme('drupalapi', 'hook_access', '6')
+ '!hook_access' => theme('drupalapi', array('function' => 'hook_access', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#hook_access',
@@ -1273,7 +1273,7 @@ function _coder_review_6x_menu_get_objec
return array(
'#warning' => t('Use !menu_get_object() to get an object based on your path',
array(
- '!menu_get_object' => theme('drupalapi', 'menu_get_object', '6')
+ '!menu_get_object' => theme('drupalapi', array('function' => 'menu_get_object', 'version' => '6'))
)
),
'#link' => 'http://drupal.org/node/114774#menu_get_object',
@@ -1299,7 +1299,7 @@ function _coder_review_6x_hook_forms_war
return array(
'#warning' => t('The arguments to !hook_forms() have changed',
array(
- '!hook_forms' => theme('drupalapi', 'hook_forms', '6'),
+ '!hook_forms' => theme('drupalapi', array('function' => 'hook_forms', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/144132#hook-forms',
=== modified file 'coder_review/includes/coder_review_7x.inc'
--- coder_review/includes/coder_review_7x.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_7x.inc 2009-10-18 03:20:51 +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(
@@ -190,8 +191,8 @@ function coder_review_7x_reviews() {
),
// http://drupal.org/node/224333#node_access
array(
- '#type' => 'regex',
- '#value' => 'function\s+[a-z0-9_]+_(access)\s*\(',
+ '#type' => 'hook',
+ '#value' => 'access',
'#function-not' => '^\w+_node_access$',
'#warning_callback' => '_coder_review_7x_hook_access_warning',
),
@@ -252,6 +253,12 @@ function coder_review_7x_reviews() {
// Block
// http://drupal.org/node/224333#block_optional --- Block module now optional
+ array(
+ '#type' => 'callback',
+ '#source' => 'allphp',
+ '#value' => '_coder_review_7x_optional_block_review_callback',
+ '#warning_callback' => '_coder_review_7x_optional_block_warning',
+ ),
// http://drupal.org/node/224333#remove_op
array(
@@ -690,7 +697,11 @@ function coder_review_7x_reviews() {
'#warning_callback' => '_coder_review_7x_user_authenticate_warning',
),
// http://drupal.org/node/224333#hook-user-changes --- Removed several unecessary arguments to various hook_user_$op hooks and removed hook_profile_alter
-
+ array(
+ '#type' => 'regex',
+ '#value' => 'function\s+\w+_profile_alter\s*\(\s*' . $argex . '\s*\)',
+ '#warning_callback' => '_coder_review_7x_hook_profile_alter_warning',
+ ),
// Node API
// N/A - http://drupal.org/node/224333#delete_multiple --- Add node_delete_multiple()
@@ -786,6 +797,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
@@ -938,14 +960,45 @@ function _coder_review_7x_drupal_behavio
}
/**
- * Define the warning callbacks.
+ * Make sure user defined block module as a dependency if using block functions.
+ * @see http://drupal.org/node/224333#block_optional
*/
+function _coder_review_7x_optional_block_review_callback(&$coder_args, $review, $rule, $lines, &$results) {
+ $functions_to_check = array('block_list', 'block_custom_block_get', 'block_page_build');
+ $filename = $coder_args['#filename'];
+ // Find out the info filename and load it.
+ $pos = strpos($filename, '.');
+ $modulename = substr($filename, 0, $pos);
+ $ini = drupal_parse_info_file($modulename .'.info');
+
+ // Check if the dependency has been declared.
+ $block_declared = isset($ini['dependencies']) && is_array($ini['dependencies']) ? in_array('block', $ini['dependencies']) : FALSE;
+
+ if (file_exists($filename) && ('block' != $modulename) && !$block_declared) {
+ if ($lines = file($filename)) {
+ foreach ($lines as $lineno => $line) {
+ foreach ($functions_to_check as $function) {
+ if (preg_match("/\s$function\(/", $line)) {
+ $severity_name = _coder_review_severity_name($coder_args, $review, $rule);
+ $tmprule = $rule;
+ $tmprule['#warning_callback'] = '_coder_review_7x_optional_block_warning';
+ _coder_review_error($results, $tmprule, $severity_name, $lineno, $line);
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Define the warning callbacks.
+ */
function _coder_review_7x_referer_uri_warning() {
return array(
'#warning' => t('!referer_uri() has been removed and replaced with the PHP global $_SERVER[\'HTTP_REFERER\']',
array(
- '!referer_uri' => theme('drupalapi', 'referer_uri', '6'),
+ '!referer_uri' => theme('drupalapi', array('function' => 'referer_uri', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/224333#referer_uri',
@@ -956,7 +1009,7 @@ function _coder_review_7x_drupal_clone_w
return array(
'#warning' => t('!drupal_clone() has been removed and the PHP 5 !clone should be used instead.',
array(
- '!drupal_clone' => theme('drupalapi', 'drupal_clone', '6'),
+ '!drupal_clone' => theme('drupalapi', array('function' => 'drupal_clone', 'version' => '6')),
'!clone' => l(t('!clone', array('!clone' => 'clone')), 'http://us.php.net/language.oop5.cloning'),
)
),
@@ -968,8 +1021,8 @@ function _coder_review_7x_node_invoke_no
return array(
'#warning' => t('!node_invoke_nodeapi() has been removed and !module_invoke_all(\'node_\' . $hook, $node); should be used instead.',
array(
- '!node_invoke_nodeapi' => theme('drupalapi', 'node_invoke_nodeapi', '6'),
- '!module_invoke_all' => theme('drupalapi', 'module_invoke_all', '6'),
+ '!node_invoke_nodeapi' => theme('drupalapi', array('function' => 'node_invoke_nodeapi', 'version' => '6')),
+ '!module_invoke_all' => theme('drupalapi', array('function' => 'module_invoke_all', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/224333#node_invoke_nodeapi',
@@ -980,7 +1033,7 @@ function _coder_review_7x_session_warnin
return array(
'#warning' => t('Use !drupal_set_session() instead of $_SESSION',
array(
- '!drupal_set_session()' => theme('drupalapi', 'drupal_set_session', '7'),
+ '!drupal_set_session()' => theme('drupalapi', array('function' => 'drupal_set_session', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_set_session',
@@ -991,8 +1044,8 @@ function _coder_review_7x_db_rewrite_sql
return array(
'#warning' => t('!db_rewrite_sql() replaced with !hook_query_alter()',
array(
- '!db_rewrite_sql()' => theme('drupalapi', 'db_rewrite_sql', '6'),
- '!hook_query_alter()' => theme('drupalapi', 'hook_query_alter', '7'),
+ '!db_rewrite_sql()' => theme('drupalapi', array('function' => 'db_rewrite_sql', 'version' => '6')),
+ '!hook_query_alter()' => theme('drupalapi', array('function' => 'hook_query_alter', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#db_rewrite_sql',
@@ -1003,7 +1056,7 @@ function _coder_review_7x_schema_transla
return array(
'#warning' => t('Schema descriptions are no longer translated in !hook_schema()',
array(
- '!hook_schema()' => theme('drupalapi', 'hook_schema', '6'),
+ '!hook_schema()' => theme('drupalapi', array('function' => 'hook_schema', 'version' => '6')),
)
),
'#link' => 'http://drupal.org/node/224333#schema_translation',
@@ -1014,8 +1067,8 @@ function _coder_review_7x_comment_load_w
return array(
'#warning' => t('!_comment_load() has been renamed to !comment_load()',
array(
- '!_comment_load()' => theme('drupalapi', '_comment_load', '6'),
- '!comment_load()' => theme('drupalapi', 'comment_load', '7'),
+ '!_comment_load()' => theme('drupalapi', array('function' => '_comment_load', 'version' => '6')),
+ '!comment_load()' => theme('drupalapi', array('function' => 'comment_load', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#comment_load',
@@ -1040,8 +1093,8 @@ function _coder_review_7x_file_set_statu
return array(
'#warning' => t('!file_set_status() has been removed and !file_save() should be used in its place.',
array(
- '!file_set_status()' => theme('drupalapi', 'file_set_status', '6'),
- '!file_save()' => theme('drupalapi', 'file_save', '7'),
+ '!file_set_status()' => theme('drupalapi', array('function' => 'file_set_status', 'version' => '6')),
+ '!file_save()' => theme('drupalapi', array('function' => 'file_save', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#file_set_status',
@@ -1052,8 +1105,8 @@ function _coder_review_7x_user_delete_wa
return array(
'#warning' => t('!user_delete() replaced by !user_cancel()',
array(
- '!user_delete()' => theme('drupalapi', 'user_delete', '6'),
- '!user_cancel()' => theme('drupalapi', 'user_cancel', '7'),
+ '!user_delete()' => theme('drupalapi', array('function' => 'user_delete', 'version' => '6')),
+ '!user_cancel()' => theme('drupalapi', array('function' => 'user_cancel', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#user_cancel',
@@ -1064,8 +1117,8 @@ function _coder_review_7x_hook_user_op_w
return array(
'#warning' => t('!hook_user() has been removed in favour of hook_user_$op functions, for example !hook_user_validate().',
array(
- '!hook_user()' => theme('drupalapi', 'hook_user', '6'),
- '!hook_user_validate()' => theme('drupalapi', 'hook_user_validate', '7'),
+ '!hook_user()' => theme('drupalapi', array('function' => 'hook_user', 'version' => '6')),
+ '!hook_user_validate()' => theme('drupalapi', array('function' => 'hook_user_validate', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#remove_op',
@@ -1076,7 +1129,7 @@ function _coder_review_7x_hook_nodeapi_o
return array(
'#warning' => t('!hook_nodeapi() has been split into a number of smaller hooks.',
array(
- '!hook_nodeapi()' => theme('drupalapi', 'hook_nodeapi', '7'),
+ '!hook_nodeapi()' => theme('drupalapi', array('function' => 'hook_nodeapi', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#remove_op',
@@ -1087,7 +1140,7 @@ function _coder_review_7x_hook_node_info
return array(
'#warning' => t('For content types managed by the node module, change "node" to "node_content" in !hook_node_info()',
array(
- '!hook_node_info()' => theme('drupalapi', 'hook_node_info', '7'),
+ '!hook_node_info()' => theme('drupalapi', array('function' => 'hook_node_info', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#node_type_base',
@@ -1098,7 +1151,7 @@ function _coder_review_7x_hook_node_info
return array(
'#warning' => t('Change "module" to "base" in !hook_node_info()',
array(
- '!hook_node_info()' => theme('drupalapi', 'hook_node_info', '7'),
+ '!hook_node_info()' => theme('drupalapi', array('function' => 'hook_node_info', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#node_type_base',
@@ -1109,7 +1162,7 @@ function _coder_review_7x_hook_block_op_
return array(
'#warning' => t('!hook_block() has been split into a number of smaller hooks.',
array(
- '!hook_block()' => theme('drupalapi', 'hook_block', '7'),
+ '!hook_block()' => theme('drupalapi', array('function' => 'hook_block', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#remove_op',
@@ -1138,7 +1191,7 @@ function _coder_review_7x_actions_synchr
return array(
'#warning' => t('Parameters for !actions_synchronize() have changed',
array(
- '!actions_synchronize()' => theme('drupalapi', 'actions_synchronize', 7),
+ '!actions_synchronize()' => theme('drupalapi', array('function' => 'actions_synchronize', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#actions_synchronize',
@@ -1149,7 +1202,7 @@ function _coder_review_7x_check_markup_w
return array(
'#warning' => t('Parameters for !check_markup() have changed',
array(
- '!check_markup()' => theme('drupalapi', 'check_markup', 7),
+ '!check_markup()' => theme('drupalapi', array('function' => 'check_markup', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#check_markup_params',
@@ -1160,8 +1213,8 @@ function _coder_review_7x_drupal_set_tit
return array(
'#warning' => t('!drupal_set_title() now uses !check_plain() by default',
array(
- '!drupal_set_title()' => theme('drupalapi', 'drupal_set_title', 7),
- '!check_plain()' => theme('drupalapi', 'check_plain', 7),
+ '!drupal_set_title()' => theme('drupalapi', array('function' => 'drupal_set_title', 'version' => 7)),
+ '!check_plain()' => theme('drupalapi', array('function' => 'check_plain', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_set_title',
@@ -1172,8 +1225,8 @@ function _coder_review_7x_hook_filter_wa
return array(
'#warning' => t('!hook_filter() has been removed in favour of !hook_filter_info().',
array(
- '!hook_filter_info()' => theme('drupalapi', 'hook_filter_info', 7),
- '!hook_filter()' => theme('drupalapi', 'hook_filter', 6),
+ '!hook_filter_info()' => theme('drupalapi', array('function' => 'hook_filter_info', 'version' => 7)),
+ '!hook_filter()' => theme('drupalapi', array('function' => 'hook_filter', 'version' => 6)),
)
),
'#link' => 'http://drupal.org/node/224333#hook_filter_info',
@@ -1184,8 +1237,8 @@ function _coder_review_7x_hook_filter_ti
return array(
'#warning' => t('!hook_filter_tips() has been removed in favour of !hook_filter_info().',
array(
- '!hook_filter_info()' => theme('drupalapi', 'hook_filter_info', 7),
- '!hook_filter_tips()' => theme('drupalapi', 'hook_filter_tips', 6),
+ '!hook_filter_info()' => theme('drupalapi', array('function' => 'hook_filter_info', 'version' => 7)),
+ '!hook_filter_tips()' => theme('drupalapi', array('function' => 'hook_filter_tips', 'version' => 6)),
)
),
'#link' => 'http://drupal.org/node/224333#hook_filter_info',
@@ -1217,8 +1270,8 @@ function _coder_review_7x_theme_rebuild_
return array(
'#warning' => t('!drupal_rebuild_theme_registry() function has been renamed to !drupal_theme_rebuild()',
array(
- '!drupal_rebuild_theme_registry()' => theme('drupalapi', 'drupal_rebuild_theme_registry', 6),
- '!drupal_theme_rebuild()' => theme('drupalapi', 'drupal_theme_rebuild', 7),
+ '!drupal_rebuild_theme_registry()' => theme('drupalapi', array('function' => 'drupal_rebuild_theme_registry', 'version' => 6)),
+ '!drupal_theme_rebuild()' => theme('drupalapi', array('function' => 'drupal_theme_rebuild', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#rebuild_functions',
@@ -1229,8 +1282,8 @@ function _coder_review_7x_code_registry_
return array(
'#warning' => t('!drupal_rebuild_code_registry() function has been renamed to !registry_rebuild()',
array(
- '!drupal_rebuild_code_registry()' => theme('drupalapi', 'drupal_rebuild_code_registry', 6),
- '!registry_rebuild()' => theme('drupalapi', 'registry_rebuild', 7),
+ '!drupal_rebuild_code_registry()' => theme('drupalapi', array('function' => 'drupal_rebuild_code_registry', 'version' => 6)),
+ '!registry_rebuild()' => theme('drupalapi', array('function' => 'registry_rebuild', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#rebuild_functions',
@@ -1241,8 +1294,8 @@ function _coder_review_7x_taxonomy_get_t
return array(
'#warning' => t('!taxonomy_get_term() function has been renamed to !taxonomy_term_load()',
array(
- '!taxonomy_get_term()' => theme('drupalapi', 'taxonomy_get_term', 6),
- '!taxonomy_term_load()' => theme('drupalapi', 'taxonomy_term_load', 7),
+ '!taxonomy_get_term()' => theme('drupalapi', array('function' => 'taxonomy_get_term', 'version' => 6)),
+ '!taxonomy_term_load()' => theme('drupalapi', array('function' => 'taxonomy_term_load', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#taxonomy_crud',
@@ -1253,8 +1306,8 @@ function _coder_review_7x_taxonomy_save_
return array(
'#warning' => t('!taxonomy_save_term() function has been renamed to !taxonomy_term_save() and takes a term object as a parameter instead of any array.',
array(
- '!taxonomy_save_term()' => theme('drupalapi', 'taxonomy_save_term', 6),
- '!taxonomy_term_save()' => theme('drupalapi', 'taxonomy_term_save', 7),
+ '!taxonomy_save_term()' => theme('drupalapi', array('function' => 'taxonomy_save_term', 'version' => 6)),
+ '!taxonomy_term_save()' => theme('drupalapi', array('function' => 'taxonomy_term_save', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#taxonomy_crud',
@@ -1265,8 +1318,8 @@ function _coder_review_7x_taxonomy_del_t
return array(
'#warning' => t('!taxonomy_del_term() function has been renamed to !taxonomy_term_delete()',
array(
- '!taxonomy_del_term()' => theme('drupalapi', 'taxonomy_del_term', 6),
- '!taxonomy_term_delete()' => theme('drupalapi', 'taxonomy_term_delete', 7),
+ '!taxonomy_del_term()' => theme('drupalapi', array('function' => 'taxonomy_del_term', 'version' => 6)),
+ '!taxonomy_term_delete()' => theme('drupalapi', array('function' => 'taxonomy_term_delete', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#taxonomy_crud',
@@ -1277,8 +1330,8 @@ function _coder_review_7x_taxonomy_save_
return array(
'#warning' => t('!taxonomy_save_vocabulary() function has been renamed to !taxonomy_vocabulary_save() and takes a vocabulary object as a parameter instead of any array.',
array(
- '!taxonomy_save_vocabulary()' => theme('drupalapi', 'taxonomy_save_vocabulary', 6),
- '!taxonomy_vocabulary_save()' => theme('drupalapi', 'taxonomy_vocabulary_save', 7),
+ '!taxonomy_save_vocabulary()' => theme('drupalapi', array('function' => 'taxonomy_save_vocabulary', 'version' => 6)),
+ '!taxonomy_vocabulary_save()' => theme('drupalapi', array('function' => 'taxonomy_vocabulary_save', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#taxonomy_crud',
@@ -1289,8 +1342,8 @@ function _coder_review_7x_taxonomy_del_v
return array(
'#warning' => t('!taxonomy_del_vocabulary() function has been renamed to !taxonomy_vocabulary_delete()',
array(
- '!taxonomy_del_vocabulary()' => theme('drupalapi', 'taxonomy_del_vocabulary', 6),
- '!taxonomy_vocabulary_delete()' => theme('drupalapi', 'taxonomy_vocabulary_delete', 7),
+ '!taxonomy_del_vocabulary()' => theme('drupalapi', array('function' => 'taxonomy_del_vocabulary', 'version' => 6)),
+ '!taxonomy_vocabulary_delete()' => theme('drupalapi', array('function' => 'taxonomy_vocabulary_delete', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#taxonomy_crud',
@@ -1308,8 +1361,8 @@ function _coder_review_7x_drupal_execute
return array(
'#warning' => t('!drupal_execute() has been renamed to !drupal_submit_form()',
array(
- '!drupal_execute()' => theme('drupalapi', 'drupal_execute'),
- '!drupal_submit_form()' => theme('drupalapi', 'drupal_submit_form', 7),
+ '!drupal_execute()' => theme('drupalapi', array('function' => 'drupal_execute', 'version' => 6)),
+ '!drupal_submit_form()' => theme('drupalapi', array('function' => 'drupal_submit_form', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_execute_drupal_form_submit',
@@ -1320,8 +1373,8 @@ function _coder_review_7x_node_view_warn
return array(
'#warning' => t('!node_view() has been removed and !node_build() should be used instead.',
array(
- '!node_view' => theme('drupalapi', 'node_view', 6),
- '!node_build()' => theme('drupalapi', 'node_build', 7),
+ '!node_view' => theme('drupalapi', array('function' => 'node_view', 'version' => 6)),
+ '!node_build()' => theme('drupalapi', array('function' => 'node_build', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#node_view',
@@ -1332,8 +1385,8 @@ function _coder_review_7x_comment_valida
return array(
'#warning' => t('!comment_validate() has been removed and !comment_form_validate() should be used instead.',
array(
- '!comment_validate' => theme('drupalapi', 'comment_validate', 6),
- '!comment_form_validate()' => theme('drupalapi', 'comment_form_validate', 7),
+ '!comment_validate' => theme('drupalapi', array('function' => 'comment_validate', 'version' => 6)),
+ '!comment_form_validate()' => theme('drupalapi', array('function' => 'comment_form_validate', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#comment_validate_removed',
@@ -1344,7 +1397,7 @@ function _coder_review_7x_comment_node_u
return array(
'#warning' => t('!comment_node_url() has been removed. Use "node/" . $comment->nid to build URLs instead.',
array(
- '!comment_node_url' => theme('drupalapi', 'comment_node_url', 6),
+ '!comment_node_url' => theme('drupalapi', array('function' => 'comment_node_url', 'version' => 6)),
)
),
'#link' => 'http://drupal.org/node/224333#comment_node_url',
@@ -1355,7 +1408,7 @@ function _coder_review_7x_node_load_warn
return array(
'#warning' => t('!node_load() now only takes nid and vid as parameters.',
array(
- '!node_load' => theme('drupalapi', 'node_load', 7),
+ '!node_load' => theme('drupalapi', array('function' => 'node_load', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#node_load_multiple',
@@ -1366,8 +1419,8 @@ function _coder_review_7x_hook_perm_warn
return array(
'#warning' => t('!hook_perm() has been renamed to !hook_permission().',
array(
- '!hook_perm' => theme('drupalapi', 'hook_perm', 6),
- '!hook_permission' => theme('drupalapi', 'hook_permission', 7),
+ '!hook_perm' => theme('drupalapi', array('function' => 'hook_perm', 'version' => 6)),
+ '!hook_permission' => theme('drupalapi', array('function' => 'hook_permission', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#hook_permission',
@@ -1392,7 +1445,7 @@ function _coder_review_7x_taxonomy_get_t
return array(
'#warning' => t('!taxonomy_get_tree()\'s $depth and $max_depth parameters have changed positions.',
array(
- '!taxonomy_get_tree' => theme('drupalapi', 'taxonomy_get_tree', 7),
+ '!taxonomy_get_tree' => theme('drupalapi', array('function' => 'taxonomy_get_tree', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#taxonomy_get_tree',
@@ -1410,7 +1463,7 @@ function _coder_review_7x_book_toc_warni
return array(
'#warning' => t('!book_toc()\'s $depth_limit and $exclude parameters have changed positions.',
array(
- '!book_toc' => theme('drupalapi', 'book_toc', 7),
+ '!book_toc' => theme('drupalapi', array('function' => 'book_toc', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#book_toc_parameters',
@@ -1421,7 +1474,7 @@ function _coder_review_7x_node_type_get_
return array(
'#warning' => t('!node_get_types() function has been replaced by node_type_get_$op() functions.',
array(
- '!node_get_types' => theme('drupalapi', 'node_get_types', 6),
+ '!node_get_types' => theme('drupalapi', array('function' => 'node_get_types', 'version' => 6)),
)
),
'#link' => 'http://drupal.org/node/224333#node_type_get_functions',
@@ -1432,7 +1485,7 @@ function _coder_review_7x_node_build_rss
return array(
'#warning' => t('Removed $op "rss item" from !hook_nodeapi() in favor of NODE_BUILD_RSS.',
array(
- '!hook_nodeapi()' => theme('drupalapi', 'hook_nodeapi', '7'),
+ '!hook_nodeapi()' => theme('drupalapi', array('function' => 'hook_nodeapi', 'version' => '7')),
)
),
'#link' => 'http://drupal.org/node/224333#node_build_rss',
@@ -1457,8 +1510,8 @@ function _coder_review_7x_node_links_war
return array(
'#warning' => t('Node and taxonomy links are no longer emitted by !hook_link() and !hook_link_alter().',
array(
- '!hook_link()' => theme('drupalapi', 'hook_link', 7),
- '!hook_link_alter()' => theme('drupalapi', 'hook_link_alter', 7),
+ '!hook_link()' => theme('drupalapi', array('function' => 'hook_link', 'version' => 7)),
+ '!hook_link_alter()' => theme('drupalapi', array('function' => 'hook_link_alter', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#node_links',
@@ -1469,8 +1522,8 @@ function _coder_review_7x_drupal_uninsta
return array(
'#warning' => t('!drupal_uninstall_module() has been renamed to !drupal_uninstall_modules() and now takes an array of module names.',
array(
- '!drupal_uninstall_module()' => theme('drupalapi', 'drupal_uninstall_module', 6),
- '!drupal_uninstall_modules()' => theme('drupalapi', 'drupal_uninstall_modules', 7),
+ '!drupal_uninstall_module()' => theme('drupalapi', array('function' => 'drupal_uninstall_module', 'version' => 6)),
+ '!drupal_uninstall_modules()' => theme('drupalapi', array('function' => 'drupal_uninstall_modules', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_uninstall_modules',
@@ -1481,7 +1534,7 @@ function _coder_review_7x_drupal_http_re
return array(
'#warning' => t('Parameters to !drupal_http_request() have changed.',
array(
- '!drupal_http_request()' => theme('drupalapi', 'drupal_http_request', 7),
+ '!drupal_http_request()' => theme('drupalapi', array('function' => 'drupal_http_request', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_http_request_parameters',
@@ -1499,8 +1552,8 @@ function _coder_review_7x_drupal_set_htm
return array(
'#warning' => t('!drupal_set_html_head() has been renamed to !drupal_add_html_head().',
array(
- '!drupal_set_html_head()' => theme('drupalapi', 'drupal_set_html_head', 6),
- '!drupal_add_html_head()' => theme('drupalapi', 'drupal_add_html_head', 7),
+ '!drupal_set_html_head()' => theme('drupalapi', array('function' => 'drupal_set_html_head', 'version' => 6)),
+ '!drupal_add_html_head()' => theme('drupalapi', array('function' => 'drupal_add_html_head', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_set_html_head',
@@ -1511,8 +1564,8 @@ function _coder_review_7x_php_eval_warni
return array(
'#warning' => t("!drupal_eval() has been renamed to !php_eval() and should be wrapped in a module_exists('php') check.",
array(
- '!drupal_eval()' => theme('drupalapi', 'drupal_eval', 6),
- '!php_eval()' => theme('drupalapi', 'php_eval', 7),
+ '!drupal_eval()' => theme('drupalapi', array('function' => 'drupal_eval', 'version' => 6)),
+ '!php_eval()' => theme('drupalapi', array('function' => 'php_eval', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#php_eval',
@@ -1523,8 +1576,8 @@ function _coder_review_7x_module_rebuild
return array(
'#warning' => t('!module_rebuild_cache() has been renamed to !system_get_module_data().',
array(
- '!module_rebuild_cache()' => theme('drupalapi', 'module_rebuild_cache', 6),
- '!system_get_module_data()' => theme('drupalapi', 'system_get_module_data', 7),
+ '!module_rebuild_cache()' => theme('drupalapi', array('function' => 'module_rebuild_cache', 'version' => 6)),
+ '!system_get_module_data()' => theme('drupalapi', array('function' => 'system_get_module_data', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#system_get_module_data',
@@ -1535,8 +1588,8 @@ function _coder_review_7x_system_theme_d
return array(
'#warning' => t('!system_theme_data() has been renamed to !system_get_theme_data().',
array(
- '!system_theme_data()' => theme('drupalapi', 'system_theme_data', 6),
- '!system_get_theme_data()' => theme('drupalapi', 'system_get_theme_data', 7),
+ '!system_theme_data()' => theme('drupalapi', array('function' => 'system_theme_data', 'version' => 6)),
+ '!system_get_theme_data()' => theme('drupalapi', array('function' => 'system_get_theme_data', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#system_get_module_data',
@@ -1547,8 +1600,8 @@ function _coder_review_7x_drupal_set_con
return array(
'#warning' => t('!drupal_set_content() has been renamed to !drupal_add_region_content().',
array(
- '!drupal_set_content()' => theme('drupalapi', 'drupal_set_content', 6),
- '!drupal_add_region_content()' => theme('drupalapi', 'drupal_add_region_content', 7),
+ '!drupal_set_content()' => theme('drupalapi', array('function' => 'drupal_set_content', 'version' => 6)),
+ '!drupal_add_region_content()' => theme('drupalapi', array('function' => 'drupal_add_region_content', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_set_content',
@@ -1559,8 +1612,8 @@ function _coder_review_7x_drupal_get_con
return array(
'#warning' => t('!drupal_get_content() has been renamed to !drupal_get_region_content().',
array(
- '!drupal_get_content()' => theme('drupalapi', 'drupal_get_content', 6),
- '!drupal_get_region_content()' => theme('drupalapi', 'drupal_get_region_content', 7),
+ '!drupal_get_content()' => theme('drupalapi', array('function' => 'drupal_get_content', 'version' => 6)),
+ '!drupal_get_region_content()' => theme('drupalapi', array('function' => 'drupal_get_region_content', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_set_content',
@@ -1571,7 +1624,7 @@ function _coder_review_7x_http_header_fu
return array(
'#warning' => t('Parameters to !drupal_set_header() have changed.',
array(
- '!drupal_set_header()' => theme('drupalapi', 'drupal_set_header', 7),
+ '!drupal_set_header()' => theme('drupalapi', array('function' => 'drupal_set_header', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#http_header_functions',
@@ -1597,7 +1650,7 @@ function _coder_review_7x_user_load_warn
return array(
'#warning' => t('!user_load() now only takes a user ID as its argument.',
array(
- '!user_load()' => theme('drupalapi', 'user_load', 7),
+ '!user_load()' => theme('drupalapi', array('function' => 'user_load', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#user_load_multiple',
@@ -1608,8 +1661,8 @@ function _coder_review_7x_hook_footer_wa
return array(
'#warning' => t('!hook_footer() and !theme_closure() were removed.',
array(
- '!hook_footer()' => theme('drupalapi', 'hook_footer', 6),
- '!theme_closure()' => theme('drupalapi', 'theme_closure', 6),
+ '!hook_footer()' => theme('drupalapi', array('function' => 'hook_footer', 'version' => 6)),
+ '!theme_closure()' => theme('drupalapi', array('function' => 'theme_closure', 'version' => 6)),
)
),
'#link' => 'http://drupal.org/node/224333#hook_footer',
@@ -1627,7 +1680,7 @@ function _coder_review_7x_theme_page_war
return array(
'#warning' => t('Instead of "theme(\'page\')" use !drupal_set_page_content()',
array(
- '!drupal_set_page_content()' => theme('drupalapi', 'drupal_set_page_content()', 7),
+ '!drupal_set_page_content()' => theme('drupalapi', array('function' => 'drupal_set_page_content', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#theme_page',
@@ -1638,7 +1691,7 @@ function _coder_review_7x_drupal_add_js_
return array(
'#warning' => t('Parameters to !drupal_add_js() have changed.',
array(
- '!drupal_add_js()' => theme('drupalapi', 'drupal_add_js()', 7),
+ '!drupal_add_js()' => theme('drupalapi', array('function' => 'drupal_add_js', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_add_js_options',
@@ -1649,7 +1702,7 @@ function _coder_review_7x_drupal_add_css
return array(
'#warning' => t('Parameters to !drupal_add_css() have changed.',
array(
- '!drupal_add_css()' => theme('drupalapi', 'drupal_add_css()', 7),
+ '!drupal_add_css()' => theme('drupalapi', array('function' => 'drupal_add_css', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_add_js_options',
@@ -1667,7 +1720,7 @@ function _coder_review_7x_hook_js_alter_
return array(
'#warning' => t('There is a new !hook_js_alter() to alter JavaScript.',
array(
- '!hook_js_alter()' => theme('drupalapi', 'hook_js_alter()', 7),
+ '!hook_js_alter()' => theme('drupalapi', array('function' => 'hook_js_alter', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#hook_js_alter',
@@ -1678,7 +1731,7 @@ function _coder_review_7x_drupal_add_js_
return array(
'#warning' => t("Replace 'core', 'module' and 'theme' with 'file' in !drupal_add_js()",
array(
- '!drupal_add_js()' => theme('drupalapi', 'drupal_add_js()', 7),
+ '!drupal_add_js()' => theme('drupalapi', array('function' => 'drupal_add_js', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_add_js_weight',
@@ -1696,7 +1749,7 @@ function _coder_review_7x_drupal_add_js_
return array(
'#warning' => t('External JavaScript can now be referenced through !drupal_add_js().',
array(
- '!drupal_add_js()' => theme('drupalapi', 'drupal_add_js()', 7),
+ '!drupal_add_js()' => theme('drupalapi', array('function' => 'drupal_add_js', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#drupal_add_js_external',
@@ -1714,7 +1767,7 @@ function _coder_review_7x_file_scan_dire
return array(
'#warning' => t('Parameters to !file_scan_directory() have changed.',
array(
- '!file_scan_directory()' => theme('drupalapi', 'file_scan_directory()', 7),
+ '!file_scan_directory()' => theme('drupalapi', array('function' => 'file_scan_directory', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#file_scan_directory_array_itize',
@@ -1725,7 +1778,7 @@ function _coder_review_7x_file_scan_dire
return array(
'#warning' => t('!file_scan_directory() now uses a preg regular expression for the nomask parameter.',
array(
- '!file_scan_directory()' => theme('drupalapi', 'file_scan_directory()', 7),
+ '!file_scan_directory()' => theme('drupalapi', array('function' => 'file_scan_directory', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#file_scan_directory_nomask',
@@ -1736,7 +1789,7 @@ function _coder_review_7x_drupal_system_
return array(
'#warning' => t('!drupal_system_listing() now uses preg regular expressions.',
array(
- '!drupal_system_listing()' => theme('drupalapi', 'drupal_system_listing()', 7),
+ '!drupal_system_listing()' => theme('drupalapi', array('function' => 'drupal_system_listing', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#preg_match',
@@ -1747,7 +1800,7 @@ function _coder_review_7x_file_scan_dire
return array(
'#warning' => t('!file_scan_directory() now uses preg regular expressions.',
array(
- '!file_scan_directory()' => theme('drupalapi', 'file_scan_directory()', 7),
+ '!file_scan_directory()' => theme('drupalapi', array('function' => 'file_scan_directory', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#preg_match',
@@ -1765,7 +1818,7 @@ function _coder_review_7x_descriptions_p
return array(
'#warning' => t('Permissions are required to have titles and descriptions in !hook_permission().',
array(
- '!hook_permission()' => theme('drupalapi', 'hook_permission()', 7),
+ '!hook_permission()' => theme('drupalapi', array('function' => 'hook_permission', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#descriptions_permissions',
@@ -1783,7 +1836,7 @@ function _coder_review_7x_hook_menu_link
return array(
'#warning' => t('The parameters to !hook_menu_link_alter() have changed.',
array(
- '!hook_menu_link_alter()' => theme('drupalapi', 'hook_menu_link_alter()', 7),
+ '!hook_menu_link_alter()' => theme('drupalapi', array('function' => 'hook_menu_link_alter', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#hook_menu_link_alter',
@@ -1794,7 +1847,7 @@ function _coder_review_7x_time_limit_war
return array(
'#warning' => t('Use !drupal_set_time_limit() instead of !set_time_limit().',
array(
- '!drupal_set_time_limit()' => theme('drupalapi', 'drupal_set_time_limit()', 7),
+ '!drupal_set_time_limit()' => theme('drupalapi', array('function' => 'drupal_set_time_limit', 'version' => 7)),
'!set_time_limit()' => theme('phpapi', 'set_time_limit()'),
)
),
@@ -1806,7 +1859,7 @@ function _coder_review_7x_user_authentic
return array(
'#warning' => t('Parameters to !user_authenticate() have changed.',
array(
- '!user_authenticate()' => theme('drupalapi', 'user_authenticate()', 7),
+ '!user_authenticate()' => theme('drupalapi', array('function' => 'user_authenticate', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#user_authenticate',
@@ -1838,7 +1891,7 @@ function _coder_review_7x_node_form_warn
return array(
'#warning' => t('Easier check for node form during !hook_form_alter().',
array(
- '!hook_form_alter()' => theme('drupalapi', 'hook_form_alter()', 7),
+ '!hook_form_alter()' => theme('drupalapi', array('function' => 'hook_form_alter', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#node_form',
@@ -1849,7 +1902,7 @@ function _coder_review_7x_hook_form_alte
return array(
'#warning' => t('Parameters to !hook_form_alter() have changed.',
array(
- '!hook_form_alter()' => theme('drupalapi', 'hook_form_alter()', 7),
+ '!hook_form_alter()' => theme('drupalapi', array('function' => 'hook_form_alter', 'version' => 7)),
)
),
// '#link' => 'http://drupal.org/node/224333#node_form',
@@ -1860,12 +1913,12 @@ function _coder_review_7x_process_functi
return array(
'#warning' => t('!expand_password_confirm(), !expand_date(), !expand_radios(), !form_expand_ahah(), !expand_checkboxes(), !process_weight() have been renamed.',
array(
- '!expand_password_confirm()' => theme('drupalapi', 'expand_password_confirm()', 6),
- '!expand_date()' => theme('drupalapi', 'expand_date()', 6),
- '!expand_radios()' => theme('drupalapi', 'expand_radios()', 6),
- '!form_expand_ahah()' => theme('drupalapi', 'form_expand_ahah()', 6),
- '!expand_checkboxes()' => theme('drupalapi', 'expand_checkboxes()', 6),
- '!process_weight()' => theme('drupalapi', 'process_weight()', 6),
+ '!expand_password_confirm()' => theme('drupalapi', array('function' => 'expand_password_confirm', 'version' => 6)),
+ '!expand_date()' => theme('drupalapi', array('function' => 'expand_date', 'version' => 6)),
+ '!expand_radios()' => theme('drupalapi', array('function' => 'expand_radios', 'version' => 6)),
+ '!form_expand_ahah()' => theme('drupalapi', array('function' => 'form_expand_ahah', 'version' => 6)),
+ '!expand_checkboxes()' => theme('drupalapi', array('function' => 'expand_checkboxes', 'version' => 6)),
+ '!process_weight()' => theme('drupalapi', array('function' => 'process_weight', 'version' => 6)),
)
),
'#link' => 'http://drupal.org/node/224333#process_functions',
@@ -1879,6 +1932,13 @@ function _coder_review_7x_no_jsenabled_w
);
}
+function _coder_review_7x_optional_block_warning() {
+ return array(
+ '#warning' => t("Block module is now optional, make sure you declare it as a dependency in your module's .info file."),
+ '#link' => 'http://drupal.org/node/224333#block_optional',
+ );
+}
+
function _coder_review_7x_module_implements_warning() {
return array(
'#warning' => t('Use module_implements not module_list when calling hook implementations.'),
@@ -1904,10 +1964,41 @@ function _coder_review_7x_hook_access_wa
return array(
'#warning' => t('!hook_access() removed in favor of !hook_node_access().',
array(
- '!hook_access()' => theme('drupalapi', 'hook_access', 6),
- '!hook_node_access()' => theme('drupalapi', 'hook_node_access', 7),
+ '!hook_access()' => theme('drupalapi', array('function' => 'hook_access', 'version' => 6)),
+ '!hook_node_access()' => theme('drupalapi', array('function' => 'hook_node_access', 'version' => 7)),
)
),
'#link' => 'http://drupal.org/node/224333#hook_node_access',
);
}
+
+function _coder_review_7x_hook_profile_alter_warning() {
+ return array(
+ '#warning' => t('!hook_profile_alter() has been removed.',
+ array(
+ '!hook_profile_alter()' => theme('drupalapi', array('function' => 'hook_profile_alter', 'version' => 6)),
+ )
+ ),
+ '#link' => 'http://drupal.org/node/224333#hook-user-changes',
+ );
+}
+
+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', array('function' => 't()', 'version' => 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', array('function' => 'format_plural()', 'version' => 7)),
+ )),
+ '#link' => 'http://drupal.org/node/224333#locale_context',
+ );
+}
=== modified file 'coder_review/includes/coder_review_i18n.inc'
--- coder_review/includes/coder_review_i18n.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_i18n.inc 2009-10-18 02:41:47 +0000
@@ -99,8 +99,8 @@ function _coder_review_i18n_l_without_t(
return array(
'#warning' => t('The $text argument to !l() should be enclosed within !t() so that it is translatable.',
array(
- '!l' => theme('drupalapi', 'l'),
- '!t' => theme('drupalapi', 't'),
+ '!l' => theme('drupalapi', array('function' => 'l')),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
);
@@ -110,8 +110,8 @@ function _coder_review_i18n_in_install_l
return array(
'#warning' => t('The $text argument to !l() should be enclosed within !st() so that it is translatable from within the install.',
array(
- '!l' => theme('drupalapi', 'l'),
- '!st' => theme('drupalapi', 'st'),
+ '!l' => theme('drupalapi', array('function' => 'l')),
+ '!st' => theme('drupalapi', array('function' => 'st')),
)
),
);
@@ -121,11 +121,11 @@ function _coder_review_i18n_in_install_t
return array(
'#warning' => t('Use !st() instead of !t() in !hook_install(), !hook_uninstall() and !hook_update_N()',
array(
- '!st' => theme('drupalapi', 'st'),
- '!t' => theme('drupalapi', 't'),
- '!hook_install' => theme('drupalapi', 'hook_install'),
- '!hook_uninstall' => theme('drupalapi', 'hook_uninstall'),
- '!hook_update_N' => theme('drupalapi', 'hook_update_N'),
+ '!st' => theme('drupalapi', array('function' => 'st')),
+ '!t' => theme('drupalapi', array('function' => 't')),
+ '!hook_install' => theme('drupalapi', array('function' => 'hook_install')),
+ '!hook_uninstall' => theme('drupalapi', array('function' => 'hook_uninstall')),
+ '!hook_update_N' => theme('drupalapi', array('function' => 'hook_update_N')),
)
),
);
@@ -135,8 +135,8 @@ function _coder_review_i18n_fapi_title_w
return array(
'#warning' => t('The FAPI #title should be enclosed within !t() so that it is translatable.',
array(
- '!l' => theme('drupalapi', 'l'),
- '!t' => theme('drupalapi', 't'),
+ '!l' => theme('drupalapi', array('function' => 'l')),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
);
@@ -146,8 +146,8 @@ function _coder_review_i18n_form_error_w
return array(
'#warning' => t('The $message argument to !form_error() should be enclosed within !t() so that it is translatable.',
array(
- '!form_error' => theme('drupalapi', 'form_error'),
- '!t' => theme('drupalapi', 't'),
+ '!form_error' => theme('drupalapi', array('function' => 'form_error')),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
);
@@ -157,7 +157,7 @@ function _coder_review_i18n_in_hook_link
return array(
'#warning' => t("The 'title' option should be enclosed within !t() so that it is translatable.",
array(
- '!t' => theme('drupalapi', 't'),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
);
@@ -167,8 +167,8 @@ function _coder_review_i18n_drupal_set_m
return array(
'#warning' => t('The $message argument to !drupal_set_message() should be enclosed within !t() so that it is translatable.',
array(
- '!drupal_set_message' => theme('drupalapi', 'drupal_set_message'),
- '!t' => theme('drupalapi', 't'),
+ '!drupal_set_message' => theme('drupalapi', array('function' => 'drupal_set_message')),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
);
@@ -178,8 +178,8 @@ function _coder_review_i18n_drupal_set_t
return array(
'#warning' => t('The $title argument to !drupal_set_title() should be enclosed within !t() so that it is translatable.',
array(
- '!drupal_set_title' => theme('drupalapi', 'drupal_set_title'),
- '!t' => theme('drupalapi', 't'),
+ '!drupal_set_title' => theme('drupalapi', array('function' => 'drupal_set_title')),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
);
@@ -189,8 +189,8 @@ function _coder_review_i18n_watchdog_wit
return array(
'#warning' => t('The $message argument to !watchdog() should NOT be enclosed within !t(), so that it can be properly translated at display time.',
array(
- '!watchdog' => theme('drupalapi', 'watchdog'),
- '!t' => theme('drupalapi', 't'),
+ '!watchdog' => theme('drupalapi', array('function' => 'watchdog')),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
);
@@ -200,7 +200,7 @@ function _coder_review_i18n_menu_with_t(
return array(
'#warning' => t('Menu item titles and descriptions should NOT be enclosed within !t().',
array(
- '!t' => theme('drupalapi', 't'),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
'#link' => 'http://drupal.org/node/140311',
@@ -211,7 +211,7 @@ function _coder_review_i18n_space_starts
return array(
'#warning' => t('The $string argument to !t() should not begin or end with a space.',
array(
- '!t' => theme('drupalapi', 't'),
+ '!t' => theme('drupalapi', array('function' => 't')),
)
),
'#link' => 'http://drupal.org/node/304150',
=== modified file 'coder_review/includes/coder_review_security.inc'
--- coder_review/includes/coder_review_security.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_security.inc 2009-10-18 02:41:47 +0000
@@ -80,8 +80,8 @@ function coder_review_security_reviews()
function _coder_review_security_l_check_plain_warning() {
return t('!l() already contains a !check_plain() call by default',
array(
- '!l' => theme('drupalapi', 'l'),
- '!check_plain' => theme('drupalapi', 'check_plain'),
+ '!l' => theme('drupalapi', array('function' => 'l')),
+ '!check_plain' => theme('drupalapi', array('function' => 'check_plain')),
)
);
}
@@ -89,7 +89,7 @@ function _coder_review_security_l_check_
function _coder_review_security_request_uri_warning() {
return t('the use of REQUEST_URI is prone to XSS exploits and does not work on IIS; use !request_uri() instead',
array(
- '!request_uri' => theme('drupalapi', 'request_uri'),
+ '!request_uri' => theme('drupalapi', array('function' => 'request_uri')),
)
);
}
@@ -98,7 +98,7 @@ function _coder_review_security_sql_var_
return array(
'#warning' => t('In SQL strings, Use !db_query() placeholders in place of variables. This is a potential source of SQL injection attacks when the variable can come from user data.',
array(
- '!db_query' => theme('drupalapi', 'db_query'),
+ '!db_query' => theme('drupalapi', array('function' => 'db_query')),
)
),
'#link' => 'http://drupal.org/writing-secure-code',
=== modified file 'coder_review/includes/coder_review_sql.inc'
--- coder_review/includes/coder_review_sql.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_sql.inc 2009-10-18 02:41:47 +0000
@@ -79,7 +79,7 @@ function _coder_review_sql_db_query_rang
return array(
'#warning' => t('Use !db_query_range() instead of the SQL LIMIT clause',
array(
- '!db_query_range' => theme('drupalapi', 'db_query_range'),
+ '!db_query_range' => theme('drupalapi', array('function' => 'db_query_range')),
)
),
'#link' => 'http://drupal.org/node/1395',
@@ -90,9 +90,9 @@ function _coder_review_sql_db_query_in_i
return array(
'#warning' => t('Use !update_sql() instead of !db_query() in !hook_update_N()',
array(
- '!update_sql' => theme('drupalapi', 'update_sql'),
- '!db_query' => theme('drupalapi', 'db_query'),
- '!hook_update_N' => theme('drupalapi', 'hook_update_N'),
+ '!update_sql' => theme('drupalapi', array('function' => 'update_sql')),
+ '!db_query' => theme('drupalapi', array('function' => 'db_query')),
+ '!hook_update_N' => theme('drupalapi', array('function' => 'hook_update_N')),
)
),
);
=== modified file 'coder_review/includes/coder_review_style.inc'
--- coder_review/includes/coder_review_style.inc 2009-10-17 19:22:01 +0000
+++ coder_review/includes/coder_review_style.inc 2009-10-17 21:09:06 +0000
@@ -26,13 +26,13 @@ function coder_review_style_reviews() {
),
array(
'#type' => 'regex',
- '#value' => '\s(if|elseif|while|foreach|switch|return|for|catch)\(',
+ '#value' => '\s(if|elseif|while|foreach|switch|case|return|for|catch)\(',
'#warning' => 'Control statements should have one space between the control keyword and opening parenthesis',
),
array(
'#type' => 'regex',
'#value' => '[\s\(](\w+)\s\(',
- '#not' => '^(if|elseif|while|foreach|switch|return|for|list|catch)$',
+ '#not' => '^(if|elseif|while|foreach|switch|case|return|for|list|catch)$',
'#warning' => 'Functions should be called with no spaces between the function name and opening parentheses',
),
array(
=== modified file 'coder_review/tests/coder_review_7x.test'
--- coder_review/tests/coder_review_7x.test 2009-10-17 19:22:01 +0000
+++ coder_review/tests/coder_review_7x.test 2009-10-17 21:13:54 +0000
@@ -213,6 +213,7 @@ class CoderReviewUpgrade7xTest extends C
$this->assertCoderReviewFail(" function mymodule_block(\$delta, \$edit) {\n switch (\$op) {\n case 'list':\n }\n}");
// http://drupal.org/node/224333#hook_block_list_alter
+ $this->assertCoderReviewPass(' mymodule_block_list_alter(&$blocks)');
}
function testComments7x() {
@@ -499,6 +500,7 @@ class CoderReviewUpgrade7xTest extends C
$this->assertCoderReviewFail(' user_authenticate(&$form_state);');
// http://drupal.org/node/224333#hook-user-changes
+ $this->assertCoderReviewFail(" function mymodule_profile_alter(&\$account) {\n}");
}
function testNode7x() {
@@ -562,6 +564,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() {
=== modified file 'coder_review/tests/coder_review_format.test'
--- coder_review/tests/coder_review_format.test 2009-10-17 19:22:01 +0000
+++ coder_review/tests/coder_review_format.test 2009-10-17 21:09:06 +0000
@@ -7,8 +7,58 @@
* residing in scripts/coder_format/tests/.
*/
+require_once dirname(__FILE__) . '/coder_review_test_case.tinc';
+require_once drupal_get_path('module', 'coder') . '/scripts/coder_format/coder_format.inc';
+
/**
- * Load coder_format unit tests.
+ * Coder Format tests.
*/
-require_once drupal_get_path('module', 'coder') . '/scripts/coder_format/tests/all.test';
+class CoderReviewFormatTest extends CoderReviewTestCase {
+ function __construct($id = NULL) {
+ parent::__construct('coder_format', $id);
+ $this->path = drupal_get_path('module', 'coder') . '/scripts/coder_format/tests';
+ }
+
+ public static function getInfo() {
+ if (file_exists(drupal_get_path('module', 'coder') . '/scripts/coder_format/tests/Text/Diff.php')) {
+ return array(
+ 'name' => 'coder_format tests',
+ 'description' => 'Tests all of the functionality of the coder_format script.',
+ 'group' => 'Coder',
+ );
+ }
+ }
+
+ protected function assertFormat($input, $expect) {
+ $result = coder_format_string_all($input);
+ $this->assertIdentical($result, $input);
+ }
+
+ function testCoderFormat() {
+ if (file_exists($this->path . '/Text/Diff.php')) {
+ // Load PEAR Text_Diff library.
+ set_include_path(get_include_path() . PATH_SEPARATOR . $this->path);
+ include_once $this->path . '/Text/Diff.php';
+ include_once $this->path . '/Text/Diff/Renderer.php';
+ // Load coder_format test cases.
+ include_once $this->path . '/CoderTestFile.php';
+ }
+ else {
+ return;
+ }
+ $files = array_keys(file_scan_directory($this->path . '/tests', '/\.phpt$/'));
+ // Order tests alphabetically, but use a weight > 0 to append them after
+ // overall test results.
+ $c = 10;
+ foreach ($files as $file) {
+ $case = new CoderFormatTestFile($file);
+ $this->assertTrue($case->test(), NULL, 'coder_format');
+ return;
+ $result = $case->test();
+ if (!$result) {
+ $this->_reporter->writeContent($case->render(), $c++);
+ }
+ }
+ }
+}
=== modified file 'coder_review/tests/coder_review_test_case.tinc'
--- coder_review/tests/coder_review_test_case.tinc 2009-10-17 19:22:01 +0000
+++ coder_review/tests/coder_review_test_case.tinc 2009-10-17 21:09:06 +0000
@@ -18,7 +18,7 @@ class CoderReviewTestCase extends Drupal
// Only do the setUp once per test case, not once per function call.
static $run_once;
if (!isset($run_once)) {
- parent::setUp();
+ parent::setUp('coder_review');
$run_once = TRUE;
}
}
=== modified file 'coder_upgrade/coder_upgrade.module'
--- coder_upgrade/coder_upgrade.module 2009-10-17 19:22:01 +0000
+++ coder_upgrade/coder_upgrade.module 2009-10-17 22:38:02 +0000
@@ -156,6 +156,7 @@ function coder_upgrade_conversions_form(
// Create the list of upgrade options from the coder upgrade plug-ins.
// Maintain a secondary list based on title only, to make sorting possible.
$upgrades_all = _coder_upgrade_upgrades();
+ $upgrades_sort = array();
foreach ($upgrades_all as $name => $upgrade) {
$upgrade_options[$name] = isset($upgrade['link']) ? l($upgrade['title'], $upgrade['link']) : $upgrade['title'];
if (isset($upgrade['description'])) {
=== removed file 'scripts/coder_format/tests/CoderTestCase.php'
--- scripts/coder_format/tests/CoderTestCase.php 2009-10-17 19:22:01 +0000
+++ scripts/coder_format/tests/CoderTestCase.php 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-assertIdentical($result, $input);
- }
-}
-
=== modified file 'scripts/coder_format/tests/CoderTestFile.php'
--- scripts/coder_format/tests/CoderTestFile.php 2009-10-17 19:22:01 +0000
+++ scripts/coder_format/tests/CoderTestFile.php 2009-10-17 21:09:06 +0000
@@ -1,24 +1,23 @@
filename = $filename;
+ }
+
/**
* Loads this class from a file.
*
* @param string $filename
* A filename to load.
*/
- function load($filename) {
- $this->filename = $filename;
- $fh = fopen($filename, 'r');
- $state = '';
- $unit = 0;
+ function load() {
+ $fh = fopen($this->filename, 'r');
+ $state = '';
+ $unit = 0;
- while (($line = fgets($fh)) !== false) {
+ while (($line = fgets($fh)) !== FALSE) {
// Normalize newlines.
$line = rtrim($line, "\n\r");
// Detect INPUT and EXPECT sections.
if (substr($line, 0, 2) == '--') {
$state = trim($line, ' -');
-
+
// If a new INPUT section begins, start a new unit.
if ($state == 'INPUT') {
// If previous section has been marked with the keyword 'ONLY', break
@@ -58,7 +69,7 @@ class CoderTestFile extends SimpleExpect
continue;
}
// Process other keywords only outside of INPUT and EXPECT sections.
- if (!$state) {
+ if (empty($state) && is_string($line)) {
list($keyword, $line) = explode(': ', $line, 2);
}
// Assign previous keyword, if there is no new one.
@@ -71,7 +82,7 @@ class CoderTestFile extends SimpleExpect
break;
case 'FULL':
- $this->full = (bool)$line;
+ $this->full = (bool) $line;
break;
case 'INPUT':
@@ -107,15 +118,14 @@ class CoderTestFile extends SimpleExpect
}
/**
- * Implements SimpleExpectation::test().
- *
- * @param $filename Filename of test file to test.
+ * Test a coder_format test file.
*/
- function test($filename = false) {
- if ($filename) {
- $this->load($filename);
+ function test() {
+ if (empty($this->filename)) {
+ return FALSE;
}
-
+ $this->load();
+
// Perform test.
// Test passes until proven invalid.
$valid = TRUE;
@@ -128,7 +138,8 @@ class CoderTestFile extends SimpleExpect
$valid = FALSE;
}
}
-
+
+ $this->result = $valid;
return $valid;
}
@@ -136,15 +147,14 @@ class CoderTestFile extends SimpleExpect
* Implements SimpleExpectation::testMessage().
*/
function testMessage() {
- $message = $this->test .' test in '. htmlspecialchars(basename($this->filename));
- return $message;
+ return $this->test .' test in '. htmlspecialchars(basename($this->filename));
}
/**
* Renders the test with an HTML diff table.
*/
function render() {
- drupal_add_css(drupal_get_path('module', 'coder') .'/scripts/coder_format/tests/coder-diff.css', 'module', 'all', false);
+ drupal_add_css(drupal_get_path('module', 'coder') .'/scripts/coder_format/tests/coder-diff.css', array('preprocess' => FALSE));
foreach ($this->input as $unit => $content) {
// Do not output passed units.
=== modified file 'scripts/coder_format/tests/README.txt'
--- scripts/coder_format/tests/README.txt 2009-10-17 19:22:01 +0000
+++ scripts/coder_format/tests/README.txt 2009-10-17 21:09:06 +0000
@@ -11,11 +11,7 @@ and a little bit of necessary setup. Her
-- REQUIREMENTS --
-* SimpleTest module, along with the patch in
- http://drupal.org/node/211823
-
-* SimpleTest Framework
- https://sourceforge.net/project/showfiles.php?group_id=76550
+* SimpleTest module
* Text_Diff package from PEAR
http://pear.php.net/package/Text_Diff
@@ -23,14 +19,7 @@ and a little bit of necessary setup. Her
-- INSTALLATION --
-* If not already done, install SimpleTest module and SimpleTest framework as
- usual.
-
-* Apply above mentioned patch to SimpleTest module. See
- http://drupal.org/patch/apply for further information.
-
- FYI: This patch fixes some incompatibilities with our heavy OOP testing
- framework for coder_format. It should not break other tests.
+* If not already done, install SimpleTest module as usual.
* Download the Text_Diff package from PEAR into this directory, i.e.
@@ -44,14 +33,14 @@ and a little bit of necessary setup. Her
-- USAGE --
-* Go to admin/build/simpletest, and select Coder Format Tests, and run tests.
+* Go to admin/development/testing, and run "Coder Format" tests.
-- CUSTOMIZATIONS --
Currently, only the all.test is implemented, which is used to test
the overall output of coder_format_string_all(). Appropriate .phpt test
-files are located in the sub-directory all/.
+files are located in the sub-directory tests/.
The internal format for coder_format tests is:
@@ -72,6 +61,7 @@ For temporary development work, you can
case to make it the test runner only run that one. This is useful for test
files that contain multiple tests.
+
-- CONTACT --
Current maintainers:
=== removed file 'scripts/coder_format/tests/all.test'
--- scripts/coder_format/tests/all.test 2009-10-17 19:22:01 +0000
+++ scripts/coder_format/tests/all.test 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
- 'Full coder_format tests',
- 'description' => t('Tests all of the functionality of the coder_format script.'),
- 'group' => 'Coder Format Tests',
- );
- }
-
- function test() {
- $dir = drupal_get_path('module', 'coder') .'/scripts/coder_format/tests/tests';
- $files = array_keys(file_scan_directory($dir, '\.phpt$'));
- // Order tests alphabetically, but use a weight > 0 to append them after
- // overall test results.
- $c = 10;
- foreach ($files as $file) {
- $expectation = new CoderReviewTestFile();
- $result = $this->assert($expectation, $file, '%s');
- if (!$result) {
- $this->_reporter->writeContent($expectation->render(), $c++);
- }
- }
- }
-}
-
-}