1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 08:58:28 +02:00
Files
archived-php-src/ext/tidy

README FOR ext/tidy by John Coggeshall <john@php.net>

Tidy is an extension based on Libtidy (http://tidy.sf.net/) and allows a PHP developer
to clean, repair, and traverse HTML, XHTML, and XML documents -- including ones with
embedded scripting languages such as PHP or ASP within them using OO constructs.


The general API is provided below:

  tidy_create()                     Reinitialize the tidy engine
  tidy_parse_file($file)	    Parse the document stored in $file
  tidy_parse_string($str)    	    Parse the string stored in $str
  
  tidy_clean_repair()               Clean and repair the document
  tidy_diagnose()	            Diagnose a parsed document
  
  tidy_setopt($opt, $val)           Set a configuration option $opt to $val
  tidy_getopt($opt)                Retrieve a configuration option
  
    ** note: $opt is a string representing the option. Although no formal
    documentation yet exists for PHP, you can find a description of many
    of them at http://www.w3.org/People/Raggett/tidy/ and a list of supported
    options in the phpinfo(); output**
  
  tidy_get_output()                 Return the cleaned tidy HTML as a string
  tidy_get_error_buffer()           Return a log of the errors and warnings
                                    returned by tidy
  
  tidy_get_release()                Return the Libtidy release date
  tidy_get_status()                 Return the status of the document
  tidy_get_html_ver()               Return the major HTML version detected for
                                    the document;
                                    
  tidy_is_xhtml()                   Determines if the document is XHTML
  tidy_is_xml()                     Determines if the document is a generic XML
  
  tidy_error_count()                Returns the number of errors in the document
  tidy_warning_count()              Returns the number of warnings in the document
  tidy_access_count()               Returns the number of accessibility-related
                                    warnings in the document.
  tidy_config_count()               Returns the number of configuration errors found
  
  tidy_load_config($file)           Loads the specified configuration file
  tidY_load_config_enc($file,
                       $enc)        Loads the specified config file using the specified
                                    character encoding
  tidy_set_encoding($enc)           Sets the current character encoding for the document
  tidy_save_config($file)           Saves the current config to $file
  
  
E-mail thoughts, suggestions, patches, etc. to <john@php.net>