You are here

function cpn_block_validate in Code per Node 7

Same name and namespace in other branches
  1. 6 cpn.module \cpn_block_validate()

Block validation callback.

Ensures no "style" or "script" tags are included.

1 string reference to 'cpn_block_validate'
cpn_form_alter in ./cpn.module
Implements of hook_form_alter().

File

./cpn.module, line 617
Primary hook implementations.

Code

function cpn_block_validate($form, &$form_state) {
  if (isset($form_state['values']['cpn']['css']) && cpn_validate($form_state['values']['cpn']['css'], 'css')) {
    form_set_error('cpn][css', t('Do not include @style tags in the CSS.', array(
      '@style' => '<style>',
    )));
  }
  if (isset($form_state['values']['cpn']['js']) && cpn_validate($form_state['values']['cpn']['js'], 'js')) {
    form_set_error('cpn][js', t('Do not include @script tags in the JavaScript.', array(
      '@script' => '<script>',
    )));
  }
  if (isset($form_state['values']['cpn']['noscript']) && cpn_validate($form_state['values']['cpn']['noscript'], 'noscript')) {
    form_set_error('cpn][noscript', t('Do not include @script tags in the NOSCRIPT field.', array(
      '@script' => '<noscript>',
    )));
  }
}