mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
History Clean Up
This commit is contained in:
commit
8cf912993d
112 files changed
+11395
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
class Route{
|
||||
private $urls = [];
|
||||
private $views = [];
|
||||
|
||||
function __construct() {
|
||||
// code...
|
||||
}
|
||||
|
||||
function add($url, $view = "", $conrol = "") {
|
||||
$this->urls[] = '/'.trim($url, '/');
|
||||
if (!empty($view)) {
|
||||
$this->views[] = $view;
|
||||
}
|
||||
}
|
||||
|
||||
function submit(){
|
||||
$urlGetParam = isset($_GET['url']) ? '/' . $_GET['url'] : '/';
|
||||
foreach ($this->urls as $urlKey => $urlValue) {
|
||||
if ($urlValue === $urlGetParam) {
|
||||
$useView = $this->views[$urlKey];
|
||||
new $useView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user