summaryrefslogtreecommitdiff
path: root/ext/tidy/examples/cleanhtml5.php.orig
diff options
context:
space:
mode:
authorFlorian MARGAINE <florian@margaine.com>2014-09-20 10:01:44 +0200
committerFlorian MARGAINE <florian@margaine.com>2014-09-20 10:01:44 +0200
commitcf0303e7824c3e20e9db240f9d4e4b154cc2a72d (patch)
tree89aa4aab62b422615a7441552b3a0176b22b2b0d /ext/tidy/examples/cleanhtml5.php.orig
parent25f5ba94aca1e89ee5f0c66513e58826afa3b853 (diff)
downloadphp-git-cf0303e7824c3e20e9db240f9d4e4b154cc2a72d.tar.gz
Replaces php5 with php7, without whitespace changes.
Diffstat (limited to 'ext/tidy/examples/cleanhtml5.php.orig')
-rw-r--r--ext/tidy/examples/cleanhtml5.php.orig39
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/tidy/examples/cleanhtml5.php.orig b/ext/tidy/examples/cleanhtml5.php.orig
new file mode 100644
index 0000000000..2ce683acad
--- /dev/null
+++ b/ext/tidy/examples/cleanhtml5.php.orig
@@ -0,0 +1,39 @@
+<?php
+
+ /*
+ * cleanhtml5.php
+ *
+ * A simple script to clean and repair HTML,XHTML,PHP,ASP,etc. documents
+ * if no file is provided, it reads from standard input.
+ *
+ * NOTE: Works only with tidy for PHP 5, for tidy in PHP 4.3.x see cleanhtml.php
+ *
+ * By: John Coggeshall <john@php.net>
+ *
+ * Usage: php cleanhtml5.php [filename]
+ *
+ */
+
+ if(!isset($_SERVER['argv'][1])) {
+ $data = file_get_contents("php://stdin");
+ $tidy = tidy_parse_string($data);
+ } else {
+ $tidy = tidy_parse_file($_SERVER['argv'][1]);
+ }
+
+ $tidy->cleanRepair();
+
+ if(!empty($tidy->errorBuffer)) {
+
+ echo "\n\nThe following errors or warnings occurred:\n";
+ echo "{$tidy->errorBuffer}\n";
+
+ }
+
+ echo $tidy;
+
+?>
+
+
+
+