You are here

function nofollowlist_filter in Nofollow List 6

Same name and namespace in other branches
  1. 5 nofollowlist.module \nofollowlist_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

Parameters

string $op:

int $delta:

int $format:

string $text: The text to be filtered

Return value

string

File

./nofollowlist.module, line 95

Code

function nofollowlist_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(
        0 => t('Nofollow list filter'),
      );
    case 'description':
      return t('Links to specified hosts will have a rel="nofollow" added to them.');
    case "process":
      $text = preg_replace_callback('!<a.*?href="([^"]+)".*?>!', 'nofollowlist_replace', $text);
      return $text;
    default:
      return $text;
  }
}