onEnd[ed|ing]Validation()

onEndingValidation()

This function runs near the end of a validation, but before running other checkers (like HTML Tidy, nsgmls, the PHP syntax checker, and the JavaScript linter), and before the end validation program is run. (New v10.9912)

onEndedValidation()

This function runs at the very end of a validation, after any other checkers (like HTML Tidy, nsgmls, the PHP syntax checker, and the JavaScript linter), and after the end validation program is run. (New v11.9942)

See also: onCSSEnd[ed|ing]Validation()

Example 1:

This function clears all validation messages (and then generates one) if $filter_activated is true. Because it uses onEndedValidation() instead of onEndingValidation(), validator messages generated in the end validation program are also cleared.

function onEndedValidation() {
 if $filter_activated {
   clearMessages();
   MessageEx(9|1024,MSG_COMMENT,'Filter activated; validation aborted.');
  }
 }
}

Example 2:

This example writes appends an array to a file but first makes sure that the file exists. If the file doesn't exist then it creates the file with column headers.

function onEndedValidation() {
 $outfilename='C:\CSEValidator-output\validation_output.csv';
 if !existsFile($outfilename) { // write column headers if file doesn't exist
  writeFile($outfilename,'col1,col2,col3,col4,col5',1);
 }
 writeFile($outfilename,$csvfilearray,1); // append contents of array
}