--- nofollowlist.module.old 2007-07-05 10:07:01.000000000 -0400 +++ nofollowlist.module 2007-07-05 10:21:21.000000000 -0400 @@ -1,4 +1,53 @@ 'admin/settings/nofollowlist', + 'title' => t('Nofollowlist'), + 'description' => t('Add sites to the nofollowlist and determine whether links to those sites are followable or not.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('nofollowlist_settings_form'), + 'access' => user_access('administer nofollowlist'), + ); + + return $items; +} + +/** + * Implementation of hook_perm(). + */ +function nofollowlist_perm() { + return array('administer nofollowlist'); +} + +/** + * Builds the form for administrators to add sites to the black/white lists. + */ +function nofollowlist_settings_form() { + $form['nofollowlist_option'] = array( + '#type' => 'radios', + '#title' => t('Hosts list option'), + '#description' => t('If you choose the whitelist option, be sure to add your own site to the list!'), + '#options' => array( + 'black' => t('Blacklist: Add rel="nofollow" to links leading to the listed hosts.'), + 'white' => t('Whitelist: Add rel="nofollow" to all links except the listed hosts.'), + ), + '#default_value' => variable_get('nofollowlist_option', 'black'), + ); + + $form['nofollowlist_hosts'] = array( + '#type' => 'textarea', + '#title' => t('Nofollowlist hosts'), + '#description' => t('Add one host per line. Ex: en.wikipedia.org'), + '#default_value' => variable_get('nofollowlist_hosts', 'en.wikipedia.org'), + ); + + return system_settings_form($form); +} /** * Enter description here... @@ -11,7 +60,7 @@ function nofollowlist_help($section) { switch ($section) { case 'admin/help#nofollowlist': - $output = '
'. t('This module implements a simple filter to add the nofollow tag to sites that are on your blacklist.') .'
'; + $output = ''. t('This module implements a simple filter to add the nofollow tag to sites that are on your blacklist or to all sites except those on your whitelist.') .'
'; return $output; } } @@ -28,12 +77,12 @@ function nofollowlist_help($section) { * The tip to be displayed */ function nofollowlist_filter_tips($delta, $format, $long = false) { - $output .= ''. t('Links to certain hosts will have a rel="nofollow" added to them.'). "
\n"; + $output .= ''. t('Links to specified hosts will have a rel="nofollow" added to them.'). "
\n"; return $output; } /** - * Implentation of hook_filter. Defines a filter, "nofollow list filter", + * Implementation of hook_filter. Defines a filter, "Nofollow list filter", * that can be used in conjunction with the built in HTML filter to * automatically add the rel="nofollow" to links to certain sites * @@ -47,13 +96,13 @@ function nofollowlist_filter_tips($delta function nofollowlist_filter($op, $delta = 0, $format = -1, $text = '') { switch ($op) { case 'list': - return array(0 => t('nofollow list filter')); + return array(0 => t('Nofollow list filter')); case 'description': - return t('Links to certain hosts will have a rel="nofollow" added to them.'); + return t('Links to specified hosts will have a rel="nofollow" added to them.'); case "process": - $text = preg_replace_callback('!