You are here

function cpn_node_validate in Code per Node 7

Implements hook_node_validate().

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

File

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

Code

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