You are here

public static function Path2ban::addNewEntries in path2ban 7.2

A utility function to add new entries to the restricted paths list.

Parameters

array $new_entries:

2 calls to Path2ban::addNewEntries()
path2ban_update_7101 in ./path2ban.install
Implements hook_update_N().
path2ban_update_7201 in ./path2ban.install
Implements hook_update_N().

File

src/Path2ban.php, line 120
path2ban core functionality file.

Class

Path2ban
@class Path2ban The Path2ban class contains the core functionality to assess and block visitors who violate rules.

Code

public static function addNewEntries($new_entries) {
  $list = variable_get('path2ban_list', path2ban_get_default_paths_to_ban());
  $list = $list . "\n";

  // Check that the user hasn't already added them before adding.
  foreach ($new_entries as $each_new_entry) {
    if (FALSE === strpos($list, $each_new_entry)) {
      $list .= $each_new_entry . "\n";
    }
  }
  variable_set('path2ban_list', $list);
}