[xoops-cvslog 1219] CVS update: xoops2jp/html/kernel

Back to archive index

Minahito minah****@users*****
2005年 11月 26日 (土) 16:07:12 JST


Index: xoops2jp/html/kernel/XCube_Root.class.php
diff -u xoops2jp/html/kernel/XCube_Root.class.php:1.1.2.1 xoops2jp/html/kernel/XCube_Root.class.php:1.1.2.2
--- xoops2jp/html/kernel/XCube_Root.class.php:1.1.2.1	Thu Nov 24 18:28:52 2005
+++ xoops2jp/html/kernel/XCube_Root.class.php	Sat Nov 26 16:07:11 2005
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @version $Id: XCube_Root.class.php,v 1.1.2.2 2005/11/26 07:07:11 minahito Exp $
+ * @package Cube
+ */
 
 /**
  * This class offers the access course same as global variable for a logic in old mechanism.
@@ -28,21 +32,22 @@
 	
 	var $mServiceManager=null;
 
-	var $mRenderSystem;
+	var $mRenderSystem=null;
 	
-	var $mSiteConfig;
+	var $mSiteConfig=array();
 	
 	/**
-	 * NOTICE: written by minahito
-	 * I append this property for that legacy modules test comment feature.
-	 * And this property violates the naming rule. I have not appended the
-	 * access method for this.
+	 * THIS IS TEST
+	 * 
+	 * Why this is public is that PHP4 does not give property overload to us.
+	 * This naming rule is test, too.
+	 * 
+	 * @access public
 	 */
-	var $ContentManager;
+	var $ContentManager=null;
 	
 	function XCube_Root()
 	{
-		$this->mController=null;
 	}
 
 	/**
@@ -57,11 +62,53 @@
 		return $instance;
 	}
 
+	/**
+	 * Load SiteConfig from plural files, and control set and override site config.
+	 */
+	function loadSiteConfig()
+	{
+		if(func_num_args()==0)
+			die("FETAL: You doesn't have site setting config.");
+
+		$file=func_get_arg(0);
+		if(!file_exists($file))
+			die("FETAL: You cann't open site setting config.");
+		
+		$this->setSiteConfig(parse_ini_file($file,true));
+
+		//
+		// Override setting.
+		//
+		if(func_num_args()>1) {
+			for($i=1;$i<func_num_args();$i++) {
+				$overrideFile=func_get_arg($i);
+				
+				if(file_exists($overrideFile))
+					$this->overrideSiteConfig(parase_ini_file($overrideFile));
+			}
+		}
+	}
+	
 	function setSiteConfig($config)
 	{
 		$this->mSiteConfig=$config;
 	}
 	
+	/**
+	 * Override site config. SiteConfig is overrided by $config value. And, if $config has new key, the key is set.
+	 */
+	function overrideSiteConfig($config)
+	{
+		foreach($config as $_overKey=>$_overVal) {
+			if(array_key_exists($_overKey,$this->mSiteConfig)) {
+				$this->mSiteConfig[$_overKey]=array_merge($this->mSiteConfig[$_overKey],$customVal);
+			}
+			else {
+				$this->mSiteConfig[$_overKey]=$_overVal;
+			}
+		}
+	}
+
 	function getSiteConfig()
 	{
 		//
@@ -82,6 +129,19 @@
 		return null;
 	}
 
+	/**
+	 * Create controller with own site setting.
+	 */
+	function setupController()
+	{
+		//
+		// [NOTICE]
+		// We don't decide the style of SiteConfig.
+		//
+		print_r($this->mSiteConfig);
+		$this->mController=&$this->createController($this->mSiteConfig['Cube']['Controller.class'],$this->mSiteConfig['Cube']['Controller.path']);
+	}
+
 	function &createController($className='XCube_Controller',$classpath=null)
 	{
 		if(!$this->mController) {


xoops-cvslog メーリングリストの案内
Back to archive index