Index: nofollowlist.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nofollowlist/nofollowlist.module,v retrieving revision 1.4.2.1 diff -u -p -r1.4.2.1 nofollowlist.module --- nofollowlist.module 22 May 2009 17:14:20 -0000 1.4.2.1 +++ nofollowlist.module 22 Jun 2009 15:57:24 -0000 @@ -46,6 +46,13 @@ function nofollowlist_settings_form() { '#default_value' => variable_get('nofollowlist_hosts', 'en.wikipedia.org'), ); + $form['nofollowlist_urls'] = array( + '#type' => 'textarea', + '#title' => t('Nofollowlist URLs'), + '#description' => t('Enter individual URLs to add to the list, if you need more granular control than per-host. One URL per line.'), + '#default_value' => variable_get('nofollowlist_urls', ''), + ); + return system_settings_form($form); } @@ -119,7 +126,8 @@ function nofollowlist_filter($op, $delta */ function nofollowlist_replace($match) { $url = parse_url($match[1]); - $list = preg_split('/\s+/', variable_get('nofollowlist_hosts', 'en.wikipedia.org')); + $hosts_list = preg_split('/\s+/', variable_get('nofollowlist_hosts', 'en.wikipedia.org')); + $urls_list = preg_split('/\s+/', variable_get('nofollowlist_urls', '')); // Default in case it doesn't get changed. $link = $match[0]; @@ -127,13 +135,15 @@ function nofollowlist_replace($match) { // Handle relative links by adding base_url to the host if (empty($url['host'])) { $url['host'] = parse_url($GLOBALS['base_url'], PHP_URL_HOST); + $match[1] = $GLOBALS['base_url'] . $match[1]; } + // Matches if the list is set as a blacklist and the host is in the list or if // the list is set as a whitelist and the host is not found in the list. if ((variable_get('nofollowlist_option', 'black') == 'black' && - in_array($url['host'], $list)) || + (in_array($url['host'], $hosts_list) || in_array($match[1], $urls_list))) || (variable_get('nofollowlist_option', 'black') == 'white' && - !in_array($url['host'], $list))) { + !(in_array($url['host'], $hosts_list) || in_array($match[1], $urls_list)))) { if (strpos($match[0], 'nofollow') === FALSE) { // Only add the nofollow if it doesn't already exist.