/** * 初始化 * * @return void */ public static function init($config = array()) { if (function_exists('spl_autoload_register')) { include_once 'load.php'; spl_autoload_register(array('core_load', 'autoLoad')); } $coreConfig = (include_once CORE_DIR . '/config.php'); self::$config = array_merge($coreConfig, $config); self::$router = self::$config['router_rules']; /* settings */ ini_set('memory_limit', self::$config['core_memory_limit']); error_reporting(E_ALL ^ E_NOTICE); date_default_timezone_set(self::$config['core_timezone']); set_exception_handler(array('core_handler', 'exception')); self::setBoot(); }
function init() { //echo "router<br />"; system::$core = parent::init(); core::$router = $this; $this->setPath(CTRL_PATH); try { $this->delegate(); } catch (Exception $e) { switch ($e->getCode()) { case 404: system::redirect("http://" . system::param("siteDomain") . "/search?text=" . urlencode($this->routePath), 5, "Упс! Такого документа на этом сайте нет. Сейчас мы попробуем поискать что-то похожее."); $this->smarty->setCacheID("REDIRECT|404"); $this->display(); break; default: } } $this->handleMails(); $this->smarty->assign("errors", system::$errors); }
<?php /** * Vérification de la version de PHP */ if (version_compare(PHP_VERSION, '5.4.0', '<')) { die('PHP 5.4+ requis !'); } /** * Initialisation de ZwiiCMS */ require 'core/core.php'; $core = new core(); spl_autoload_register('core::autoload'); $core->router(); echo $core->cache();