You are here

function pathologic_filter in Pathologic 6.3

Same name and namespace in other branches
  1. 5 pathologic.module \pathologic_filter()
  2. 6 pathologic.module \pathologic_filter()
  3. 6.2 pathologic.module \pathologic_filter()

Implementation of hook_filter_info().

File

./pathologic.module, line 15
Pathologic text filter for Drupal.

Code

function pathologic_filter($op, $delta = 0, $format = -1, $text = '') {
  if ($op === 'process' && $text !== '') {
    return _pathologic($text, $format);
  }
  elseif ($op === 'list') {
    return array(
      t('Pathologic'),
    );
  }
  elseif ($op === 'description') {
    return t('Corrects paths in links and images in your Drupal content in situations which would otherwise cause them to “break.”');
  }
  elseif ($op === 'settings') {
    return array(
      'filter_pathologic' => array(
        '#type' => 'fieldset',
        '#title' => t('Pathologic'),
        '#collapsible' => TRUE,
        'filter_pathologic_local_paths_' . $format => array(
          '#type' => 'textarea',
          '#title' => t('Also considered local'),
          '#default_value' => variable_get('filter_pathologic_local_paths_' . $format, ''),
          '#description' => t('Enter the beginning of paths which should also be considered local for this server. Please read <a href="!docs">Pathologic&rsquo;s documentation</a> for more information about this feature. If the site is using a WYSIWYG content editor such as CKEditor or TinyMCE, you will probably need to enter a single slash (<code>/</code>) in this field.', array(
            '!docs' => 'http://drupal.org/node/257026',
          )),
          '#weight' => 10,
        ),
        'filter_pathologic_absolute_' . $format => array(
          '#type' => 'checkbox',
          '#title' => t('Output full absolute URLs'),
          '#default_value' => variable_get('filter_pathologic_absolute_' . $format, TRUE),
          '#description' => t('If checked, Pathologic will output full absolute URLs, with a protocol and server fragment (such as <code>http://example.com/foo/bar</code>); this is useful if you want images and links to not break for those reading the content in a feed reader or through some other form of aggregation. However, in cases where the site is being served via both HTTP and HTTPS, it may be necessary to uncheck this box so that protocol and server fragments are omitted in the paths Pathologic creates (such as <code>/foo/bar</code>) to avoid issues where the browser complains about pages containing both secure and insecure content.'),
          '#weight' => 20,
        ),
      ),
    );
  }
  return $text;
}