You are here

function cpn_validate in Code per Node 6

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

Validates CSS or JavaScript.

3 calls to cpn_validate()
cpn_block_validate in ./cpn.module
Block validation callback.
cpn_nodeapi in ./cpn.module
Implementation of hook_nodeapi().
cpn_node_type_validate in ./cpn.module
Node type validation callback.

File

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

Code

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