You are here

function _syntaxhighlighter_comment_validate in Syntax Highlighter 7

Same name and namespace in other branches
  1. 8 syntaxhighlighter.module \_syntaxhighlighter_comment_validate()
  2. 7.2 syntaxhighlighter.module \_syntaxhighlighter_comment_validate()

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

1 string reference to '_syntaxhighlighter_comment_validate'
syntaxhighlighter_form_comment_form_alter in ./syntaxhighlighter.module
Install custom comment validate function

File

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

Code

function _syntaxhighlighter_comment_validate($form, &$form_state) {
  if (isset($form_state['values']['comment_body'])) {
    foreach ($form_state['values']['comment_body'] as $lang => $v) {
      if (_syntaxhighlighter_format_has_syntaxhighlighter_filter(isset($v[0]['format']) ? $v[0]['format'] : filter_fallback_format())) {
        _syntaxhighlighter_validate_input("comment_body][{$lang}][0][value", $v[0]['value']);
      }
    }
  }
}