You are here

public function ViewsAddButtonTrait::viewsAddButtonCleanupSpecialCharacters in Views Add Button 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/ViewsAddButtonTrait.php \Drupal\views_add_button\Plugin\views\ViewsAddButtonTrait::viewsAddButtonCleanupSpecialCharacters()
1 call to ViewsAddButtonTrait::viewsAddButtonCleanupSpecialCharacters()
ViewsAddButtonTrait::getQueryString in src/Plugin/views/ViewsAddButtonTrait.php

File

src/Plugin/views/ViewsAddButtonTrait.php, line 7

Class

ViewsAddButtonTrait

Namespace

Drupal\views_add_button\Plugin\views

Code

public function viewsAddButtonCleanupSpecialCharacters($str = '') {

  /*
   * Perform bracket and special character replacement.
   * For security reasons, we are not opening this to most characters.
   * @see https://www.drupal.org/project/views_add_button/issues/3095849
   */
  $replace = [
    '%5B' => '[',
    '%5D' => ']',
    '&' => '&',
  ];
  return strtr($str, $replace);
}