mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 16:33:00 +00:00
Offload html escaping from editor to parsedown
This commit is contained in:
parent
2afb044672
commit
b044651dc3
4 changed files with 18 additions and 2 deletions
|
@ -3318,6 +3318,8 @@ register_module([
|
||||||
|
|
||||||
// Read in the new page content
|
// Read in the new page content
|
||||||
$pagedata = $_POST["content"];
|
$pagedata = $_POST["content"];
|
||||||
|
/*** Note needed anymore as Parsedown has an option that does ***
|
||||||
|
*** this for us, and is _way_ more intelligent about it. ***
|
||||||
// Santise it if necessary
|
// Santise it if necessary
|
||||||
if($settings->clean_raw_html)
|
if($settings->clean_raw_html)
|
||||||
{
|
{
|
||||||
|
@ -3327,6 +3329,7 @@ register_module([
|
||||||
// the less than sign ('<') that is used to open HTML tags.
|
// the less than sign ('<') that is used to open HTML tags.
|
||||||
$pagedata = str_replace(">", ">", $pagedata);
|
$pagedata = str_replace(">", ">", $pagedata);
|
||||||
}
|
}
|
||||||
|
***/
|
||||||
|
|
||||||
// Read in the new page tags, so long as there are actually some tags to read in
|
// Read in the new page tags, so long as there are actually some tags to read in
|
||||||
$page_tags = [];
|
$page_tags = [];
|
||||||
|
@ -4155,6 +4158,11 @@ register_module([
|
||||||
$parser = new PeppermintParsedown();
|
$parser = new PeppermintParsedown();
|
||||||
$parser->setInternalLinkBase("?page=%s");
|
$parser->setInternalLinkBase("?page=%s");
|
||||||
add_parser("parsedown", function($source) use ($parser) {
|
add_parser("parsedown", function($source) use ($parser) {
|
||||||
|
global $settings;
|
||||||
|
if($settings->clean_raw_html)
|
||||||
|
$parser->setMarkupEscaped(true);
|
||||||
|
else
|
||||||
|
$parser->setMarkupEscaped(false);
|
||||||
$result = $parser->text($source);
|
$result = $parser->text($source);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
|
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
|
||||||
"id": "page-edit",
|
"id": "page-edit",
|
||||||
"lastupdate": 1460142693,
|
"lastupdate": 1460145881,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
"author": "Emanuil Rusev & Starbeamrainbowlabs",
|
"author": "Emanuil Rusev & Starbeamrainbowlabs",
|
||||||
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds a some weight to your installation, and also *requires* write access to the disk on first load.",
|
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds a some weight to your installation, and also *requires* write access to the disk on first load.",
|
||||||
"id": "parser-parsedown",
|
"id": "parser-parsedown",
|
||||||
"lastupdate": 1460137501,
|
"lastupdate": 1460145045,
|
||||||
"optional": false
|
"optional": false
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -123,6 +123,8 @@ register_module([
|
||||||
|
|
||||||
// Read in the new page content
|
// Read in the new page content
|
||||||
$pagedata = $_POST["content"];
|
$pagedata = $_POST["content"];
|
||||||
|
/*** Note needed anymore as Parsedown has an option that does ***
|
||||||
|
*** this for us, and is _way_ more intelligent about it. ***
|
||||||
// Santise it if necessary
|
// Santise it if necessary
|
||||||
if($settings->clean_raw_html)
|
if($settings->clean_raw_html)
|
||||||
{
|
{
|
||||||
|
@ -132,6 +134,7 @@ register_module([
|
||||||
// the less than sign ('<') that is used to open HTML tags.
|
// the less than sign ('<') that is used to open HTML tags.
|
||||||
$pagedata = str_replace(">", ">", $pagedata);
|
$pagedata = str_replace(">", ">", $pagedata);
|
||||||
}
|
}
|
||||||
|
***/
|
||||||
|
|
||||||
// Read in the new page tags, so long as there are actually some tags to read in
|
// Read in the new page tags, so long as there are actually some tags to read in
|
||||||
$page_tags = [];
|
$page_tags = [];
|
||||||
|
|
|
@ -11,6 +11,11 @@ register_module([
|
||||||
$parser = new PeppermintParsedown();
|
$parser = new PeppermintParsedown();
|
||||||
$parser->setInternalLinkBase("?page=%s");
|
$parser->setInternalLinkBase("?page=%s");
|
||||||
add_parser("parsedown", function($source) use ($parser) {
|
add_parser("parsedown", function($source) use ($parser) {
|
||||||
|
global $settings;
|
||||||
|
if($settings->clean_raw_html)
|
||||||
|
$parser->setMarkupEscaped(true);
|
||||||
|
else
|
||||||
|
$parser->setMarkupEscaped(false);
|
||||||
$result = $parser->text($source);
|
$result = $parser->text($source);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
Loading…
Reference in a new issue