[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/pattemplate/patTemplate/OutputFilter/ -> Tidy.php (source)

   1  <?PHP
   2  /**
   3   * patTemplate Tidy output filter
   4   *
   5   * $Id: Tidy.php 10381 2008-06-01 03:35:53Z pasamio $
   6   *
   7   * Used to tidy up your resulting HTML document,
   8   * requires ext/tidy.
   9   *
  10   * @package        patTemplate
  11   * @subpackage    Filters
  12   * @author        Stephan Schmidt <schst@php.net>
  13   */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  /**
  19   * requires tidy extension
  20   */
  21  define( 'PATTEMPLATE_OUTPUTFILTER_TIDY_ERROR_NOT_SUPPORTED', 'patTemplate::Outputfilter::Tidy::1' );
  22  
  23  /**
  24   * patTemplate Tidy output filter
  25   *
  26   * $Id: Tidy.php 10381 2008-06-01 03:35:53Z pasamio $
  27   *
  28   * Used to tidy up your resulting HTML document,
  29   * requires ext/tidy.
  30   *
  31   * @package        patTemplate
  32   * @subpackage    Filters
  33   * @author        Stephan Schmidt <schst@php.net>
  34   */
  35  class patTemplate_OutputFilter_Tidy extends patTemplate_OutputFilter
  36  {
  37      /***
  38      * filter name
  39      *
  40      * This has to be set in the final
  41      * filter classes.
  42      *
  43      * @var    string
  44      */
  45      var    $_name = 'Tidy';
  46  
  47      /***
  48      * tidy the data
  49      *
  50      * @access    public
  51      * @param    string        data
  52      * @return    string        compressed data
  53      */
  54  	function apply( $data )
  55      {
  56          if (!function_exists('tidy_parse_string')) {
  57              return $data;
  58          }
  59  
  60          /**
  61           * tidy 1.0
  62           */
  63          if (function_exists( 'tidy_setopt' ) && is_array( $this->_params)) {
  64              foreach ($this->_params as $opt => $value) {
  65                  tidy_setopt( $opt, $value );
  66              }
  67              tidy_parse_string($data);
  68              tidy_clean_repair();
  69              $data = tidy_get_output();
  70          } else {
  71              $tidy = tidy_parse_string($data, $this->_params);
  72              tidy_clean_repair($tidy);
  73              $data = tidy_get_output($tidy);
  74          }
  75  
  76          return $data;
  77      }
  78  }
  79  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1