1. Matthew Tretter
  2. codeigniter-modular-extensions-hmvc

Commits

wiredesignz  committed 70d25e6

Add new features allowing modular separation to run on the same code base.

  • Participants
  • Parent commits 4e36410
  • Branches default

Comments (0)

Files changed (4)

File third_party/MX/Base.php

View file
 		parent::__construct();
 		
 		/* assign the application instance */
-		self::$APP = $this;
+		self::$APP = CI_Base::get_instance();
 		
 		/* assign the core classes */
 		$classes = (CI_VERSION < 2) ? array(

File third_party/MX/CI.php

View file
+<?php (defined('BASEPATH')) OR exit('No direct script access allowed');
+
+/* load MX core classes */
+require_once 'Lang.php';
+require_once 'Config.php';
+
+class CI
+{
+	public static $APP;
+	
+	public function __construct() {
+		self::$APP = CI_Base::get_instance();
+		
+		/* re-assign language and config for modules */
+		if ( ! is_a(self::$APP->lang, 'MX_Lang')) self::$APP->lang = new MX_Lang;
+		if ( ! is_a(self::$APP->config, 'MX_Config')) self::$APP->config = new MX_Config;
+		
+		self::$APP->load = new MX_Loader;
+		self::$APP->load->_init();
+	}
+}
+
+new CI;

File third_party/MX/Loader.php

View file
 <?php (defined('BASEPATH')) OR exit('No direct script access allowed');
 
+(class_exists('CI', FALSE)) OR require 'CI.php';
+
 /**
  * Modular Extensions - HMVC
  *

File third_party/MX/Modules.php

View file
 		/* don't autoload CI_ or MY_ prefixed classes */
 		if (strstr($class, 'CI_') OR strstr($class, 'MY_')) return;
 		
-		$class = ltrim($class, 'MX_');
-		if(is_file($location = APPPATH.'third_party/MX/'.$class.EXT)) {
+		if(is_file($location = APPPATH.'libraries/'.$class.EXT)) {
 			include_once $location;
 		}		
 	}