You are here

function xbbcode_filter in Extensible BBCode 5

Same name and namespace in other branches
  1. 6 xbbcode.module \xbbcode_filter()
1 call to xbbcode_filter()
xbbcode_filter_tips in ./xbbcode.module

File

./xbbcode.module, line 53

Code

function xbbcode_filter($op = 'list', $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(
        'Extensible BBCode',
      );
    case 'description':
      return t('Allows custom BBCode tags');
    case 'no cache':
      return FALSE;
    case 'process':
      $filter = xbbcode_get_filter($format);
      return $filter
        ->process($text);
    case 'settings':
      $form['xbbcode'] = array(
        '#type' => 'fieldset',
        '#title' => t("BBCode"),
        '#collapsible' => true,
        '#collapsed' => true,
      );
      $form['xbbcode']['tags'] = array(
        '#type' => 'item',
        '#value' => t("You may adjust the <a href='!url'>tag settings</a> for this format.", array(
          '!link' => url('admin/settings/xbbcode/handlers/' . $format),
        )),
      );
      $form['xbbcode']['xbbcode_filter_' . $format . '_autoclose'] = array(
        '#type' => 'checkbox',
        '#title' => t("Automatically close tags left open at the end of the text."),
        '#description' => t("You will need to enable this option if you use automatic teasers on your site. BBCode will never generate broken HTML, but otherwise the BBCode tags broken by the teaser will simply not be processed."),
        '#default_value' => variable_get('xbbcode_filter_' . $format . '_autoclose', false),
      );
      return $form;
  }
  return $text;
}