function testParseStyleList() { $el = new EditLib(); /* * empty */ $list = ''; $parsed = array(); $el->parseStyleList($list, $parsed); $this->assertEquals(0, count($parsed)); /* * mixed examples */ $list = 'rgb(0, 255, 0) #0000FF'; $parsed = array(); $el->parseStyleList($list, $parsed); $this->assertEquals(2, count($parsed)); $this->assertEquals('rgb(0, 255, 0)', $parsed[0]); $this->assertEquals('#0000FF', $parsed[1]); $list = 'rgb( 1 , 2 , 3 ) 20px url( background-example.gif )'; $parsed = array(); $el->parseStyleList($list, $parsed); $this->assertEquals(3, count($parsed)); $this->assertEquals('rgb( 1 , 2 , 3 )', $parsed[0]); $this->assertEquals('20px', $parsed[1]); $this->assertEquals('url( background-example.gif )', $parsed[2]); }
function testTeletype() { $this->markTestIncomplete('Work in progress.'); $el = new EditLib(); $inData = '{DIV(type="tt")}teletype{DIV}'; $exp = '<tt>teletype</tt>'; $out = $el->parseToWysiwyg($inData); $this->assertContains($exp, $out); }
/** * @param $body * @return parsed content */ function mailin_parse_body($body, $acc) { global $prefs; $is_html = false; $wysiwyg = NULL; if (mailin_containsStringHTML($body)) { $is_html = true; $wysiwyg = 'y'; } if ($is_html && $acc['save_html'] === 'y') { // Keep HTML setting. Always save as HTML return array('body' => $body, 'is_html' => $is_html, 'wysiwyg' => $wysiwyg); } if ($prefs['feature_wysiwyg'] === 'y' && $prefs['wysiwyg_default'] === 'y' && $prefs['wysiwyg_htmltowiki'] !== 'y') { // WYSIWYG HTML editor is active $is_html = true; $wysiwyg = 'y'; return array('body' => $body, 'is_html' => $is_html, 'wysiwyg' => $wysiwyg); } if ($is_html) { include_once "lib/wiki/editlib.php"; $editlib = new EditLib(); $body = $editlib->parseToWiki($body); $is_html = false; $wysiwyg = NULL; } return array('body' => $body, 'is_html' => $is_html, 'wysiwyg' => $wysiwyg); }