示例#1
0
文件: Page.php 项目: hasanozgan/joy
 public static function factory($name)
 {
     $ref = new Joy_Reflection($name);
     if (!$ref->isA(Joy_Page_Interface)) {
         throw new Joy_Exception_NotFound_Page("Page Not Found ({$name})");
     }
     return $ref->newInstance();
 }
示例#2
0
 public function getController($name)
 {
     if (!$this->_controllers[$name] instanceof Joy_Controller_Interface) {
         $ref = new Joy_Reflection($name);
         if ($ref->isA(Joy_Controller_Interface)) {
             $this->_controllers[$name] = $ref->newInstance();
         }
     }
     return $this->_controllers[$name];
 }
示例#3
0
 /**
  * factory method is adapter factory  
  *
  * @param string $adapterName 
  * @return Dahius_VirtualPos_Interface 
  */
 public function factory($adapterName)
 {
     if (empty($adapterName)) {
         throw new VPosException("AdapterName not set");
     }
     if (!array_key_exists($adapterName, $this->_adapters)) {
         throw new VPosException("AdapterName({$adapterName}) not found");
     }
     $adapter = $this->_adapters[$adapterName]["adapter"];
     $params = $this->_adapters[$adapterName]["parameters"];
     $ref = new Joy_Reflection($adapter);
     return $ref->newInstance(array($adapterName, $params));
 }
示例#4
0
 /**
  * getInstance
  * 
  * @return void
  */
 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         $config = Joy_Config::getInstance();
         $session_provider = $config->application->get("application/session");
         if (null == $session_provider) {
             $session_provider = "Joy_Context_Session_Local";
         }
         $ref = new Joy_Reflection($session_provider);
         self::$_instance = $ref->newInstance();
     }
     return self::$_instance;
 }
示例#5
0
 public function _init()
 {
     $this->auth = false;
     $this->_membership = $this->config->application->get("application/membership");
     if ($this->_membership && $this->_membership["provider"]) {
         $ref = new Joy_Reflection($this->_membership["provider"]);
         $this->provider = $ref->newInstance();
     }
     $this->acl = new Joy_Membership_Acl();
     // Role, Resource and Alloweds
     $this->profiles = new Joy_Membership_Profile();
     //        Joy_Membership_Role;
     //        Joy_Membership_Profile;
     //        Joy_Membership_User;
 }
示例#6
0
文件: Stack.php 项目: hasanozgan/joy
 public function __toString()
 {
     $render = Joy_Context_Response::getInstance()->getRender();
     $output = "";
     foreach ($this->_stack as $stack) {
         try {
             list($class, $params) = each($stack);
             $ref = new Joy_Reflection($class);
             $view = $ref->newInstance(array($params));
             $output .= $render->execute($view);
         } catch (Exception $ex) {
             $output .= $ex->getMessage();
         }
     }
     return $output;
 }
示例#7
0
文件: Module.php 项目: hasanozgan/joy
 public function action($name, $arguments = array())
 {
     //TODO: Check Permission
     $action_info = explode('.', $name);
     $action = array_shift($action_info);
     $hasWidget = (bool) ("widget" == strtolower(array_shift($action_info)));
     if ($hasWidget) {
         $action[0] = strtoupper($action[0]);
         $widgetClass = sprintf("%s_%s_%s", get_class($this), $this->getWidgetFolder(), $action);
         $widget = new Joy_Reflection($widgetClass);
         return $widget->newInstance($arguments);
     } else {
         return parent::action($action, $arguments);
     }
     #       $view = Joy_View($template,
     #       $this->assign;
     #    var_dump($hasWidget, $action);
 }
示例#8
0
 public function __construct($app_dir, $app_env = null)
 {
     parent::__construct();
     $this->config->application->set("folders/root", $app_dir);
     $this->config->application->loadConfig($app_env);
     // set library include path
     $this->setIncludePath($this->config->application->get("folders/library"));
     // set controller include path
     $this->setIncludePath($this->config->application->get("folders/controller"));
     $this->router = Joy_Router::getInstance();
     // Bootstrap Loader...
     $bootstrap = $this->config->application->get("application/bootstrap");
     if ($bootstrap) {
         $ref = new Joy_Reflection($bootstrap);
         $object = $ref->newInstance();
     }
     if (!$object instanceof Joy_Application_Bootstrap) {
         $object = new Joy_Application_Bootstrap();
     }
 }
示例#9
0
文件: Cache.php 项目: hasanozgan/joy
 /**
  * factory static method is instance controller
  *
  * @param string $name is controller class name
  * @return Joy_Controller
  */
 public static function factory($name)
 {
     $ref = new Joy_Reflection($name);
     return $ref->newInstance();
 }
示例#10
0
文件: Model.php 项目: hasanozgan/joy
 public function setBootstrap($class)
 {
     $ref = new Joy_Reflection($class);
     $ref->newInstance(array($this->_connection));
 }
示例#11
0
 /**
  * exists static method is check controller
  *
  * @param string $name is controller class name
  * @return boolean
  */
 public static function exists($name)
 {
     $ref = new Joy_Reflection($name);
     return $ref->isA(Joy_Controller_Interface);
 }
示例#12
0
 public static function newInstance($class)
 {
     $ref = new Joy_Reflection($class);
     return $ref->newInstance();
 }