Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Класс оброботки страниц
- *
- * @author AZA
- */
- class Page_Bulder {
- /* Массив найденых модулей */
- private $module = [];
- /* Путь к модулям */
- private $path = 'include/module/';
- function __construct($url) {
- if (isset($url)) {
- $dir = new DirectoryIterator($this->path);
- foreach ($dir as $fileinfo) {
- if ($fileinfo->isFile()) {
- array_push($this->module, $fileinfo->getBasename('.php'));
- }
- }
- if (in_array($url, $this->module)) {
- include $this->path . $url . '.php';
- } else {
- include 'include/module/error.php';
- }
- } else {
- $home = explode("/", filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
- if ($home[2] == 'index.php' || $home[2] == '' || isset($home[2])) {
- include 'include/module/index.php';
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment