You are here

function _readonlymode_form_list_check in Read only mode 7

Same name and namespace in other branches
  1. 8 readonlymode.module \_readonlymode_form_list_check()
  2. 6 readonlymode.module \_readonlymode_form_list_check()

Check for form_id is a given list.

$list is a string of form ids separated by newlines. Returns TRUE is matched, FALSE otherwise.

1 call to _readonlymode_form_list_check()
_readonlymode_form_check in ./readonlymode.module
Internal handler to check whether this form is to be restricted.

File

./readonlymode.module, line 310
The Read Ony Mode main module file.

Code

function _readonlymode_form_list_check($form_id, $list) {
  $l = preg_split('/(\\r\\n|\\n|\\r)/', $list);
  foreach ($l as $word) {

    // Skip empty words.
    if (empty($word)) {
      continue;
    }
    $word = str_replace('*', '.*', $word);
    if (preg_match('/^' . $word . '$/', $form_id) === 1) {
      return TRUE;
    }
  }
  return FALSE;
}