Ejemplo n.º 1
0
Archivo: ORM.php Proyecto: techart/tao
 /**
  * Устанавливает набор мапперов
  *
  * @return Search_Sphinx_ORM_Resolver
  */
 public function mappers()
 {
     foreach (Core::normalize_args(func_get_args()) as $k => $mapper) {
         if ($mapper instanceof DB_ORM_Mapper) {
             $this->mappers[$k] = $mapper;
         }
     }
     return $this;
 }
Ejemplo n.º 2
0
Archivo: JSON.php Proyecto: techart/tao
 /**
  * Регестрирует хелпер
  * 
  */
 public static function use_helpers()
 {
     $args = Core::normalize_args(func_get_args());
     foreach ($args as $k => $v) {
         if ($v instanceof Templates_HelperInterface) {
             self::$helpers->append($v, is_numeric($k) ? null : (string) $k);
         }
     }
 }
Ejemplo n.º 3
0
 public function register()
 {
     $args = func_get_args();
     foreach (Core::normalize_args($args) as $name => $call) {
         if ($call instanceof Core_InvokeInterface) {
             $this->register[$this->standartizate_name($name)] = $call;
         }
     }
     return $this;
 }
Ejemplo n.º 4
0
 /**
  */
 public function __construct()
 {
     $arg = Core::normalize_args(func_get_args());
     $this->checkers = array();
     if ($arg != null) {
         foreach ($arg as $k => $v) {
             $this->add_checker($v);
         }
     }
 }
Ejemplo n.º 5
0
 public function filter()
 {
     foreach (Core::normalize_args(func_get_args()) as $arg) {
         $this->filters[str_replace('!', '', $arg)] = !Core_Strings::starts_with($arg, '!');
     }
     return $this;
 }
Ejemplo n.º 6
0
Archivo: Core.php Proyecto: techart/tao
 /**
  * Объединяет строки с использованием разделителя
  *
  * @return string
  */
 public static function concat_with()
 {
     $args = Core::normalize_args(func_get_args());
     return implode((string) array_shift($args), $args);
 }
Ejemplo n.º 7
0
Archivo: ORM.php Proyecto: techart/tao
 /**
  * Выполняет диспетчеризацию вызово динамических методов.
  *
  * Метод обрабатывает вызовы методов установки опций маппера.
  * С деталями можно ознакомиться в описаниях соответствующих методов.
  *
  * @param string $method имя метода
  * @param mixed  $args   аргументы метода
  *
  * @return self
  */
 public function __call($method, $args)
 {
     switch ($method) {
         case 'classname':
         case 'column':
         case 'validator':
         case 'table':
         case 'calculate':
         case 'explicit_key':
         case 'lookup_by':
         case 'search_by':
         case 'index':
         case 'defaults':
             $this->options->__call($method, $args);
             return $this;
         case 'order_by':
         case 'group_by':
         case 'range':
             if ($this->is_immutable) {
                 return $this->spawn()->__call($method, $args);
             } else {
                 $this->options->__call($method, $args);
                 return $this;
             }
         case 'key':
         case 'columns':
             $this->options->{$method}(Core::normalize_args($args));
             return $this;
         case 'only':
         case 'exclude':
             if ($this->is_immutable) {
                 return $this->spawn()->__call($method, $args);
             } else {
                 $this->options->{$method}(Core::normalize_args($args));
                 return $this;
             }
         case 'having':
         case 'where':
             if ($this->is_immutable) {
                 return $this->spawn()->__call($method, $args);
             }
             $expr = isset($args[0]) ? $args[0] : null;
             $parms = isset($args[1]) ? $args[1] : null;
             if (is_array($expr)) {
                 $expr = '(' . implode(') AND (', $expr) . ')';
             }
             if ($parms !== null) {
                 $this->collect_binds($expr, $parms);
             }
             $this->options->{$method}($expr);
             return $this;
         case 'join':
             if ($this->is_immutable) {
                 return $this->spawn()->__call($method, $args);
             }
             $type = array_shift($args);
             $table = array_shift($args);
             $this->options->{$method}($type, $table, Core::normalize_args($args));
             return $this;
         default:
             return parent::__call($method, $args);
     }
 }
Ejemplo n.º 8
0
 /**
  * @param array $values
  *
  * @return OpenSocial_Client
  */
 public function requests()
 {
     foreach (Core::normalize_args(func_get_args()) as $id => $request) {
         $this->request($request, is_int($id) ? null : $id);
     }
     return $this;
 }
Ejemplo n.º 9
0
Archivo: SQL.php Proyecto: techart/tao
 /**
  * @param string $type
  * @param string $table
  *
  * @return DB_ORM_SelectStatement
  */
 public function join($type, $table)
 {
     $this->make_part('joins');
     $this->parts['joins'][] = array($type, $table, Core::normalize_args(array_splice(func_get_args(), 2)));
     return $this;
 }
Ejemplo n.º 10
0
 /**
  * @return boolean
  */
 public function delete_tags()
 {
     $args = func_get_args();
     $tags = Core::normalize_args($args);
     $res = true;
     foreach ($tags as $t) {
         $tag_key = Cache_Tagged::option('tag_prefix') . $t;
         $keys = $this->backend->get($tag_key);
         if (is_array($keys)) {
             foreach ($keys as $key) {
                 $res && $this->backend->delete($key);
             }
         }
         $res = $res && $this->backend->delete($tag_key);
     }
     return $res;
 }
Ejemplo n.º 11
0
 /**
  * Конструктор
  *
  * @param WS_ServiceInterface $application
  */
 public function __construct(WS_ServiceInterface $application)
 {
     $args = func_get_args();
     parent::__construct(array_shift($args));
     $this->args = Core::normalize_args($args);
 }
Ejemplo n.º 12
0
 /**
  * @return Service_Google_Chart_Axis
  */
 public function range()
 {
     $args = func_get_args();
     return $this->option('chxr', Core::normalize_args($args));
 }
Ejemplo n.º 13
0
Archivo: REST.php Proyecto: techart/tao
 /**
  * @return WS_REST_Method
  */
 public function produces()
 {
     foreach (Core::normalize_args(func_get_args()) as $format) {
         $this->formats[] = trim((string) $format);
     }
     return $this;
 }
Ejemplo n.º 14
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);
 }
Ejemplo n.º 15
0
 /**
  * Регистрирует хелперы для данного шаблона
  *
  * @return Templates_Templates
  */
 public function use_helpers()
 {
     $args = Core::normalize_args(func_get_args());
     if (count($args) > 0) {
         foreach ($args as $k => $v) {
             if ($v instanceof Templates_HelperInterface) {
                 $this->helpers->append($v, $k);
             }
         }
     }
     return $this;
 }
Ejemplo n.º 16
0
 /**
  * @return Service…Yandex_Direct_ForecastBuilder
  */
 public function with_categories()
 {
     $args = func_get_args();
     return $this->update_attrs('Categories', Core::normalize_args($args));
 }
Ejemplo n.º 17
0
Archivo: HTML.php Proyecto: techart/tao
 public function use_scripts()
 {
     foreach (Core::normalize_args(func_get_args()) as $file) {
         $this->use_file(is_array($file) ? $file : array('name' => $file), 'js');
     }
     return $this;
 }