mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-50868-master' of git://github.com/jethac/moodle
This commit is contained in:
commit
dbceb531a7
@ -567,4 +567,19 @@ EXPECTED;
|
||||
$this->assertSame($expected, strip_pluginfile_content($source));
|
||||
}
|
||||
|
||||
public function test_purify_html_ruby() {
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
$ruby =
|
||||
"<p><ruby><rb>京都</rb><rp>(</rp><rt>きょうと</rt><rp>)</rp></ruby>は" .
|
||||
"<ruby><rb>日本</rb><rp>(</rp><rt>にほん</rt><rp>)</rp></ruby>の" .
|
||||
"<ruby><rb>都</rb><rp>(</rp><rt>みやこ</rt><rp>)</rp></ruby>です。</p>";
|
||||
$illegal = '<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>';
|
||||
|
||||
$cleaned = purify_html($ruby . $illegal);
|
||||
$this->assertEquals($ruby, $cleaned);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1705,7 +1705,7 @@ function purify_html($text, $options = array()) {
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
$config->set('HTML.DefinitionID', 'moodlehtml');
|
||||
$config->set('HTML.DefinitionRev', 2);
|
||||
$config->set('HTML.DefinitionRev', 3);
|
||||
$config->set('Cache.SerializerPath', $cachedir);
|
||||
$config->set('Cache.SerializerPermissions', $CFG->directorypermissions);
|
||||
$config->set('Core.NormalizeNewlines', false);
|
||||
@ -1744,6 +1744,9 @@ function purify_html($text, $options = array()) {
|
||||
$def->addElement('algebra', 'Inline', 'Inline', array()); // Algebra syntax, equivalent to @@xx@@.
|
||||
$def->addElement('lang', 'Block', 'Flow', array(), array('lang'=>'CDATA')); // Original multilang style - only our hacked lang attribute.
|
||||
$def->addAttribute('span', 'xxxlang', 'CDATA'); // Current very problematic multilang.
|
||||
|
||||
// Use the built-in Ruby module to add annotation support.
|
||||
$def->manager->addModule(new HTMLPurifier_HTMLModule_Ruby());
|
||||
}
|
||||
|
||||
$purifier = new HTMLPurifier($config);
|
||||
|
Loading…
x
Reference in New Issue
Block a user