public static function run() { require_once 'Database.php'; require_once 'Route.php'; require_once 'Load.php'; require_once 'Engine.php'; DB::init('localhost', 'icourse', 'root', ''); Route::init(); Load::$path = OBJ_ROOT . Route::$class . '.php'; Load::init(); foreach ($_REQUEST as $key => $val) { Engine::$oil[$key] = $val; } Engine::$class = Route::$class; Engine::$function = Route::$function; Engine::init(); }
class Load { public static function init() { if (isset($_COOKIE["PHPSESSID"]) && !empty($_COOKIE["PHPSESSID"])) { if (file_exists("../helpers/_getUserInfo.php")) { include_once "../helpers/_getUserInfo.php"; User_get::info(); } } $exception = new Exception(); switch (_MODE_) { case "local": ob_start(); ini_set('display_errors', 1); error_reporting(E_ALL); break; case "production": if (version_compare(PHP_VERSION, '5.4.0', '>=')) { ob_start(null, 0, PHP_OUTPUT_HANDLER_STDFLAGS ^ PHP_OUTPUT_HANDLER_REMOVABLE); } else { ob_start(null, 0, false); Logger::write("index.php; #8; ошибка ob_start PHP < 5.4"); } ini_set("memory_limit", "256M"); break; } } } Load::init();
<?php /* Plugin Name: rtRestaurants Plugin URI: http://rtcamp.com Description: Restaurat directory Version: 0.1 Author: vaishuagola27 Author URI: http://rtcamp.com License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html Domain Path: /languages Text Domain: rt-restaurants */ // Custom code starts here //namespace declaration namespace rtCamp\WP\rtRestaurants; //define constant for plugin directory path define('rtCamp\\WP\\rtRestaurants\\PATH', plugin_dir_path(__FILE__)); //define constant for plugin directory url define('rtCamp\\WP\\rtRestaurants\\URL', plugin_dir_url(__FILE__)); //include classes require_once \rtCamp\WP\rtRestaurants\PATH . 'includes/class-load.php'; require_once \rtCamp\WP\rtRestaurants\PATH . 'includes/class-theme.php'; require_once \rtCamp\WP\rtRestaurants\PATH . 'includes/class-admin.php'; require_once \rtCamp\WP\rtRestaurants\PATH . 'includes/class-review.php'; //instanciate class Load and call init() $load_data = new Load(); $load_data->init();