function admin_string_contains_illegal_chars

6.x admin.degrees.inc admin_string_contains_illegal_chars($testString)
7.x admin.degrees.inc admin_string_contains_illegal_chars($testString)
2 calls to admin_string_contains_illegal_chars()
admin_add_degree_form_validate in modules/admin/admin.degrees.inc
Validate handler for add_degree_form
admin_copy_degree_form_validate in modules/admin/admin.degrees.inc
Validate handler. Make sure our allow_overwrite setting is working. Check for existing major code.

File

modules/admin/admin.degrees.inc, line 265

Code

function admin_string_contains_illegal_chars($testString) {
  // These are characters we will allow:  
  static $MsgAry1 = array("a", "b", "c", "d",
    "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
    "o", "p", "q", "r", "s", "t", "u", "v", "w", "x",
    "y", "z", "1", "2", "3", "4", "5", "6", "7", "8",
    "9", "0", "-");

  $test = str_ireplace($MsgAry1, '', $testString);

  if (strstr($test, " ")) {
    return TRUE; // contains an illegal character!
  }

  // test should be empty if we only used valid chars!
  if (trim($test) == "") {
    return FALSE;
  }

  return TRUE;

}