From 8e10d770c74acdbb5795e8fc73fd220b900d75aa Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Fri, 17 Jan 2020 19:14:36 +0100 Subject: new feature : sleep time per page --- app/class/Controllerpage.php | 1 + app/class/Page.php | 16 ++++++++++++++++ app/view/templates/editleftbar.php | 9 ++++++++- app/view/templates/homemenu.php | 5 +++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php index 1eb4a3d..75ac6cf 100644 --- a/app/class/Controllerpage.php +++ b/app/class/Controllerpage.php @@ -156,6 +156,7 @@ class Controllerpage extends Controller $filedir = Model::HTML_RENDER_DIR . $id . '.html'; if(file_exists($filedir)) { $html = file_get_contents($filedir); + sleep($this->page->sleep()); echo $html; } else { echo 'Please render this page'; diff --git a/app/class/Page.php b/app/class/Page.php index 41cf0ab..170a057 100644 --- a/app/class/Page.php +++ b/app/class/Page.php @@ -43,6 +43,7 @@ class Page protected $visitcount; protected $editcount; protected $editby; + protected $sleep; const LEN = 255; @@ -112,6 +113,7 @@ class Page $this->setvisitcount(0); $this->seteditcount(0); $this->seteditby([]); + $this->setsleep(0); } public static function classvarlist() @@ -454,6 +456,11 @@ class Page return $this->editby; } + public function sleep($type = 'int') + { + return $this->sleep; + } + @@ -819,6 +826,15 @@ class Page return count($this->editby) > 0; } + public function setsleep($sleep) + { + $sleep = abs(intval($sleep)); + if($sleep > 180) { + $sleep = 180; + } + $this->sleep = $sleep; + } + /** * Merge new tag with actual tags * diff --git a/app/view/templates/editleftbar.php b/app/view/templates/editleftbar.php index c901c14..8302090 100644 --- a/app/view/templates/editleftbar.php +++ b/app/view/templates/editleftbar.php @@ -152,7 +152,11 @@ -
externalcss()) || !empty($page->customhead()) ? 'open' : '' ?>> + + + + +
externalcss()) || !empty($page->customhead()) || !empty($page->sleep()) ? 'open' : '' ?>> Advanced @@ -176,6 +180,9 @@ + + +
diff --git a/app/view/templates/homemenu.php b/app/view/templates/homemenu.php index 21f9af8..8431e50 100644 --- a/app/view/templates/homemenu.php +++ b/app/view/templates/homemenu.php @@ -124,6 +124,11 @@ ?>
+ Advanced +
+ + +
Author