mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 05:22:59 +00:00
Add action-raw module
This commit is contained in:
parent
81a479fc05
commit
cab6f9f414
3 changed files with 51 additions and 1 deletions
|
@ -639,7 +639,6 @@ class page_renderer
|
|||
}
|
||||
|
||||
$result = self::$html_template;
|
||||
// $result = str_replace("{body}", $parts["{body}"], $result);
|
||||
|
||||
$result = str_replace(array_keys($parts), array_values($parts), $result);
|
||||
|
||||
|
@ -832,6 +831,28 @@ register_module([
|
|||
|
||||
|
||||
|
||||
register_module([
|
||||
"name" => "Raw page source",
|
||||
"version" => "0.2",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Adds a 'raw' action that shows you the raw source of a page.",
|
||||
"id" => "action-raw",
|
||||
"code" => function() {
|
||||
add_action("raw", function() {
|
||||
global $page;
|
||||
|
||||
http_response_code(307);
|
||||
header("x-filename: " . rawurlencode($page) . ".md");
|
||||
header("content-type: text/markdown");
|
||||
exit(file_get_contents("$page.md"));
|
||||
exit();
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
register_module([
|
||||
"name" => "Sidebar",
|
||||
"version" => "0.2",
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
"id": "action-hash",
|
||||
"lastupdate": 1432497591
|
||||
},
|
||||
{
|
||||
"name": "Raw page source",
|
||||
"version": "0.2",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds a 'raw' action that shows you the raw source of a page.",
|
||||
"id": "action-raw",
|
||||
"lastupdate": 1442855075
|
||||
},
|
||||
{
|
||||
"name": "Sidebar",
|
||||
"version": "0.2",
|
||||
|
|
21
modules/action-raw.php
Normal file
21
modules/action-raw.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Raw page source",
|
||||
"version" => "0.2",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Adds a 'raw' action that shows you the raw source of a page.",
|
||||
"id" => "action-raw",
|
||||
"code" => function() {
|
||||
add_action("raw", function() {
|
||||
global $page;
|
||||
|
||||
http_response_code(307);
|
||||
header("x-filename: " . rawurlencode($page) . ".md");
|
||||
header("content-type: text/markdown");
|
||||
exit(file_get_contents("$page.md"));
|
||||
exit();
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
?>
|
Loading…
Reference in a new issue