You are here

function rel_to_abs_filter in Relative Path to Absolute URLs 6

Implementation of hook_filter().

File

./rel_to_abs.module, line 14
Relative Paths to Absolute URLs

Code

function rel_to_abs_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
  if ($op == 'prepare') {
    return $text;
  }
  elseif ($op == 'process' && $text != '') {
    $lang = language_default();
    $front = url('<front>', array(
      'absolute' => TRUE,
      'language' => $lang,
    ));
    $base_url = $front;
    $text = _absolute_url($text, $base_url);
    return $text;
  }
  elseif ($op === 'list') {
    return array(
      t('Relative Paths to Absolute URLs'),
    );
  }
  elseif ($op === 'description') {
    return t('Filter for conversion of relative paths to absolute URLs');
  }
  elseif ($op === 'settings') {
    return array();
  }
  return $text;
}