You are here

function _readonlymode_form_list_check in Read only mode 6

Same name and namespace in other branches
  1. 8 readonlymode.module \_readonlymode_form_list_check()
  2. 7 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. Returns TRUE if the form is allowed, FALSE otherwise.

File

./readonlymode.module, line 206
Read Only Mode provides an alternate to the built in 'Maintenance Mode' in Drupal. Instead of displaying a static text file to users while the site is in maintenance mode, Read Only Mode will allow access (reading) of new content while…

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;
}