public static function get($name) { if (!isset(self::$storage[$name])) { $di = data_interface::get_instance('registry'); self::$storage[$name] = $di->get($name); } $rec = self::$storage[$name]; switch ($rec->type) { case 1: return (string) $rec->value; break; case 2: return json_decode($rec->value); break; case 3: $cfg = $rec->value; if (!empty($cfg->di)) { $di = data_interface::get_instance($cfg->di); return $di->call($cfg->ep, json_decode($cfg->params)); } else { if (!empty($cfg->ui)) { $ui = user_interface::get_instance($cfg->ui); return $ui->call($cfg->ep, json_decode($cfg->params)); } else { throw new Exception("Unknown call configuration for registry record '{$name}'"); } } break; default: throw new Exception("Unknown registry record type for '{$name}'"); } }
public function __construct() { parent::__construct(__CLASS__); }
/** * Анализ шаблона вида {__ui_name::method(var=val)__} * Вызов пользовательского интерфейса * * @param array $args Результат работы регулярного выражения @see this::parse(); * [1] => Имя узла, обрабатываемого шаблоном, или параметры вызова * @see this::parse() */ private function _parse_call_ui($args) { $ui = user_interface::get_instance($args[1]); return $ui->call($args[2], $this->_convert_params_to_array($this->_parse_line($args[3]))); }
/** * Get array of UI * @access private * @return array The array of UI objects */ private function get_ui_array() { $uis = $this->get_ui_name_array(); // Перебираем список полученных DI и регистрируем их foreach ($uis as $iName => $props) { if ($iObj = user_interface::get_instance($iName)) { $uis[$iName]['obj'] = $iObj; $uis[$iName]['rec'] = $this->register($iName, 'ui', $iObj); } else { unset($uis[$iName]); } } return $uis; }
<?php /** * The user interface initialization code * * @author Litvinenko S. Anthon <*****@*****.**> * @version 2.0 * @access public * @package CFsCMS2(PE) */ try { // Call user interface $ui = user_interface::get_instance(request::get('ui', UI_DEFAULT)); if (($content = $ui->call(request::get('cll'), request::get())) === FALSE) { response::header('404'); } else { response::send($content, 'html'); } } catch (Exception $e) { dbg::write($e->getMessage(), LOG_PATH . 'ui_errors.log'); //response::header('404'); //9* 28102010 $out = user_interface::get_instance('action_page'); $out->set_args(array('action_msg' => $e->getMessage())); return $out->render(); }
/** * External entry point * Return JSON-object neccessary UI for application */ protected function sys_dependencies() { $face = $this->get_args('face'); $faces = $this->get_entry_poins('/^' . UI_CALL_PREFIX . '\\w+/'); try { if (!in_array(UI_CALL_PREFIX . $face, $faces)) { throw new Exception("Приложение {$this->interfaceName}.{$face} не существует."); } $dependencies = array(); $deps = (array) $this->deps[$face]; while (!empty($deps)) { $app = array_shift($deps); list($ui_name, $call) = preg_split('/\\./', $app); $ui = user_interface::get_instance($ui_name); $sub_deps = $ui->get_dependencies($call); foreach ($sub_deps as $dep) { array_push($deps, $dep); } array_push($dependencies, $app); } $dependencies = array_reverse($dependencies); $dependencies = array_unique($dependencies); $dependencies = array_reverse($dependencies); response::send(array('success' => true, 'dependencies' => $dependencies), 'json'); } catch (Exception $e) { response::send(array('success' => false, 'errors' => $e->getMessage()), 'json'); } }
<?php // NOTE: Инициализация базовой части административного интерфейса. include_once 'adm_base.php'; try { if (request::get('cll') == 'logout') { authenticate::logout(); response::redirect('/xxx/'); } else { $ui = user_interface::get_instance('login'); $ui->admin(); } } catch (Exception $e) { dbg::write($e->getMessage(), LOG_PATH . 'ui_errors.log'); response::header('404'); }
public function __construct() { parent::__construct(__CLASS__); $this->files_path = dirname(__FILE__) . '/'; }
<?php /** * The user interface initialization code * * @author Litvinenko S. Anthon <*****@*****.**> * @version 2.0 * @access public * @package CFsCMS2(PE) */ try { // NOTE: If defined authentication data interface and user not logged in if (defined('AUTH_DI') && !authenticate::is_logged()) { // Then redicrect to login form response::redirect('login/'); } // Call user interface $ui = user_interface::get_instance(request::get('ui', UI_DEFAULT)); if (($content = $ui->call(request::get('cll', UI_CLL_DEFAULT), request::get())) === FALSE) { response::header('404'); } else { response::send($content, 'html'); } } catch (Exception $e) { dbg::write($e->getMessage() . "\n" . $e->getTraceAsString(), LOG_PATH . 'ui_errors.log'); response::header('404'); }