- Moved spl_autoload_register from application/config/config.php to application/config/core_includes.php

- application/config/core_includes.php is included by index.ci.php
- Renamed the prefix of the helpers from "fhc_" to "hlp_"
- Adapted the helpers includes
This commit is contained in:
Paolo
2018-07-18 12:04:00 +02:00
parent 5635f1792c
commit bb52aee900
17 changed files with 27 additions and 25 deletions
-13
View File
@@ -502,16 +502,3 @@ $config['rewrite_short_tags'] = FALSE;
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
/*
|--------------------------------------------------------------------------
| Autoload Custom Controllers
|--------------------------------------------------------------------------
|
| It's working, so don't delete this :D
*/
spl_autoload_register(function ($class) {
if (substr($class,0,3) !== 'CI_' && substr($class,0,4) !== 'FHC_')
if (file_exists($file = APPPATH . 'core/' . $class . '.php'))
require_once $file;
});
+12
View File
@@ -0,0 +1,12 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Autoload custom controllers, models, etc that are present in the application/core directory
*/
spl_autoload_register(function ($class) {
if (substr($class, 0, 3) !== 'CI_' && substr($class, 0, 4) !== 'FHC_')
if (file_exists($file = APPPATH.'core/'.$class.'.php'))
require_once $file;
});
+1 -1
View File
@@ -14,7 +14,7 @@ class Test extends REST_Controller
parent::__construct();
// Loads helper message to manage returning messages
$this->load->helper('fhc_message');
$this->load->helper('hlp_message');
}
/**
+1 -1
View File
@@ -44,7 +44,7 @@ class AmpelMail extends FHC_Controller
$this->load->model('person/Person_model', 'PersonModel');
// Load helpers
$this->load->helper('fhc_sancho');
$this->load->helper('hlp_sancho');
}
/**
+2 -2
View File
@@ -12,10 +12,10 @@ class APIv1_Controller extends REST_Controller
parent::__construct();
// Loads helper message to manage returning messages
$this->load->helper('fhc_message');
$this->load->helper('hlp_message');
// Loads helper with generic utility function
$this->load->helper('fhc_common');
$this->load->helper('hlp_common');
// Loads permission lib
$this->load->library('PermissionLib');
+1 -1
View File
@@ -12,7 +12,7 @@ class Auth_Controller extends FHC_Controller
parent::__construct();
// Loads authentication helper
$this->load->helper('fhc_authentication');
$this->load->helper('hlp_authentication');
// Checks if the caller is allowed to access to this content
$this->_isAllowed($requiredPermissions);
+5 -5
View File
@@ -21,19 +21,19 @@ class FHC_Controller extends CI_Controller
$this->_controllerId = null; // set _controllerId as null by default
// Loads helper message to manage returning messages
$this->load->helper('fhc_message');
$this->load->helper('hlp_message');
// Loads helper with generic utility function
$this->load->helper('fhc_common');
$this->load->helper('hlp_common');
// Loads helper session to manage the php session
$this->load->helper('fhc_session');
$this->load->helper('hlp_session');
// Loads language helper
$this->load->helper('fhc_language');
$this->load->helper('hlp_language');
// Loads header helper
$this->load->helper('fhc_header');
$this->load->helper('hlp_header');
}
//------------------------------------------------------------------------------------------------------------------
+1 -1
View File
@@ -87,7 +87,7 @@ class FiltersLib
$this->_ci =& get_instance(); // get code igniter instance
// Loads authentication helper
$this->_ci->load->helper('fhc_authentication'); // NOTE: needed to load custom filters do not remove!
$this->_ci->load->helper('hlp_authentication'); // NOTE: needed to load custom filters do not remove!
$this->_filterUniqueId = $this->_getFilterUniqueId($params); // sets the id for the related filter widget
}
@@ -18,7 +18,7 @@ class MessageToken_model extends CI_Model
$this->config->load('message');
// Load return message helper
$this->load->helper('fhc_message');
$this->load->helper('hlp_message');
// Loads the database object
$this->load->database();
+3
View File
@@ -306,5 +306,8 @@ require_once 'config/vilesci.config.inc.php';
// ... and the vendor autoload
include_once 'vendor/autoload.php';
// Autoload custom controllers, models, etc that are present in the application/core directory
require_once 'application/config/core_includes.php';
// Now the bootstrap file
require_once BASEPATH.'core/CodeIgniter.php';