1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-26 05:32:59 +00:00

Add contentonly query parameter. Implements #55.

This commit is contained in:
Starbeamrainbowlabs 2016-03-21 15:37:31 +00:00
parent 0944484525
commit 34cc498e0f
3 changed files with 13 additions and 5 deletions

View file

@ -3710,9 +3710,13 @@ register_module([
$content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n"; $content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n";
// Content only mode: Sends only the raw rendered page
if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes")
exit(parse_page_source($content));
// Printable: Sends a printable version of the page
if(isset($_GET["printable"]) and $_GET["printable"] === "yes") if(isset($_GET["printable"]) and $_GET["printable"] === "yes")
exit(page_renderer::render_minimal($title, $content)); exit(page_renderer::render_minimal($title, $content));
else // Normal page
exit(page_renderer::render_main($title, $content)); exit(page_renderer::render_main($title, $content));
}); });
} }

View file

@ -176,7 +176,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You reallyshould include this one.", "description": "Allows you to view pages. You reallyshould include this one.",
"id": "page-view", "id": "page-view",
"lastupdate": 1451134217, "lastupdate": 1458574289,
"optional": false "optional": false
}, },
{ {

View file

@ -102,9 +102,13 @@ register_module([
$content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n"; $content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n";
// Content only mode: Sends only the raw rendered page
if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes")
exit(parse_page_source($content));
// Printable: Sends a printable version of the page
if(isset($_GET["printable"]) and $_GET["printable"] === "yes") if(isset($_GET["printable"]) and $_GET["printable"] === "yes")
exit(page_renderer::render_minimal($title, $content)); exit(page_renderer::render_minimal($title, $content));
else // Normal page
exit(page_renderer::render_main($title, $content)); exit(page_renderer::render_main($title, $content));
}); });
} }