0
class midcom_core_midcom
0
- public $authentication;
0
- public $authorization;
0
+ // Services that are always available
0
public $componentloader;
0
public function __construct($dispatcher = 'midgard')
0
// Register autoloader so we get all MidCOM classes loaded automatically
0
@@ -59,19 +53,7 @@ class midcom_core_midcom
0
require_once 'Benchmark/Timer.php';
0
$this->timer = new Benchmark_Timer(true);
0
- // Load the preferred authentication implementation
0
- $services_authentication_implementation = $this->configuration->get('services_authentication');
0
- $this->authentication = new $services_authentication_implementation();
0
- // Load the preferred authorization implementation
0
- $services_authorization_implementation = $this->configuration->get('services_authorization');
0
- $this->authorization = new $services_authorization_implementation();
0
- // Load the preferred templating implementation
0
- $services_templating_implementation = $this->configuration->get('services_templating');
0
- $this->templating = new $services_templating_implementation();
0
// Load the component loader
0
$this->componentloader = new midcom_core_component_loader();
0
@@ -79,14 +61,7 @@ class midcom_core_midcom
0
$this->context = new midcom_core_helpers_context();
0
//Load the service loader
0
- $this->serviceloader = new midcom_core_services_loader();
0
- // Load the navigation helper
0
- //$this->navigation = new midcom_core_helpers_navigation();
0
- // Load the localization
0
- $services_l10n_implementation = $this->configuration->get('services_l10n');
0
- $this->l10n = new $services_l10n_implementation();
0
+ //$this->serviceloader = new midcom_core_services_loader();
0
// Load the head helper
0
$this->head = new midcom_core_helpers_head
0
@@ -98,6 +73,48 @@ class midcom_core_midcom
0
+ * Helper for service initialization. Usually called via getters
0
+ * @param string $service Name of service to load
0
+ private function load_service($service)
0
+ if (isset($this->$service))
0
+ $interface_file = MIDCOM_ROOT . "/midcom_core/services/{$service}.php";
0
+ if (!file_exists($interface_file))
0
+ throw new Exception("Service {$service} not installed");
0
+ if (!class_exists("midcom_core_services_{$service}"))
0
+ //echo "midcom_core_services_{$name}\n<br />";
0
+ //include($interface_file);
0
+ $service_implementation = $_MIDCOM->configuration->get("services_{$service}");
0
+ if (!$service_implementation)
0
+ throw new Exception("No implementation defined for service {$service}");
0
+ $this->$service = new $service_implementation();
0
+ * Magic getter for service loading
0
+ public function __get($key)
0
+ $this->load_service($key);
0
* Automatically load missing class files
0
* @param string $class_name Name of a missing PHP class
Comments
No one has commented yet.