[xoops-cvslog 4008] CVS update: xoops2jp/html/class

Back to archive index

Minahito minah****@users*****
2006年 8月 7日 (月) 20:26:01 JST


Index: xoops2jp/html/class/XCube_Event.class.php
diff -u xoops2jp/html/class/XCube_Event.class.php:1.1.2.9 xoops2jp/html/class/XCube_Event.class.php:removed
--- xoops2jp/html/class/XCube_Event.class.php:1.1.2.9	Fri Jan 27 17:25:36 2006
+++ xoops2jp/html/class/XCube_Event.class.php	Mon Aug  7 20:26:01 2006
@@ -1,184 +0,0 @@
-<?php
-
-define("XCUBE_CALLBACK_TYPE_NONE",0);
-define("XCUBE_CALLBACK_TYPE_STATIC_METHOD",1);
-define("XCUBE_CALLBACK_TYPE_INSTANCE_METHOD",2);
-define("XCUBE_CALLBACK_TYPE_STATIC_FUNCTION",3);
-
-/** 
- * *An experiment class*
- * This class abstracts "function pointer".
- * These classes identifies the static method and the instance method and the global function.
- */
-class XCube_Delegate
-{
-	var $mType=XCUBE_CALLBACK_TYPE_NONE;
-	
-	var $mClassName=null;
-	var $mInstance=null;
-	var $mMethodName=null;
-	
-	function XCube_Delegate($major,$minor=null)
-	{
-		$this->_register($major,$minor);
-	}
-	
-	function _register($major,$minor=null)
-	{
-		if(is_string($major) && $minor===null) {
-			$this->mType=XCUBE_CALLBACK_TYPE_STATIC_FUNCTION;
-			$this->mMethodName=$major;
-		}
-		elseif(is_string($major) && is_string($minor)) {
-			$this->mType=XCUBE_CALLBACK_TYPE_STATIC_METHOD;
-			$this->mClassName=$major;
-			$this->mMethodName=$minor;
-		}
-	}
-}
-
-/**
- * *An experiment class*
- * This class abstracts the instance method.
- */
-class XCube_InstanceDelegate extends XCube_Delegate
-{
-	function XCube_InstanceDelegate(&$major,$minor)
-	{
-		$this->_register($major,$minor);
-	}
-
-	function _register(&$major,$minor)
-	{
-		if(is_object($major)&&is_string($minor)) {
-			$this->mType=XCUBE_CALLBACK_TYPE_INSTANCE_METHOD;
-			$this->mInstance=&$major;
-			$this->mMethodName=$minor;
-		}
-	}
-}
-
-/**
- * This class is a collector of Delegate object.
- * The registrant can use Array instead of Delegate instance for speed.
- */
-class XCube_Event
-{
-	var $mName;
-	var $_mDelegates=array();
-	
-	var $_mAnchorDelegate=array();
-	
-	function XCube_Event($name)
-	{
-		$this->mName=$name;
-	}
-
-	/**
-	 * @param $Delegate Delegate object or Array.
-	 */
-	function add(&$delegate)
-	{
-		$this->_mDelegates[]=&$delegate;
-	}
-	
-	function setAnchorDelegate(&$delegate)
-	{
-		$this->_mAnchorDelegate=&$delegate;
-	}
-	
-	function &getDelegates()
-	{
-		$this->_mDelegates;
-	}
-
-	function raiseEvent(&$sender,&$eventArgs)
-	{
-		if(count($this->_mDelegates)) {
-			for($i=0;$i<count($this->_mDelegates);$i++) {
-				$this->_callback($this->_mDelegates[$i],$sender,$eventArgs);
-			}
-		}
-
-		if($this->_mAnchorDelegate!=null)
-			$this->_callback($this->_mAnchorDelegate,$sender,$eventArgs);
-	}
-	
-	function _callback(&$delegate,&$sender,&$eventArgs)
-	{
-		if(is_object($delegate)) {
-			$this->_callbackDelegate($delegate,$sender,$eventArgs);
-		}
-		elseif(is_array($delegate)) {
-			$this->_callbackArray($delegate,$sender,$eventArgs);
-		}
-	}
-	
-	function _callbackDelegate(&$delegate,&$sender,&$eventArgs)
-	{
-		switch($delegate->mType) {
-			case XCUBE_CALLBACK_TYPE_STATIC_METHOD:
-//				if(method_exists($delegate->mClassName,$delegate->mMethodName)) {
-					// [PHP BUG] call_user_func can not reference parameter!!
-					// http://bugs.php.net/bug.php?id=17309
-					// http://bugs.php.net/bug.php?id=17246
-					// call_user_func(array($delegate->mClassName,$Delegate->mMethodName),$sender,$eventArgs);
-					$operation = $delegate->mClassName."::".$delegate->mMethodName.'($sender,$eventArgs);';
-					eval($operation);
-//				}
-				break;
-
-			case XCUBE_CALLBACK_TYPE_INSTANCE_METHOD:
-				if(method_exists($delegate->mInstance,$delegate->mMethodName)) {
-					// [PHP BUG]
-					// call_user_func(array($delegate->mInstance,$Delegate->mMethodName),$sender,$eventArgs);
-					$methodName=$delegate->mMethodName;
-					$delegate->mInstance->$methodName($sender,$eventArgs);
-				}
-				else {
-					//
-					// TODO raise NOTICE
-					//
-				}
-				break;
-			
-			case XCUBE_CALLBACK_TYPE_STATIC_FUNCTION:
-				if(function_exists($delegate->mMethodName)) {
-					// [PHP BUG]
-					// call_user_func($delegate->mMethodName,$sender,$eventArgs);
-					$operation = $delegate->mMethodName.'($sender,$eventArgs);';
-					eval($operation);
-				}
-				else {
-					//
-					// TODO raise NOTICE
-					//
-				}
-				break;
-		}
-	}
-
-	function _callbackArray(&$arr,&$sender,&$eventArgs)
-	{
-		if(isset($arr['class'])&&is_object($arr['class'])) {
-			// [PHP BUG]
-			// call_user_func(array($arr['class'],$arr['function']),$sender,$eventArgs);
-			$methodName=$arr['function'];
-			$arr['class']->$methodName($sender,$eventArgs);
-		}
-		elseif(isset($arr['class'])&&isset($arr['function'])) {
-			// [PHP BUG]
-			// call_user_func(array($arr['class'],$arr['function']),$sender,$eventArgs);
-			$operation = $arr['class']."::".$arr['function'].'($sender,$eventArgs);';
-			eval($operation);
-		}
-		elseif(isset($arr['function'])) {
-			// [PHP BUG]
-			// call_user_func($arr['function'],$sender,$eventArgs);
-			$operation = $arr['function'].'($sender,$eventArgs);';
-			eval($operation);
-		}
-	}
-}
-
-?>
\ No newline at end of file
Index: xoops2jp/html/class/XCube_EventManager.class.php
diff -u xoops2jp/html/class/XCube_EventManager.class.php:1.1.2.11 xoops2jp/html/class/XCube_EventManager.class.php:removed
--- xoops2jp/html/class/XCube_EventManager.class.php:1.1.2.11	Fri Apr 21 12:15:31 2006
+++ xoops2jp/html/class/XCube_EventManager.class.php	Mon Aug  7 20:26:01 2006
@@ -1,172 +0,0 @@
-<?php
-
-if (!defined('XOOPS_ROOT_PATH')) exit();
-
-require_once XOOPS_ROOT_PATH . "/class/XCube_Event.class.php";
-
-/**
- * This class manages plural events.
- * This class supports substitute registration for speedup.
- */
-class XCube_EventManager
-{
-	var $_mEvents=array();
-
-	var $_mReserveEventList=array();
-	var $_mRegistedFlags=array();
-	var $_mProxyRegisters=array();
-	
-	function XCube_EventManager()
-	{
-	}
-	
-	function prepare()
-	{
-	}
-	
-	function add($eventName,&$delegate)
-	{
-		if(!isset($this->_mEvents[$eventName]))
-			$this->_mEvents[$eventName] = new XCube_Event($eventName);
-
-		$this->_mEvents[$eventName]->add($delegate);
-	}
-	
-	function setAnchorDelegate($eventName,&$delegate)
-	{
-		if(!isset($this->_mEvents[$eventName]))
-			$this->_mEvents[$eventName] = new XCube_Event($eventName);
-
-		$this->_mEvents[$eventName]->setAnchorDelegate($delegate);
-	}
-	
-	function replaceEvent($eventName,&$eventHandler)
-	{
-		if(isset($this->_mReserveEventList[$eventName])) {
-			unset($this->_mReserveEventList[$eventName]);
-		}
-		if(isset($this->_mRegistedFlags[$eventName])) {
-			unset($this->_mRegistedFlags[$eventName]);
-		}
-		if(isset($this->_mEvents[$eventName])) {
-			if(strtolower(get_class($this->_mEvents[$eventName]))=="xcube_event") {
-				//
-				// TODO : omg! We access private property.
-				//
-				foreach($this->_mEvents[$eventName]->_mDelegates as $delegate) {
-					$eventHandler->_mDelegates[]=$delegate;
-					unset($delegate);
-				}
-				unset($this->_mEvents[$eventName]);
-				$this->_mEvents[$eventName]=&$eventHandler;
-			}
-		}
-		else {
-			$this->_mEvents[$eventName]=&$eventHandler;
-		}
-	}
-
-	function raiseEvent($eventName,&$sender,&$eventArgs)
-	{
-		if(isset($this->_mReserveEventList[$eventName])&&$this->_mRegistedFlags[$eventName]==false) {
-			$this->_processProxyRegist($eventName);
-		}
-		
-		if(isset($this->_mEvents[$eventName])) {
-			$this->_mEvents[$eventName]->raiseEvent($sender,$eventArgs);
-
-			return true;
-		}
-		return false;
-	}
-
-	function addProxyRegister(&$register)
-	{
-		$i=count($this->_mProxyRegisters)+1;
-		$this->_mProxyRegisters[$i]=&$register;
-		
-		$list=$register->getEventNameList();
-		foreach($list as $name) {
-			if(!isset($this->_mReserveEventList[$name])) {
-				$this->_mReserveEventList[$name]=array();
-				$this->_mRegistedFlags[$name]=false;
-			}
-
-			$this->_mReserveEventList[$name][]=$i;
-		}
-	}
-	
-	function _processProxyRegist($eventName)
-	{
-		$this->_mRegistedFlags[$eventName]=true;
-		foreach($this->_mReserveEventList[$eventName] as $i) {
-			$this->add($eventName,$this->_mProxyRegisters[$i]->createDelegate($eventName));
-		}
-	}
-}
-
-/**
- * This class tells a manager about a list of the event that the Delegate which this class can create.
- * And this class creates Delegate when the manager needs Delegate.
- * Developer does not need to use this by all means.
- */
-class XCube_EventProxyRegister
-{
-	/**
-	 * @return array
-	 */
-	function getEventNameList()
-	{
-	}
-	
-	function &createDelegate($name)
-	{
-		$ret =null;
-		$methodName=str_replace(".","_","create".ucfirst($name)."Delegate");
-		if(method_exists($this,$methodName)) {
-			//
-			// Couldn't use user_call_func to receive reference.
-			//
-			$ret =& $this->$methodName();
-		}
-
-		return $ret;
-	}
-}
-
-/**
-  *
-  * Static Utility methods for XCube_EventManager
-  *
-  */
-class XCube_EventUtils
-{
-    /**
-    Simple Raise Event method;
-    */
-    function &quickRaiseEvent($event, $eventArgs = array())
-    {
-        $root=&XCube_Root::getSingleton();
-        if ($root->mEventManager->raiseEvent($event, $root->mController, $eventArgs)) {
-            return $eventArgs;
-        } else {
-			$ret = null;
-            return $ret;
-        }
-    }
-
-    /**
-    Simple Text Filterling with Event mechanism
-    */
-    function quickApplyFilter($filter, $string, $optionArgs = array())
-    {
-        $root=&XCube_Root::getSingleton();
-        $eventArgs = array_merge(array('string' => $string), $optionArgs);
-        if ($root->mEventManager->raiseEvent($filter, $root->mController, $eventArgs)) {
-            return $eventArgs['string'];
-        } else {
-            return $string;
-        }
-    }
-}
-?>
\ No newline at end of file
Index: xoops2jp/html/class/XCube_EventArgs.class.php
diff -u xoops2jp/html/class/XCube_EventArgs.class.php:1.1.2.1 xoops2jp/html/class/XCube_EventArgs.class.php:removed
--- xoops2jp/html/class/XCube_EventArgs.class.php:1.1.2.1	Wed Nov  9 20:53:01 2005
+++ xoops2jp/html/class/XCube_EventArgs.class.php	Mon Aug  7 20:26:01 2006
@@ -1,81 +0,0 @@
-<?php
-
-class LoginEventArgs
-{
-	var $mUser=null;
-	var $mXoopsUser=null;
-
-	function hasUser()
-	{
-		return $this->mUser!=null;
-	}
-
-	function hasXoopsUser()
-	{
-		return $this->mUser!=null;
-	}
-
-	function setUser(&$user)
-	{
-		$this->mUser=&$user;
-	}
-	
-	function &getUser()
-	{
-		return $this->mUser;
-	}
-
-	function setXoopsUser(&$user)
-	{
-		$this->mXoopsUser=&$user;
-	}
-
-	function &getXoopsUser()
-	{
-		return $this->mXoopsUser;
-	}
-}
-
-class CheckLoginEventArgs extends LoginEventArgs
-{
-	var $mSuccessFlag=false;
-	var $mRedirectUrl=XOOPS_URL;
-	var $mRedirectMessage=null;
-	
-	function setSuccessFlag($flag)
-	{
-		$this->mSuccessFlag=$flag;
-	}
-
-	function getSuccessFlag()
-	{
-		return $this->mSuccessFlag;
-	}
-	
-	function isSuccess()
-	{
-		return $this->mSuccessFlag;
-	}
-	
-	function setRedirectUrl($url)
-	{
-		$this->mRedirectMessage=$url;
-	}
-	
-	function getRedirectUrl()
-	{
-		return $this->mRedirectUrl;
-	}
-	
-	function setRedirectMessage($message)
-	{
-		$this->mRedirectMessage=$message;
-	}
-	
-	function getRedirectMessage()
-	{
-		return $this->mRedirectMessage;
-	}
-}
-
-?>
\ No newline at end of file


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