05.21
php
saved
Sliv
Note
A modified approach to http://bakery.cakephp.org/articles/view/tidy-output-filtering
A modified approach to http://bakery.cakephp.org/articles/view/tidy-output-filtering
- <?php
- class TidyHelper extends AppHelper {
- function __construct() {
- }
- }
- function __destruct() {
- $Tidy = new Tidy();
- 'doctype' => 'strict',
- 'drop-empty-paras' => true,
- 'drop-font-tags' => true,
- 'drop-proprietary-attributes' => true,
- 'enclose-block-text' => true,
- 'enclose-text' => true,
- 'hide-comments' => false,
- 'hide-endtags' => true,
- 'indent' => true,
- 'logical-emphasis' => true,
- 'lower-literals' => true,
- 'markup' => true,
- 'output-xhtml' => true,
- 'quote-ampersand' => true,
- 'quote-marks' => true,
- 'quote-nbsp' => true,
- 'show-warnings' => true,
- 'wrap' => 150
- );
- $Tidy->parseString($output, $tidyConfig, 'utf8');
- $Tidy->diagnose();
- $Tidy->cleanRepair();
- $output = tidy_get_output($Tidy);
- if ($Tidy->errorBuffer && Configure::read('debug') > 0) {
- $output = str_replace('</body>', '<pre id="tidy">' . htmlspecialchars($Tidy->errorBuffer) . "</pre>\n</body>", $output);
- }
- echo $output;
- }
- }
- }
- ?>
Parsed in 0.092 seconds, using GeSHi 1.0.7.14