Ejemplo n.º 1
0
Archivo: Log.php Proyecto: techart/tao
 /**
  * @param string $name
  * @param array  $args
  *
  * @return Log_Handler
  */
 public static function make_handler($name, array $args)
 {
     if (!isset(self::$handlers[$name])) {
         throw new Log_UnknownHandlerException($name);
     }
     return Core::amake(self::$handlers[$name], $args);
 }
Ejemplo n.º 2
0
Archivo: Node.php Proyecto: techart/tao
 public static function factory(XMLReader $reader)
 {
     switch ($reader->nodeType) {
         case XMLREADER::ELEMENT:
             $module = 'XML.Reader.Element';
             break;
         case XMLREADER::ATTRIBUTE:
             $module = 'XML.Reader.Attribute';
             break;
         default:
             $module = 'XML.Reader.Node';
             break;
     }
     return Core::amake($module, func_get_args());
 }
Ejemplo n.º 3
0
 public static function agregator()
 {
     $args = func_get_args();
     return Core::amake('Templates.HTML.Assets.Agregator', $args);
 }
Ejemplo n.º 4
0
Archivo: XML.php Proyecto: techart/tao
 public static function Writer()
 {
     $args = func_get_args();
     return Core::amake('XML.Writer', $args);
 }
Ejemplo n.º 5
0
Archivo: ORM.php Proyecto: techart/tao
 /**
  * Создает объект сущности класса, имя которого указано в опции classname
  *
  * @return mixed
  */
 public function make_entity()
 {
     $args = func_get_args();
     switch (count($args)) {
         case 0:
             $args = array(array(), $this->clear());
             break;
         default:
             $args[] = $this->clear();
             break;
     }
     $entity = isset($this->options['classname']) ? Core::amake($this->options['classname'], $args) : Core::make(DB::option('collection_class'));
     if (method_exists($entity, 'defaults')) {
         $entity->defaults($this->options['defaults']);
     } else {
         $array_access = $entity instanceof ArrayAccess;
         foreach ($this->options['defaults'] as $k => $v) {
             if ($array_access && !isset($entity[$k])) {
                 $entity[$k] = $v;
             } else {
                 if (!isset($entity->{$k})) {
                     $entity->{$k} = $v;
                 }
             }
         }
     }
     //$entity->mapper = $this->clear();
     $entity->after_make();
     return $entity;
 }
Ejemplo n.º 6
0
 public function __call($name, $args)
 {
     if (!isset($this->instance[$name])) {
         if ($this->default_storage) {
             $this->add($name, $this->default_storage);
         } else {
             return null;
         }
     }
     $class = $this->instance[$name];
     $res = null;
     if (is_object($class)) {
         $res = $class;
     } else {
         $class = (string) $class;
         Core::autoload($class);
         $res = Core::amake($class, $args);
     }
     $res->__set_name($name);
     return $res;
 }
Ejemplo n.º 7
0
 /**
  * @return Service_OAuth_HMACSHA1
  */
 public static function HMACSHA1()
 {
     $args = func_get_args();
     return Core::amake('Service.OAuth.HMACSHA1', $args);
 }
Ejemplo n.º 8
0
Archivo: DSL.php Proyecto: techart/tao
 /**
  * Строит цепочку middleware-компонент
  *
  * @param WS_ServiceInterface $app
  *
  * @return WS_ServiceInterface
  */
 protected function build_middleware(WS_ServiceInterface $app)
 {
     foreach (array_reverse($this->middleware) as $name => $conf) {
         if ($conf['class'] instanceof WS_ServiceInterface) {
             $conf['class']->set_application($app);
             $app = $conf['class'];
         } else {
             $this->load_module_for($c = $this->complete_name((string) $conf['class']));
             $app = Core::amake($c, array_merge(array($app), $conf['parms']));
         }
     }
     $this->middleware = array();
     return $app;
 }
