Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * SourceChat - 2014
- * Copyright (C) 2014 Necmi Hasan
- *
- * @author Necmi Hasan necmi.hasan@outlook.com
- * @copyright 2014, Necmi Hasan
- * @license General Public License
- * @link -
- * @package BootstrapClass
- * @date 26.07.2014
- * */
- class Bootstrap {
- public function __construct($route) {
- if(!is_null($route)) {
- $url = rtrim($route, '/');
- $url = explode('/', $url);
- $className = ucfirst($url[0]).'Controller';
- if(file_exists(PHP_PATH.'controllers/'.ucfirst($url[0]).'Controller.php')) {
- require PHP_PATH.'controllers/'.ucfirst($url[0]).'Controller.php';
- } else {
- require PHP_PATH.'controllers/ErrorController.php';
- new ErrorController();
- }
- $classDefined = new $className;
- $methodParams = 1;
- $methodStand = $className;
- $pageParameters = array();
- if(isset($url[1])) {
- if(method_exists($classDefined, $url[1])) {
- $methodStand = $url[1];
- $methodParams = 2;
- }
- }
- $classDefined->$methodStand($pageParameters);
- } else {
- require PHP_PATH.'controllers/IndexController.php';
- $test = new IndexController();
- }
- }
- }
- $page = null;
- if(isset($_GET['page'])) {
- $page = $_GET['page'];
- }
- new Bootstrap($page);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement