Index: antispam.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/antispam/antispam.module,v retrieving revision 1.2 diff -u -r1.2 antispam.module --- antispam.module 10 Jun 2009 03:10:45 -0000 1.2 +++ antispam.module 5 Oct 2009 18:03:23 -0000 @@ -39,13 +39,6 @@ define('ANTISPAM_COUNT_FALSE_POSITIVE', 4); /** - * Implementation of hook_init(). - */ -function antispam_init() { - drupal_add_js(drupal_get_path('module', 'antispam') . '/antispam.js'); -} - -/** * Implementation of hook_help(). */ function antispam_help($path, $arg) { @@ -130,7 +123,7 @@ 'description' => t("Akismet spam protection service requires a WordPress.com API key to function. Obtain a key by signing up for a free account at WordPress.com, then enter the key on the AntiSpam settings page.", array( '!wpapikey' => url('http://wordpress.com/api-keys/'), - '!wordpress-com' => url('http://wordpress.com'), + '!wordpress-com' => url('http:drupal_add_js//wordpress.com'), '!antispam-settings' => url('admin/settings/antispam'), )), 'severity' => REQUIREMENT_ERROR, Index: antispam.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/antispam/antispam.admin.inc,v retrieving revision 1.3 diff -u -r1.3 antispam.admin.inc --- antispam.admin.inc 6 Jun 2009 09:50:06 -0000 1.3 +++ antispam.admin.inc 5 Oct 2009 18:03:23 -0000 @@ -26,29 +26,8 @@ $antispam_deapikey = variable_get('antispam_deapikey', ''); $service_provider = antispam_get_service_provider(); - switch ($service_provider) { - case AKISMET_SERVICE: - $apikey = $antispam_wpapikey; - $apikeyname = 'antispam_wpapikey'; - $wpapikey_div_style = 'visibility: visible; overflow: hidden;'; - $tpapikey_div_style = 'visibility: hidden; height: 0px; overflow: hidden;'; - $deapikey_div_style = 'visibility: hidden; height: 0px; overflow: hidden;'; - break; - case TYPEPAD_SERVICE: - $apikey = $antispam_tpapikey; - $apikeyname = 'antispam_tpapikey'; - $wpapikey_div_style = 'visibility: hidden; height: 0px; overflow: hidden;'; - $tpapikey_div_style = 'visibility: visible; overflow: hidden;'; - $deapikey_div_style = 'visibility: hidden; height: 0px; overflow: hidden;'; - break; - case DEFENSIO_SERVICE: - $apikey = $antispam_deapikey; - $apikeyname = 'antispam_deapikey'; - $wpapikey_div_style = 'visibility: hidden; height: 0px; overflow: hidden;'; - $tpapikey_div_style = 'visibility: hidden; height: 0px; overflow: hidden;'; - $deapikey_div_style = 'visibility: visible; overflow: hidden;'; - break; - } + // Validate the current API key. + $apikey = antispam_get_api_key($service_provider); if (empty($apikey)) { $is_valid = TRUE; } @@ -56,12 +35,17 @@ $is_valid = (antispam_api_cmd_verify_key($apikey) == ANTISPAM_API_RESULT_SUCCESS ? TRUE : FALSE); } + + // Provide the AntiSpam administration JavaScript. + drupal_add_js(drupal_get_path('module', 'antispam') .'/antispam.js'); + $service_fieldset_collapsed = FALSE; // always show $form['service'] = array( '#type' => 'fieldset', '#title' => t('AntiSpam Service Options'), '#collapsible' => TRUE, '#collapsed' => $service_fieldset_collapsed ); + $form['service']['antispam_service_provider'] = array( '#type' => 'radios', '#title' => t('Service Provider'), @@ -71,7 +55,6 @@ t('Defensio'), ), '#default_value' => $service_provider, - '#attributes' => array('onclick' => '_antispam_switch_provider_js(this)'), '#description' => t('Please select the anti spam service provider. Although they provide the similar services, TypePad AntiSpam service is free even for commercial sites while Akismet and Defensio have some limitations on the commercial usage.'), ); $form['service']['antispam_wpapikey'] = array( @@ -86,7 +69,7 @@ '!akismet-faq' => url('http://akismet.com/faq/'), ) ), - '#prefix' => '