You are here

function syntaxhighlighter_nodeapi in Syntax Highlighter 6

Same name and namespace in other branches
  1. 6.2 syntaxhighlighter.module \syntaxhighlighter_nodeapi()

Validate on the node input text to be sure there is no bad {syntaxhighlighter} tags

File

./syntaxhighlighter.module, line 193
Syntax highlight code using the Syntaxhighlighter javascript library. See http://alexgorbatchev.com/wiki/SyntaxHighlighter

Code

function syntaxhighlighter_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'validate':
      $teaser_break = strpos($node->body, '<!--break-->');
      if ($teaser_break === 0) {
        _syntaxhighlighter_validate_input('body', $node->body);
      }
      else {
        _syntaxhighlighter_validate_input('teaser_js', $node->teaser_js);
        _syntaxhighlighter_validate_input('body', substr($node->body, $teaser_break));
      }
      break;
  }
}