You are here

function _readonlymode_form_list_check in Read only mode 8

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

Check for form_id in a given list.

Parameters

array $list: A string of form id's separated by newlines.

Return value

bool TRUE when matched, FALSE otherwise.

1 call to _readonlymode_form_list_check()
_readonlymode_form_check in ./readonlymode.module
Helper function to check form submissions.

File

./readonlymode.module, line 248
Read Only Mode provides an alternative 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 existing content…

Code

function _readonlymode_form_list_check($form_id, array $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;
}