2015-09-21 17:04:51 +00:00
|
|
|
<?php
|
|
|
|
register_module([
|
|
|
|
"name" => "Raw page source",
|
2015-11-08 21:15:08 +00:00
|
|
|
"version" => "0.4",
|
2015-09-21 17:04:51 +00:00
|
|
|
"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() {
|
2015-09-22 13:34:18 +00:00
|
|
|
global $env;
|
2015-11-08 21:15:08 +00:00
|
|
|
|
2015-09-21 17:04:51 +00:00
|
|
|
http_response_code(307);
|
2015-09-22 13:34:18 +00:00
|
|
|
header("x-filename: " . rawurlencode($env->page) . ".md");
|
2015-09-21 17:04:51 +00:00
|
|
|
header("content-type: text/markdown");
|
2015-11-08 21:15:08 +00:00
|
|
|
exit(file_get_contents("$env->storage_prefix$env->page.md"));
|
2015-09-21 17:04:51 +00:00
|
|
|
exit();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
?>
|