mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 16:33:00 +00:00
Rework templating engine a bit ready for the file previews
This commit is contained in:
parent
855e1f6d46
commit
4d37db9f3c
3 changed files with 17 additions and 21 deletions
|
@ -784,7 +784,12 @@ class page_renderer
|
||||||
|
|
||||||
"{all-pages-datalist}" => self::generate_all_pages_datalist(),
|
"{all-pages-datalist}" => self::generate_all_pages_datalist(),
|
||||||
|
|
||||||
"{footer-message}" => $settings->footer_message
|
"{footer-message}" => $settings->footer_message,
|
||||||
|
|
||||||
|
/// Secondary Parts ///
|
||||||
|
|
||||||
|
"{content}" => $content,
|
||||||
|
"{title}" => $title,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Pass the parts through the part processors
|
// Pass the parts through the part processors
|
||||||
|
@ -798,11 +803,8 @@ class page_renderer
|
||||||
$result = str_replace(array_keys($parts), array_values($parts), $result);
|
$result = str_replace(array_keys($parts), array_values($parts), $result);
|
||||||
|
|
||||||
$result = str_replace([
|
$result = str_replace([
|
||||||
"{title}",
|
|
||||||
"{content}"
|
|
||||||
], [
|
], [
|
||||||
$title,
|
|
||||||
$content
|
|
||||||
], $result);
|
], $result);
|
||||||
|
|
||||||
$result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result);
|
$result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result);
|
||||||
|
@ -1431,19 +1433,11 @@ register_module([
|
||||||
http_response_code(501);
|
http_response_code(501);
|
||||||
exit("Unrecognised file type.");
|
exit("Unrecognised file type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo render a preview here
|
|
||||||
|
|
||||||
/*
|
|
||||||
* size (image outputs only, possibly width / height)
|
|
||||||
* 1-2048 (configurable)
|
|
||||||
* filetype
|
|
||||||
* either a mime type or 'native'
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
page_renderer::register_part_preprocessor(function(&$parts) {
|
page_renderer::register_part_preprocessor(function(&$parts) {
|
||||||
// Todo add the preview to the top of the page here, but onyl if the current action is view and we are on a page prefixed with file:
|
// Todo add the preview to the top of the page here, but onyl if the current action is view and we are on a page prefixed with file:
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
12
core.php
12
core.php
|
@ -490,7 +490,12 @@ class page_renderer
|
||||||
|
|
||||||
"{all-pages-datalist}" => self::generate_all_pages_datalist(),
|
"{all-pages-datalist}" => self::generate_all_pages_datalist(),
|
||||||
|
|
||||||
"{footer-message}" => $settings->footer_message
|
"{footer-message}" => $settings->footer_message,
|
||||||
|
|
||||||
|
/// Secondary Parts ///
|
||||||
|
|
||||||
|
"{content}" => $content,
|
||||||
|
"{title}" => $title,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Pass the parts through the part processors
|
// Pass the parts through the part processors
|
||||||
|
@ -504,11 +509,8 @@ class page_renderer
|
||||||
$result = str_replace(array_keys($parts), array_values($parts), $result);
|
$result = str_replace(array_keys($parts), array_values($parts), $result);
|
||||||
|
|
||||||
$result = str_replace([
|
$result = str_replace([
|
||||||
"{title}",
|
|
||||||
"{content}"
|
|
||||||
], [
|
], [
|
||||||
$title,
|
|
||||||
$content
|
|
||||||
], $result);
|
], $result);
|
||||||
|
|
||||||
$result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result);
|
$result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result);
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File:' prefix.",
|
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File:' prefix.",
|
||||||
"id": "feature-upload",
|
"id": "feature-upload",
|
||||||
"lastupdate": 1445677429,
|
"lastupdate": 1445677720,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue