public static $enabled=true;
/**
- * check if this proxy implments a specific proxy operation
- * @param string #proxy name of the proxy operation
- * @return bool
- */
- public function provides($operation){
- return method_exists($this,$operation);
- }
-
- /**
- * fallback function when a proxy operation is not implement
+ * fallback function when a proxy operation is not implemented
* @param string $function the name of the proxy operation
* @param mixed
*
self::$proxies[]=$proxy;
}
- public static function getProxies($operation,$post){
- $operation=(($post)?'post':'pre').$operation;
+ public static function getProxies($operation){
$proxies=array();
foreach(self::$proxies as $proxy){
- if($proxy->provides($operation)){
+ if(method_exists($proxy,$operation)){
$proxies[]=$proxy;
}
}
if(!self::$enabled){
return true;
}
- $proxies=self::getProxies($operation,false);
$operation='pre'.$operation;
+ $proxies=self::getProxies($operation);
foreach($proxies as $proxy){
if(!is_null($filepath2)){
if($proxy->$operation($filepath,$filepath2)===false){
if(!self::$enabled){
return $result;
}
- $proxies=self::getProxies($operation,true);
$operation='post'.$operation;
+ $proxies=self::getProxies($operation);
foreach($proxies as $proxy){
$result=$proxy->$operation($path,$result);
}
public static function clearProxies(){
self::$proxies=array();
}
-}
\ No newline at end of file
+}