public function returnHtml(array $opts = array())
    {
        $curr_charset = $this->getCharset();
        if (strcasecmp($curr_charset, 'US-ASCII') === 0) {
            $curr_charset = 'UTF-8';
        }
        $charset = array_key_exists('charset', $opts)
            ? (empty($opts['charset']) ? $curr_charset : $opts['charset'])
            : $this->_origCharset;

        if (empty($opts['metacharset'])) {
            $text = $this->dom->saveHTML();
        } else {
            /* Add placeholder for META tag. Can't add charset yet because DOM
             * extension will alter output if it exists. */
            $meta = $this->dom->createElement('meta');
            $meta->setAttribute('http-equiv', 'content-type');
            $meta->setAttribute('horde_dom_html_charset', '');

            $head = $this->getHead();
            $head->insertBefore($meta, $head->firstChild);

            $text = str_replace(
                'horde_dom_html_charset=""',
                'content="text/html; charset=' . $charset . '"',
                $this->dom->saveHTML()
            );

            $head->removeChild($meta);
        }

        if (strcasecmp($curr_charset, $charset) !== 0) {
            $text = Horde_String::convertCharset($text, $curr_charset, $charset);
        }

        if (!$this->_xmlencoding ||
            (($pos = strpos($text, $this->_xmlencoding)) === false)) {
            return $text;
        }

        return substr_replace($text, '', $pos, strlen($this->_xmlencoding));
    }
public function returnHtml(array $opts = array())
    {
        $curr_charset = $this->getCharset();
        if (strcasecmp($curr_charset, 'US-ASCII') === 0) {
            $curr_charset = 'UTF-8';
        }
        $charset = array_key_exists('charset', $opts)
            ? (empty($opts['charset']) ? $curr_charset : $opts['charset'])
            : $this->_origCharset;

        if (empty($opts['metacharset'])) {
            $text = $this->dom->saveHTML();
        } else {
            /* Add placeholder for META tag. Can't add charset yet because DOM
             * extension will alter output if it exists. */
            $meta = $this->dom->createElement('meta');
            $meta->setAttribute('http-equiv', 'content-type');
            $meta->setAttribute('horde_dom_html_charset', '');

            $head = $this->getHead();
            $head->insertBefore($meta, $head->firstChild);

            $text = str_replace(
                'horde_dom_html_charset=""',
                'content="text/html; charset=' . $charset . '"',
                $this->dom->saveHTML()
            );

            $head->removeChild($meta);
        }

        if (strcasecmp($curr_charset, $charset) !== 0) {
            $text = Horde_String::convertCharset($text, $curr_charset, $charset);
        }

        if (!$this->_xmlencoding ||
            (($pos = strpos($text, $this->_xmlencoding)) === false)) {
            return $text;
        }

        return substr_replace($text, '', $pos, strlen($this->_xmlencoding));
    }
public function returnHtml ( array $ opts = array ( ) ) { $ curr_charset = $ this -> getCharset ( ) ; if ( strcasecmp ( $ curr_charset , 'US-ASCII' ) === 0 ) { $ curr_charset = 'UTF-8' ; } $ charset = array_key_exists ( 'charset' , $ opts ) ? ( empty ( $ opts [ 'charset' ] ) ? $ curr_charset : $ opts [ 'charset' ] ) : $ this -> _origCharset ; if ( empty ( $ opts [ 'metacharset' ] ) ) { $ text = $ this -> dom -> saveHTML ( ) ; } else { /* Add placeholder for META tag. Can't add charset yet because DOM
             * extension will alter output if it exists. */ $ meta = $ this -> dom -> createElement ( 'meta' ) ; $ meta -> setAttribute ( 'http-equiv' , 'content-type' ) ; $ meta -> setAttribute ( 'horde_dom_html_charset' , '' ) ; $ head = $ this -> getHead ( ) ; $ head -> insertBefore ( $ meta , $ head -> firstChild ) ; $ text = str_replace ( 'horde_dom_html_charset=""' , 'content="text/html; charset=' . $ charset . '"' , $ this -> dom -> saveHTML ( ) ) ; $ head -> removeChild ( $ meta ) ; } if ( strcasecmp ( $ curr_charset , $ charset ) !== 0 ) { $ text = Horde_String :: convertCharset ( $ text , $ curr_charset , $ charset ) ; } if ( ! $ this -> _xmlencoding || ( ( $ pos = strpos ( $ text , $ this -> _xmlencoding ) ) === false ) ) { return $ text ; } return substr_replace ( $ text , '' , $ pos , strlen ( $ this -> _xmlencoding ) ) ; }
Returns the full HTML text in the original charset.

@param array $opts  Additional options: (since 2.1.0)
- charset: (string) Return using this charset. If set but empty, will
return as currently stored in the DOM object.
- metacharset: (boolean) If true, will add a META tag containing the
charset information.

@return string  HTML text.
Returns the full HTML text in the original charset .