/** * Flush buffer, optionally tidy up HTML, and close output if it's not to a php stream */ public function flush() { if ($this->out && strncmp($this->outTarget, 'php://', 6) !== 0) { fclose($this->out); } if ($this->printsHTML === true && $this->outTarget !== null && strpos($this->outTarget, 'php://') !== 0 && strpos($this->outTarget, 'socket://') !== 0 && extension_loaded('tidy')) { file_put_contents($this->outTarget, tidy_repair_file($this->outTarget, array('indent' => true, 'wrap' => 0), 'utf8')); } }
/** * Flush buffer, optionally tidy up HTML, and close output. */ public function flush() { if ($this->out && $this->outTarget !== 'php://stderr') { fclose($this->out); } if ($this->printsHTML === TRUE && $this->outTarget !== NULL && strpos($this->outTarget, 'php://') !== 0 && strpos($this->outTarget, 'socket://') !== 0 && extension_loaded('tidy')) { file_put_contents($this->outTarget, tidy_repair_file($this->outTarget, array('indent' => TRUE, 'wrap' => 0), 'utf8')); } }
/** * Flush buffer, optionally tidy up HTML, and close output. * */ public function flush() { if ($this->out !== NULL) { fclose($this->out); } if ($this->printsHTML === TRUE && $this->outTarget !== NULL && extension_loaded('tidy')) { file_put_contents($this->outTarget, tidy_repair_file($this->outTarget)); } }
<?php $l = 1; $s = ""; $a = array(); tidy_repair_string($s, $l, $l, $l); tidy_repair_string($s, $s, $s, $s); tidy_repair_string($l, $l, $l, $l); tidy_repair_string($a, $a, $a, $a); tidy_repair_file($s, $l, $l, $l); tidy_repair_file($s, $s, $s, $s); tidy_repair_file($l, $l, $l, $l); tidy_repair_file($a, $a, $a, $a); echo "Done\n";
<?php $fixed = tidy_repair_file('bad.html'); file_put_contents('good.html', $fixed);
<?php $config = array('output-xhtml' => true); $fixed = tidy_repair_file('bad.html', $config); file_put_contents('good.xhtml', $fixed);
<?php $fix_html = tidy_repair_file('bad.html'); echo $fix_html;