/** * @dataProvider provider */ public function testBeautifier($filename) { $outname = $filename . 'o'; $content = trim(file_get_contents($filename)); $out = trim(file_get_contents($outname)); $conv = Beautifier::HTMLPrepare($content); // more verbose $out = str_replace('<br />', "\n", $out); $this->assertEquals($conv, $out); }
public function setDescription($text = '') { $tmp = Beautifier::HTMLPrepare($text); $this->description = $tmp; // stemmer $tmp .= ' ' . $this->getTitle(); $words = Stemmer::ExtractWords($tmp); $this->stem = Stemmer::Stem($words); // /stemmer if (preg_match('/([^ \\n\\r]+[ \\n\\r]+){30}/s', $this->description, $match)) { $this->description_short = trim(str_replace("\n\n", "\n", $match[0])) . '...'; } return $this; }