Guest User

Untitled

a guest
Oct 28th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Класс оброботки страниц
  4.  *
  5.  * @author AZA
  6.  */
  7. class Page_Bulder {
  8.    
  9.    
  10.     /* Массив найденых модулей */
  11.     private $module = [];
  12.     /* Путь к модулям */
  13.     private $path = 'include/module/';
  14.  
  15.     function __construct($url) {
  16.         if (isset($url)) {
  17.             $dir = new DirectoryIterator($this->path);
  18.             foreach ($dir as $fileinfo) {
  19.                 if ($fileinfo->isFile()) {
  20.                     array_push($this->module, $fileinfo->getBasename('.php'));
  21.                 }
  22.             }
  23.             if (in_array($url, $this->module)) {
  24.                 include $this->path . $url . '.php';
  25.             } else {
  26.                 include 'include/module/error.php';
  27.             }
  28.         } else {
  29.             $home = explode("/", filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
  30.             if ($home[2] == 'index.php' || $home[2] == '' || isset($home[2])) {
  31.                 include 'include/module/index.php';
  32.             }
  33.         }
  34.     }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment