/** * Format Shaarli's description * TODO: Move me to ApplicationUtils when it's ready. * * @param string $description shaare's description. * @param string $redirector if a redirector is set, use it to gerenate links. * * @return string formatted description. */ function format_description($description, $redirector) { return nl2br(space2nbsp(text2clickable($description, $redirector))); }
/** * Test testSpace2nbsp. */ public function testSpace2nbsp() { $text = ' Are you thrilled by flags ?' . PHP_EOL . ' Really?'; $expectedText = ' Are you thrilled by flags ?' . PHP_EOL . ' Really?'; $processedText = space2nbsp($text); $this->assertEquals($expectedText, $processedText); }