Removed FUZEPATH and FUZESYSPATH since it actually is pretty stupid
This commit is contained in:
parent
881dcb0ae5
commit
630e207efc
@ -41,7 +41,7 @@ class Config extends Bus{
|
||||
* @return StdObject of config
|
||||
*/
|
||||
public function loadConfigFile($name, $directory = null) {
|
||||
$dir = (isset($directory) ? $directory : FUZEPATH . "Application//config/");
|
||||
$dir = (isset($directory) ? $directory : "Application/config/");
|
||||
$file = $dir . 'config.' . strtolower($name).".php";
|
||||
|
||||
if (file_exists($file)) {
|
||||
@ -88,7 +88,7 @@ class Config extends Bus{
|
||||
* @param String directory, default is Application/Config
|
||||
*/
|
||||
public function set($name, $key, $value, $directory = null) {
|
||||
$dir = (isset($directory) ? $directory : FUZEPATH . "Application//config/");
|
||||
$dir = (isset($directory) ? $directory : "Application/config/");
|
||||
$file = $dir . 'config.' . strtolower($name).".php";
|
||||
if (file_exists($file)) {
|
||||
$DECODED = require($file);
|
||||
|
@ -4,11 +4,6 @@ namespace FuzeWorks;
|
||||
use \stdClass;
|
||||
use \Exception;
|
||||
|
||||
if (!defined('FUZESYSPATH')) {
|
||||
define('STARTTIME', microtime(true));
|
||||
define( 'FUZESYSPATH', dirname(__FILE__) . '/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* FuzeWorks Core
|
||||
*
|
||||
@ -29,6 +24,9 @@ class Core {
|
||||
|
||||
## START/STOP
|
||||
public function init() {
|
||||
if (!defined('STARTTIME')) {
|
||||
define('STARTTIME', microtime(true));
|
||||
}
|
||||
// Load basics
|
||||
ignore_user_abort(true);
|
||||
register_shutdown_function(array($this, "shutdown"));
|
||||
@ -51,19 +49,19 @@ class Core {
|
||||
return;
|
||||
|
||||
// Load core abstracts
|
||||
require_once(FUZESYSPATH . "/class.abstract.bus.php");
|
||||
require_once(FUZESYSPATH . "/class.abstract.event.php");
|
||||
require_once(FUZESYSPATH . "/class.abstract.module.php");
|
||||
require_once(FUZESYSPATH . "/class.abstract.model.php");
|
||||
require_once(FUZESYSPATH . "/class.abstract.controller.php");
|
||||
require_once(FUZESYSPATH . "/class.abstract.eventPriority.php");
|
||||
require_once("Core/System/class.abstract.bus.php");
|
||||
require_once("Core/System/class.abstract.event.php");
|
||||
require_once("Core/System/class.abstract.module.php");
|
||||
require_once("Core/System/class.abstract.model.php");
|
||||
require_once("Core/System/class.abstract.controller.php");
|
||||
require_once("Core/System/class.abstract.eventPriority.php");
|
||||
|
||||
// Load the core classes
|
||||
require_once(FUZESYSPATH . "/class.config.php");
|
||||
require_once(FUZESYSPATH . "/class.logger.php");
|
||||
require_once(FUZESYSPATH . "/class.models.php");
|
||||
require_once(FUZESYSPATH . "/class.layout.php");
|
||||
require_once(FUZESYSPATH . "/class.events.php");
|
||||
require_once("Core/System/class.config.php");
|
||||
require_once("Core/System/class.logger.php");
|
||||
require_once("Core/System/class.models.php");
|
||||
require_once("Core/System/class.layout.php");
|
||||
require_once("Core/System/class.events.php");
|
||||
|
||||
// Load them
|
||||
$this->mods->events = new Events ($this);
|
||||
@ -81,7 +79,7 @@ class Core {
|
||||
|
||||
public function loadMod($name) {
|
||||
// Where the modules are
|
||||
$path = FUZEPATH . "Modules/";
|
||||
$path = "Modules/";
|
||||
|
||||
// Check if the requested module is registered
|
||||
if (isset($this->register[$name])) {
|
||||
@ -164,7 +162,7 @@ class Core {
|
||||
$this->mods->logger->newLevel("Loading Module Headers", 'Core');
|
||||
|
||||
// Get all the module directories
|
||||
$dir = FUZEPATH . "Modules/";
|
||||
$dir = "Modules/";
|
||||
$mod_dirs = array();
|
||||
$mod_dirs = array_values(array_diff(scandir($dir), array('..', '.')));
|
||||
|
||||
|
@ -87,7 +87,7 @@ class Events extends Bus{
|
||||
$eventName = $input;
|
||||
if(!class_exists($eventClass)){
|
||||
// Check if the file even exists
|
||||
$file = FUZEPATH . "/Core/Events/event.".$eventName.".php";
|
||||
$file = "Core/Events/event.".$eventName.".php";
|
||||
if(file_exists($file)){
|
||||
// Load the file
|
||||
require_once($file);
|
||||
|
@ -23,7 +23,7 @@ class Layout extends Bus {
|
||||
|
||||
private function load() {
|
||||
// Load Smarty
|
||||
$smartyDir = FUZEPATH . "/Core/System/Smarty";
|
||||
$smartyDir = "Core/System/Smarty";
|
||||
|
||||
if (!defined('SMARTY_DIR')) {
|
||||
define('SMARTY_DIR', $smartyDir . DIRECTORY_SEPARATOR . "libs" . DIRECTORY_SEPARATOR);
|
||||
@ -40,8 +40,8 @@ class Layout extends Bus {
|
||||
}
|
||||
|
||||
public function getSmartyBasicVars($Smarty) {
|
||||
$Smarty->setCompileDir(FUZEPATH . "/Core/Cache/Compile");
|
||||
$Smarty->setCacheDir(FUZEPATH . "/Core/Cache/");
|
||||
$Smarty->setCompileDir("Core/Cache/Compile");
|
||||
$Smarty->setCacheDir("Core/Cache/");
|
||||
$Smarty->assign('siteURL', $this->config->main->SITE_URL);
|
||||
$Smarty->assign('serverName', $this->config->main->SERVER_NAME);
|
||||
$Smarty->assign('siteDomain', $this->config->main->SITE_DOMAIN);
|
||||
@ -89,7 +89,7 @@ class Layout extends Bus {
|
||||
$this->load();
|
||||
|
||||
$event = $this->events->fireEvent('layoutLoadEvent', $view);
|
||||
$directory = ($event->directory === null ? FUZEPATH . "/Application/Views" : $event->directory);
|
||||
$directory = ($event->directory === null ? "Application/Views" : $event->directory);
|
||||
$view = ($event->layout === null ? $view : $event->layout);
|
||||
|
||||
// Set the file name and location
|
||||
@ -119,14 +119,8 @@ class Layout extends Bus {
|
||||
$this->Smarty['main']->assign('title', $this->title);
|
||||
|
||||
// Get the viewdir
|
||||
// @TODO: Fix this for custom directories
|
||||
$one = FUZEPATH;
|
||||
$two = $directory . "/";
|
||||
$count_one = strlen($one);
|
||||
$count_two = strlen($two);
|
||||
$length_three = $count_two - $count_one;
|
||||
$three = $this->config->main->SITE_URL . "/" . substr($two, -$length_three);
|
||||
$this->layout->assign('viewDir', $three);
|
||||
$viewDir = $this->config->main->SITE_URL . "/" . substr($directory . "/", -strlen($directory . "/"));
|
||||
$this->layout->assign('viewDir', $viewDir);
|
||||
|
||||
try{
|
||||
|
||||
@ -147,20 +141,16 @@ class Layout extends Bus {
|
||||
$this->load();
|
||||
|
||||
// Set the directory
|
||||
$directory = ($directory == "" ? FUZEPATH . "/Application/" . '/Views' : $directory);
|
||||
$directory = ($directory == "" ? "Application/" . '/Views' : $directory);
|
||||
$this->Smarty['main']->setTemplateDir($directory);
|
||||
|
||||
// Set the title
|
||||
$this->Smarty['main']->assign('title', $this->title);
|
||||
|
||||
// Get the viewdir
|
||||
$one = FUZEPATH;
|
||||
$two = $directory . "/";
|
||||
$count_one = strlen($one);
|
||||
$count_two = strlen($two);
|
||||
$length_three = $count_two - $count_one;
|
||||
$three = $this->config->main->SITE_URL . "/" . substr($two, -$length_three);
|
||||
$this->layout->assign('viewdir', $three);
|
||||
$viewDir = $this->config->main->SITE_URL . "/" . substr($directory . "/", -strlen($directory . "/"));
|
||||
$this->layout->assign('viewDir', $viewDir);
|
||||
|
||||
try{
|
||||
|
||||
// Load the page
|
||||
|
@ -24,7 +24,7 @@ class Models extends Bus{
|
||||
public function loadModel($name, $directory = null){
|
||||
// Model load event
|
||||
$event = $this->events->fireEvent('modelLoadEvent', $name);
|
||||
$directory = ($event->directory === null ? FUZEPATH . "/Application/Models" : $event->directory);
|
||||
$directory = ($event->directory === null ? "Application/Models" : $event->directory);
|
||||
$name = ($event->model === null ? $name : $event->model);
|
||||
|
||||
$file = $directory.'/model.'.$name.'.php';
|
||||
@ -38,7 +38,7 @@ class Models extends Bus{
|
||||
$this->models_array[$name] = new $model($this->core);
|
||||
} else{
|
||||
$this->logger->logWarning('The requested model: \''.$name.'\' could not be found. Loading empty model', 'Models');
|
||||
require_once(FUZEPATH . "/Core/System/Models/model.interpret.php");
|
||||
require_once("Core/System/Models/model.interpret.php");
|
||||
$this->logger->logInfo('Loading Model: interprated databasemodel', 'Models');
|
||||
$model = new Interpret($this->core);
|
||||
$model->table($name);
|
||||
|
@ -92,7 +92,7 @@ class Router extends Module {
|
||||
$this->controllerName = ($event->controller === null || empty($event->controller) ? $this->config->main->default_controller : $event->controller);
|
||||
$this->function = ($event->function === null || empty($event->function) ? $this->config->main->default_function : $event->function);
|
||||
$this->parameters = $event->parameters;
|
||||
$this->directory = ($event->directory === null || empty($event->directory) ? FUZEPATH . "/Application/Controller/" : $event->directory);
|
||||
$this->directory = ($event->directory === null || empty($event->directory) ? "Application/Controller/" : $event->directory);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,9 +136,9 @@ class Main extends Module {
|
||||
'name' => $name,
|
||||
'module_section' => $module_section,
|
||||
'module_name' => $module_name,
|
||||
'controller_path' => FUZEPATH . $controller_path,
|
||||
'model_path' => FUZEPATH . $model_path,
|
||||
'view_path' => FUZEPATH . $view_path,
|
||||
'controller_path' => $controller_path,
|
||||
'model_path' => $model_path,
|
||||
'view_path' => $view_path,
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user