private function printCData(&$cdata, $outline = false)
    {
        $cdata = trim($cdata);
        $ret = '';

        /*$t = '';

        if ($outline) {
            //echo $tag->getName();
            $t = ' yes';
        }*/

        if ($cdata === '') {
            return $ret;
        }

        //$e = function ($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); };

        if (
            // All top-level blocks of CDATA have to be surrounded with <p>
            //($this->m_stack->size() == 0)

            // An outline tag starts after this CDATA block
            //|| ($tag != null)
            /*||*/ $outline

            /*
             * Obvious. Should make a difference between \n and \n\n though
             * TODO
             */
            || (mb_strpos($cdata, "\n"))

            /* TODO Add FORCE_PARAGRAPHS parameter to tags (li?, blockquote, ...) */
            || ($this->m_stack->count() > 0
                    && $this->m_stack->top()->isOfType(self::TAG_FORCE_PARAGRAPHS))
        ) {
            if ($this->m_stack->count() > 0
                && $this->m_stack->top()->isOfType(self::TAG_PRE)
            ) {
                /*
                 * We are inside of a TAG_PRE tag and do not want the CDATA to
                 * be reformatted
                 */

                //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]';
                $ret .= $cdata;
            } else {
                //$cdata = $e($cdata);

                $cdata = str_replace("\n\n", '</p><p>', $cdata);
                $cdata = str_replace("\n", "<br />\n", $cdata);
                $cdata = str_replace('</p><p>', "</p>\n\n<p>", $cdata);
                //$ret .= '<p>' . '[CDATA' . $t . ']' . $cdata . '[/CDATA]' . "</p>\n";
                $ret .= '<p>' . $cdata . "</p>\n";
            }
        } else {
            /* No need to add paragraph markup (something like [li]CDATA[/li]) */

            //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]';
            $ret .= $cdata;
        }

        $cdata = '';

        return $ret;
    }
private function printCData(&$cdata, $outline = false)
    {
        $cdata = trim($cdata);
        $ret = '';

        /*$t = '';

        if ($outline) {
            //echo $tag->getName();
            $t = ' yes';
        }*/

        if ($cdata === '') {
            return $ret;
        }

        //$e = function ($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); };

        if (
            // All top-level blocks of CDATA have to be surrounded with <p>
            //($this->m_stack->size() == 0)

            // An outline tag starts after this CDATA block
            //|| ($tag != null)
            /*||*/ $outline

            /*
             * Obvious. Should make a difference between \n and \n\n though
             * TODO
             */
            || (mb_strpos($cdata, "\n"))

            /* TODO Add FORCE_PARAGRAPHS parameter to tags (li?, blockquote, ...) */
            || ($this->m_stack->count() > 0
                    && $this->m_stack->top()->isOfType(self::TAG_FORCE_PARAGRAPHS))
        ) {
            if ($this->m_stack->count() > 0
                && $this->m_stack->top()->isOfType(self::TAG_PRE)
            ) {
                /*
                 * We are inside of a TAG_PRE tag and do not want the CDATA to
                 * be reformatted
                 */

                //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]';
                $ret .= $cdata;
            } else {
                //$cdata = $e($cdata);

                $cdata = str_replace("\n\n", '</p><p>', $cdata);
                $cdata = str_replace("\n", "<br />\n", $cdata);
                $cdata = str_replace('</p><p>', "</p>\n\n<p>", $cdata);
                //$ret .= '<p>' . '[CDATA' . $t . ']' . $cdata . '[/CDATA]' . "</p>\n";
                $ret .= '<p>' . $cdata . "</p>\n";
            }
        } else {
            /* No need to add paragraph markup (something like [li]CDATA[/li]) */

            //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]';
            $ret .= $cdata;
        }

        $cdata = '';

        return $ret;
    }
private function printCData ( & $ cdata , $ outline = false ) { $ cdata = trim ( $ cdata ) ; $ ret = '' ; /*$t = '';

        if ($outline) {
            //echo $tag->getName();
            $t = ' yes';
        }*/ if ( $ cdata === '' ) { return $ ret ; } //$e = function ($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); }; if ( // All top-level blocks of CDATA have to be surrounded with <p> //($this->m_stack->size() == 0) // An outline tag starts after this CDATA block //|| ($tag != null) /*||*/ $ outline /*
             * Obvious. Should make a difference between \n and \n\n though
             * TODO
             */ || ( mb_strpos ( $ cdata , "\n" ) ) /* TODO Add FORCE_PARAGRAPHS parameter to tags (li?, blockquote, ...) */ || ( $ this -> m_stack -> count ( ) > 0 && $ this -> m_stack -> top ( ) -> isOfType ( self :: TAG_FORCE_PARAGRAPHS ) ) ) { if ( $ this -> m_stack -> count ( ) > 0 && $ this -> m_stack -> top ( ) -> isOfType ( self :: TAG_PRE ) ) { /*
                 * We are inside of a TAG_PRE tag and do not want the CDATA to
                 * be reformatted
                 */ //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]'; $ ret .= $ cdata ; } else { //$cdata = $e($cdata); $ cdata = str_replace ( "\n\n" , '</p><p>' , $ cdata ) ; $ cdata = str_replace ( "\n" , "<br />\n" , $ cdata ) ; $ cdata = str_replace ( '</p><p>' , "</p>\n\n<p>" , $ cdata ) ; //$ret .= '<p>' . '[CDATA' . $t . ']' . $cdata . '[/CDATA]' . "</p>\n"; $ ret .= '<p>' . $ cdata . "</p>\n" ; } } else { /* No need to add paragraph markup (something like [li]CDATA[/li]) */ //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]'; $ ret .= $ cdata ; } $ cdata = '' ; return $ ret ; }
Formats whole blocks of CDATA

@param  string $cdata
@param  boolean $outline
@return string
Formats whole blocks of CDATA