/** * Applies action * * @return boolean success */ protected function main() { $tidy = new tidy(); $xpath = $this->params['text']; $node = Nexista_Flow::find($xpath); $config = array('output-xhtml' => true, 'numeric-entities' => true, 'preserve-entities' => true); foreach ($node as $item) { $tidy->parseString($item->nodeValue, $config, 'utf8'); $tidy->cleanRepair(); $temp = str_replace('</body>', '', str_replace('<body>', '', $tidy->Body())); if (!strpos($temp, '&')) { $item->nodeValue = $temp; } } return true; }