Ejemplo n.º 9
0
Archivo: DSL.php Proyecto: techart/tao
 /**
  * @return Service_OpenSocial_AuthAdapter
  */
 protected function make_auth()
 {
     if ($this->auth[0] instanceof Service_OpenSocial_AuthAdapter) {
         return $this->auth[0];
     } else {
         Core::load($m = 'Service.OpenSocial.Auth.' . $this->auth[0]);
         return Core::amake("{$m}.Adapter", array_slice($this->auth, 1));
     }
 }
Ejemplo n.º 10
0
 public static function Event()
 {
     $args = func_get_args();
     return Core::amake('Events.Event', $args);
 }
Ejemplo n.º 11
0
 /**
  * Создает объект класса map[$name] c параметрами конструктора $args.
  *
  * @uses self::$map
  *
  * @param mixed $name Должен быть ключом массива, установленного ранее
  *                    через $this->map() или $this->map_list(). Значением ключа должен быть
  *                    либо объект либо имя класса
  *
  * @see  Core::reflection_for()
  * @see  Core::amake()
  *
  * @param array $args Параметры, передаваемые конструктору класса
  *
  * @throws Core_InvalidArgumentValueException Если ключ $name отсутствует в массиве $map
  *
  * @return object
  */
 public function new_instance_of($name, $args = array())
 {
     if (isset($this->map[$name])) {
         return Core::amake($this->map[$name], $args);
     } else {
         throw new Core_InvalidArgumentValueException('name', $name);
     }
 }
Ejemplo n.º 12
0
 /**
  * Создает объект класса WS.Middleware.Cache.Service
  *
  * @param WS_ServiceInterface $application
  * @param string              $dsn
  * @param array()             $urls
  *
  * @return WS_Middleware_Cache_Service
  */
 public static function Service(WS_ServiceInterface $application)
 {
     $args = func_get_args();
     return Core::amake('WS.Middleware.Cache.Service', $args);
 }
Ejemplo n.º 13
0
Archivo: REST.php Proyecto: techart/tao
 /**
  * @param string|array $app
  *
  * @return WS_REST_Application
  */
 protected function load_application($name, $parms = array())
 {
     $app = $this->mappings[$name];
     if (empty($app)) {
         return null;
     }
     $class_name = $app['class'];
     $instance = Core::amake($class_name, array($app['prefix'], array_merge($parms, $app['param'])));
     $instance->name = $name;
     if ($instance instanceof WS_Services_REST_Application) {
         return $instance;
     } else {
         throw new WS_Services_REST_Exception('Incompatible application class: ' . Core_Types::virtual_class_name_for($class_name));
     }
 }
Ejemplo n.º 14
0
Archivo: CMS.php Proyecto: techart/tao
 public static function build_apache_auth_module()
 {
     $config = Config::all()->apache_auth;
     $module = Core::if_not($config->module, 'WS.Auth.Apache.RemoteAuthModule');
     $args = Core::if_not($config->module_args, array());
     $instance = Core::amake($module, $args);
     return $instance;
 }
Ejemplo n.º 15
0
 /**
  * Создает и сохраняет экземпляр класса кодировщика паролей
  *
  * Используется класс из опции password_encoder_class.
  * В конструктор передается соль из опции password_salt
  */
 public static function PasswordEncoder()
 {
     if (!is_null(self::$encoder)) {
         return self::$encoder;
     }
     $args = Core::normalize_args(func_get_args());
     $salt = self::option('password_salt');
     if (!empty($salt) && (!isset($args[0]) || empty($args[0]))) {
         $args[0] = $salt;
     }
     $class = self::option('password_encoder_class');
     if (!is_null(self::option('password_encoder_callback'))) {
         $class = 'Digest.PasswordCallbackEncoder';
         $salt = isset($args[0]) ? $args[0] : null;
         $args[0] = self::option('password_encoder_callback');
         $args[1] = $salt;
     }
     return self::$encoder = Core::amake($class, $args);
 }