You are here

function cpn_validate in Code per Node 7

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

Validates CSS or JavaScript.

3 calls to cpn_validate()
cpn_block_validate in ./cpn.module
Block validation callback.
cpn_node_type_validate in ./cpn.module
Node type validation callback.
cpn_node_validate in ./cpn.module
Implements hook_node_validate().

File

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

Code

function cpn_validate($data, $type) {
  $patterns = array(
    'css' => '~<\\s*\\/?\\s*style\\s*.*?>~i',
    'js' => '~<\\s*\\/?\\s*script\\s*.*?>~i',
    'noscript' => '~<\\s*\\/?\\s*noscript\\s*.*?>~i',
  );
  return preg_match($patterns[$type], $data);
}