protected function _convert_pre(&$text)
    {
        // get the content of PRE element
        while (preg_match('/<pre[^>]*>(.*)<\/pre>/ismU', $text, $matches)) {
            $this->pre_content = $matches[1];

            // Run our defined tags search-and-replace with callback
            $this->pre_content = preg_replace_callback(
                $this->callback_search,
                array($this, '_preg_callback'),
                $this->pre_content
            );

            // convert the content
            $this->pre_content = sprintf(
                '<div><br>%s<br></div>',
                preg_replace($this->pre_search, $this->pre_replace, $this->pre_content)
            );

            // replace the content (use callback because content can contain $0 variable)
            $text = preg_replace_callback(
                '/<pre[^>]*>.*<\/pre>/ismU',
                array($this, '_preg_pre_callback'),
                $text,
                1
            );

            // free memory
            $this->pre_content = '';
        }
    }
protected function _convert_pre(&$text)
    {
        // get the content of PRE element
        while (preg_match('/<pre[^>]*>(.*)<\/pre>/ismU', $text, $matches)) {
            $this->pre_content = $matches[1];

            // Run our defined tags search-and-replace with callback
            $this->pre_content = preg_replace_callback(
                $this->callback_search,
                array($this, '_preg_callback'),
                $this->pre_content
            );

            // convert the content
            $this->pre_content = sprintf(
                '<div><br>%s<br></div>',
                preg_replace($this->pre_search, $this->pre_replace, $this->pre_content)
            );

            // replace the content (use callback because content can contain $0 variable)
            $text = preg_replace_callback(
                '/<pre[^>]*>.*<\/pre>/ismU',
                array($this, '_preg_pre_callback'),
                $text,
                1
            );

            // free memory
            $this->pre_content = '';
        }
    }
protected function _convert_pre ( & $ text ) { // get the content of PRE element while ( preg_match ( '/<pre[^>]*>(.*)<\/pre>/ismU' , $ text , $ matches ) ) { $ this -> pre_content = $ matches [ 1 ] ; // Run our defined tags search-and-replace with callback $ this -> pre_content = preg_replace_callback ( $ this -> callback_search , array ( $ this , '_preg_callback' ) , $ this -> pre_content ) ; // convert the content $ this -> pre_content = sprintf ( '<div><br>%s<br></div>' , preg_replace ( $ this -> pre_search , $ this -> pre_replace , $ this -> pre_content ) ) ; // replace the content (use callback because content can contain $0 variable) $ text = preg_replace_callback ( '/<pre[^>]*>.*<\/pre>/ismU' , array ( $ this , '_preg_pre_callback' ) , $ text , 1 ) ; // free memory $ this -> pre_content = '' ; } }
Helper function for PRE body conversion.

@param string $text HTML content
Helper function for PRE body conversion .