You are here

function xbbcode_custom_tags_validate in Extensible BBCode 5

Same name and namespace in other branches
  1. 8 xbbcode.admin.inc \xbbcode_custom_tags_validate()
  2. 6 xbbcode.admin.inc \xbbcode_custom_tags_validate()
  3. 7 xbbcode.admin.inc \xbbcode_custom_tags_validate()

File

./xbbcode-settings.php, line 111

Code

function xbbcode_custom_tags_validate($id, $form) {
  if (!preg_match('/^[a-z0-9]*$/i', $form['name'])) {
    form_set_error('name', t('The tag name must be alphanumeric.'));
  }
  if ($form['oldname'] != $form['name']) {
    if (db_result(db_query("SELECT * FROM {xbbcode_custom_tags} WHERE name='%s'", $form['name']))) {
      form_set_error('name', t('Error while creating or renaming tag: This tag name is already ".
      "taken. Please delete or edit the old tag, or choose a different name.'));
    }
  }
}