You are here

function lightbox2_filter_xss in Lightbox2 8

Same name and namespace in other branches
  1. 5.2 lightbox2.module \lightbox2_filter_xss()
  2. 6 lightbox2.module \lightbox2_filter_xss()
  3. 7.2 lightbox2.module \lightbox2_filter_xss()
  4. 7 lightbox2.module \lightbox2_filter_xss()
1 string reference to 'lightbox2_filter_xss'
lightbox2_menu in ./lightbox2.module
Implementation of hook_menu().

File

./lightbox2.module, line 1733
Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.

Code

function lightbox2_filter_xss() {
  $allowed_tags = trim(\Drupal::config('lightbox2.settings')
    ->get('lightbox2_filter_xss_allowed_tags'));
  $allowed_tags = empty($allowed_tags) ? array() : preg_split('/[,\\s]+/', $allowed_tags);
  if (!empty($_POST['allowed_tags']) && $_POST['allowed_tags'] != 'undefined') {
    $allowed_tags = explode(',', $_POST['allowed_tags']);
    $output = \Drupal\Component\Utility\Xss::filter($_POST['string'], $allowed_tags);
  }
  else {
    $output = \Drupal\Component\Utility\Xss::filter($_POST['string'], $allowed_tags);
  }
  drupal_json_output($output);
}