Skip to content

Instantly share code, notes, and snippets.

@tommorris
Created August 2, 2008 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommorris/3744 to your computer and use it in GitHub Desktop.
Save tommorris/3744 to your computer and use it in GitHub Desktop.
<?php
function tidyInput($input) {
exec("echo " . escapeshellarg($input) . " | /usr/bin/tidy --indent auto --indent-spaces 2 --output-xhtml yes --show-errors 0 --show-warnings no --quiet yes --tidy-mark no --show-body-only yes", $response);
return implode("\n", $response);
}
/* this is for use in my blogging application to clean up fragments of XHTML on my own site. Clean your inputs and prevent failure. :) -tom */
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment