Exemplo n.º 1
0
 /**
  * Convert this Wibble\HTML\Document to serialised HTML/XHTML string
  *
  * @return string
  */
 public function toString()
 {
     $xpath = new \DOMXPath($this->getDOM());
     $result = $xpath->query('/html/body');
     if ($result->length == 0) {
         return '';
     }
     $output = $this->_getInnerHTML($result->item(0));
     $output = $this->_htmlEntityDecode($output, 'UTF-8');
     if (!class_exists('\\tidy') && !$this->_options['disable_tidy']) {
         throw new Wibble\Exception('It is highly recommended that Wibble operate with support from' . ' the PHP Tidy extension to ensure output wellformedness. If' . ' you are unable to install this extension you may explicitly' . ' disable Tidy support by setting the disable_tidy configuration' . ' option to FALSE. Without ext/tidy enabled, output is in no' . ' way guaranteed to comply entirely to the target HTML standard.');
     } elseif ($this->_options['disable_tidy']) {
         $output = Wibble\Utility::convertFromUTF8($output, $this->_options['output_encoding']);
         return $output;
     }
     $output = $this->_applyTidy($output, true);
     return $output = Wibble\Utility::convertFromUTF8($output, $this->_options['output_encoding']);
 }
Exemplo n.º 2
0
 /**
  * Convert this Wibble\HTML\Document to serialised HTML/XHTML string
  *
  * @return string
  */
 public function toString()
 {
     $output = $this->_dom->saveHTML();
     $output = $this->_htmlEntityDecode($output, 'UTF-8');
     if (!class_exists('\\tidy') && !$this->_options['disable_tidy']) {
         throw new Wibble\Exception('It is highly recommended that Wibble operate with support from' . ' the PHP Tidy extension to ensure output wellformedness. If' . ' you are unable to install this extension you may explicitly' . ' disable Tidy support by setting the disable_tidy configuration' . ' option to FALSE');
     } elseif ($this->_options['disable_tidy']) {
         $output = Wibble\Utility::convertFromUTF8($output, $this->_options['output_encoding']);
         return $output;
     }
     $output = $this->_applyTidy($output, true);
     return $output = Wibble\Utility::convertFromUTF8($output, $this->_options['output_encoding']);
 }