function __construct($action = null, $method = 'POST') { $this->form = new Element('form', compact('action', 'method'), array()); $args = func_get_args(); if (count($args) == 0) { return; } if (!is_string($args[0])) { $handler = $args[0]; foreach (\Radical\Core\Libraries::get('Web\\Form\\Builder\\Adapter\\*') as $class) { if ($class::is($handler)) { $this->handler = new $class($handler); unset($args[0]); //slice break; } } } }
static function register_expr($expr) { foreach (\Radical\Core\Libraries::get($expr) as $class) { self::register($class); } }
protected static function getClasses() { return \Radical\Core\Libraries::get(\Radical\Core\Libraries::getProjectSpace('DB\\*')); }
private function action_functor($data) { if (is_string($data)) { $len = strlen($data); if ($len == 0) { throw new \InvalidArgumentException('String must be more than 0B'); } $class = $data; if ($data[0] != '\\') { $class_expr = '\\*\\Web\\Page\\Controller\\' . $data; $class = null; foreach (\Radical\Core\Libraries::get($class_expr) as $class) { //$class set break; } if ($class === null) { return null; } } return function ($data) use($class) { return new $class($data); }; } else { if (is_callable($data)) { return $data; } } throw new \InvalidArgumentException("Invalid argument type:" . gettype($data)); }
static function get($fromType) { foreach (\Radical\Core\Libraries::get(self::TYPES_EXPR) as $class) { if ($class::is($fromType)) { return new $class($fromType); } } }
static function getTypes() { static $cache = null; if ($cache === null) { $cache = \Radical\Core\Libraries::get('Radical\\Database\\SQL\\Parse\\Types\\*'); } return $cache; }
/** * Calls the init functions for all the error modules */ function __construct() { //Itterate all error trackers foreach (\Radical\Core\Libraries::get(self::ERRORS_EXPR) as $class) { $class::Init(); } parent::__construct(); }
static function find($library, $version = null) { $library = strtolower($library); $libs = Libraries::get('Web\\Resource\\Javascript\\Libraries\\*'); foreach ($libs as $l) { $ll = strtolower(array_pop(explode('\\', $l))); if ($ll == $library) { return new $l($version); } } }
private function make_object($http_method, $type) { //Find Class $c = $this->classPrefix . $this->module; $classes = Libraries::get($c); if (!count($classes)) { return null; } $c = $classes[0]; return new $c($this->query, $type, $http_method); }
private function getClass() { $ns = $this->ns; if ($this->ns === null) { $ns = '*'; } $class = '\\' . $ns . '\\CLI\\Daemon\\Module\\' . $this->module; if ($this->ns === null) { $classes = \Radical\Core\Libraries::get($class); if ($classes) { return $classes[0]; } return null; } return $class; }
private function getClass() { $ns = $this->ns; if ($this->ns === null) { $ns = '*'; } $class = '\\' . $ns . '\\CLI\\Cron\\Jobs\\' . $this->job; if ($this->ns === null) { $classes = \Radical\Core\Libraries::get($class); if (empty($classes)) { throw new \Exception("No class found matching: " . $class); } if ($classes) { return $classes[0]; } return null; } return $class; }
static function recognise(URL $url) { $path = $url->getPath()->getPath(true); $match = null; foreach (static::$match as $expr => $class) { $matches = Format::consumeRegex($path, $expr, $match); if ($matches) { if (is_array($class) || is_string($class)) { if (is_array($class)) { $data = isset($class['data']) ? $class['data'] : $match; $class = $class['class']; } else { $data = $match; //matched but no data if ($data === true) { $data = array(); } } if (is_string($class)) { if ($class[0] != '\\') { $class_expr = '\\*\\Web\\Page\\Controller\\' . $class; $class = null; foreach (\Radical\Core\Libraries::get($class_expr) as $class) { //$class set break; } if ($class === null) { return null; } } return new $class($data); } } return $class; } } }
/** * Return all Adapters * * @return array */ static function adapters() { return \Radical\Core\Libraries::get('Radical\\Web\\Templates\\Adapter\\*'); }
static function getAll() { return \Radical\Core\Libraries::get(static::CLASS_BASE . '\\*'); }