コード例 #1
0
ファイル: eden.php プロジェクト: annaqin/eden
 public function __call($name, $args)
 {
     //first try to call the parent call
     try {
         return parent::__call($name, $args);
         //this means something in the route went wrong
     } catch (Eden_Route_Exception $e) {
         //now try to call parent with the eden prefix
         return parent::__call('Eden_' . $name, $args);
     }
 }
コード例 #2
0
ファイル: eden.php プロジェクト: rafamaxber/Arkay-sync
if(!class_exists('Eden')){function eden(){$class=Eden::i();if(func_num_args()==0){return $class;}$args=func_get_args();return $class->__invoke($args);}class Eden extends Eden_Event{protected $_root=NULL;protected static $_active=NULL;public static function i(){return self::_getSingleton(__CLASS__);}public function __construct(){if(!self::$_active){self::$_active=$this;}$this->_root=dirname(__FILE__);}public function __call($name,$args){try{return parent::__call($name,$args);}catch(Eden_Route_Exception $e){return parent::__call('Eden_'.$name,$args);}}public function setRoot($root){Eden_Error::i()->argument(1,'string');if(!class_exists('Eden_Path')){Eden_Loader::i()->load('Eden_Path');}$this->_root=(string) Eden_Path::i($root);return $this;}public function getRoot(){return $this->_root;}public function getActiveApp(){return self::$_active;}public function setLoader(){if(!class_exists('Eden_Loader')){require_once dirname(__FILE__).'/eden/loader.php';}spl_autoload_register(array(Eden_Loader::i(),'handler'));if(!class_exists('Eden_Path')){Eden_Loader::i()->addRoot(dirname(__FILE__))->load('Eden_Path');}$paths=func_get_args();if(empty($paths)){return $this;}$paths=array_unique($paths);foreach($paths as $i=>$path){if(!is_string($path) && !is_null($path)){continue;}if($path){$path=(string) Eden_Path::i($path);}else{$path=$this->_root;}if(!is_dir($path)){$path=$this->_root.$path;}if(is_dir($path)){Eden_Loader::i()->addRoot($path);}}return $this;}public function routeClasses($routes){Eden_Error::i()->argument(1,'string','array','bool');$route=Eden_Route::i()->getClass();if($routes===true){$route->route('Cache','Eden_Cache')->route('Registry','Eden_Registry')->route('Model','Eden_Model')->route('Collection','Eden_Collection')->route('Cookie','Eden_Cookie')->route('Session','Eden_Session')->route('Template','Eden_Template')->route('Curl','Eden_Curl')->route('Event','Eden_Event')->route('Path','Eden_Path')->route('File','Eden_File')->route('Folder','Eden_Folder')->route('Image','Eden_Image')->route('Mysql','Eden_Mysql')->route('Type','Eden_Type');return $this;}if(is_string($routes)){$routes=include($routes);}foreach($routes as $alias=>$class){$route->route($alias,$class);}return $this;}public function routeMethods($routes){Eden_Error::i()->argument(1,'string','array','bool');$route=Eden_Route::i()->getMethod();if(is_bool($routes)){$route->route(NULL,'output','Eden_Debug');return $this;}if(is_string($routes)){$routes=include($routes);}foreach($routes as $method=>$routePath){if(is_string($routePath)){$routePath=array($routePath);}if(is_array($routePath) && !empty($routePath)){if(count($routePath)==1){$routePath[]=$method;}$route->route($method,$routePath[0],$routePath[1]);}}return $this;}public function startSession(){Eden_Session::i()->start();return $this;}public function setTimezone($zone){Eden_Error::i()->argument(1,'string');date_default_timezone_set($zone);return $this;}}}
コード例 #3
0
ファイル: eden.php プロジェクト: jpalala/startupjobs
 public function __call($name, $args)
 {
     try {
         return parent::__call($name, $args);
     } catch (Eden_Route_Exception $e) {
         return parent::__call('Eden_' . $name, $args);
     }
 }