plainText = $plainText; $this->setRemoveMedia( true ); $this->remove( $config->get( 'ExtractsRemoveClasses' ) ); if ( $plainText ) { $this->flattenAllTags(); } else { $this->flatten( array( 'a' ) ); } } public function getText( $dummy = null ) { $this->filterContent(); $text = parent::getText(); if ( $this->plainText ) { $text = html_entity_decode( $text ); $text = str_replace( "\xC2\xA0", ' ', $text ); // replace nbsp with space $text = str_replace( "\r", "\n", $text ); // for Windows $text = preg_replace( "/\n{3,}/", "\n\n", $text ); // normalise newlines } return $text; } public function onHtmlReady( $html ) { if ( $this->plainText ) { $html = preg_replace( '/\s*(getDoc(); $spans = $doc->getElementsByTagName( 'span' ); foreach ( $spans as $span ) { $span->removeAttribute( 'class' ); $span->removeAttribute( 'style' ); } return $removed; } }