/** * @return pkgmanager_package */ public static function get_pkg() { static $_pkg; if (empty($_pkg)) { return $_pkg = pkgman_manager::getp('html'); } return $_pkg; }
protected function substitute_params($sql) { $this->_pkg = pkgman_manager::getp('sql'); if (empty($this->_pkg->config['global_params'])) { $this->_pkg = null; } $sql = preg_replace_callback('#\\${(!?[a-zA-Z0-9_\\-|]+)}#u', array($this, 'substitute_params_callback'), $sql); return $sql; }
public static function get_default() { static $inst = null; if (!empty($inst)) { return $inst; } $hcal = pkgman_manager::getp('hcal'); $inst = new hcal_lang_output($hcal->config['lang']); return $inst; }
/** * @param string $loc_name * @return hcal_location */ public static function get($loc_name = null) { if (empty($loc_name)) { $hcal = pkgman_manager::getp('hcal'); $loc_name = $hcal->config['location']; } if (empty(self::$locations[$loc_name])) { return false; } return new hcal_location(self::$locations[$loc_name], $loc_name); }
/** * @desc Connect to a mysql using mysqli extention. * $con_config common params and default values: * 'host' => ini_get("mysqli.default_host"), 'port' => ini_get("mysqli.default_port"), * 'user' => ini_get("mysqli.default_user"), 'pass' => ini_get("mysqli.default_pw"), * 'db' => '', * if $con_config['link'] is set to mysqli object, do not open new connection * just wrap already open mysqli connection with this class * @param $con_config - connection config */ public function __construct($con_config) { parent::__construct(); $pkg = pkgman_manager::getp("sql"); $default_config = array('host' => ini_get("mysqli.default_host"), 'port' => ini_get("mysqli.default_port"), 'user' => ini_get("mysqli.default_user"), 'pass' => ini_get("mysqli.default_pw"), 'db' => '', 'socket' => ini_get("mysqli.default_socket"), 'charset' => @$pkg->config['charset'], 'buffered' => true, 'throw_on_error' => @$pkg->config['throw_on_error'], 'on_demand' => false); // merge all config arrays together if (empty($con_config)) { $con_config = array(); } $this->config = array_merge($this->config, $default_config, $con_config); if (empty($this->config['on_demand'])) { $this->set_link(); } }
/** * @param string $lang * @param string|array $paths A paths to the XML files to load (single string or array) * @param bool $glob if true (default) each path is expanded using glob() function */ public function __construct($lang, $paths = null, $glob = true) { $this->lang = $lang; $this->xml_paths = array(); if (empty($paths)) { $hcal_pkg = pkgman_manager::getp('hcal'); $paths = array($hcal_pkg->path . '/locations/*.xml'); } elseif (!is_array($paths)) { $paths = array($paths); } foreach ($paths as $path) { if ($glob) { foreach (glob($path, GLOB_NOSORT | GLOB_BRACE) as $p) { if (file_exists($p)) { $this->xml_paths[] = $p; } } } elseif (file_exists($path)) { $this->xml_paths[] = $path; } } }
/** * @desc Must be called by all specific DB driver constructors */ protected function __construct() { $pkg = pkgman_manager::getp('sql'); $this->config = array('model_provider' => @$pkg->config['default_model_provider']); }
/** * @desc Creates a new instance of the appropriate form element. Static version * @param string $type - one of <code>config['form_element_map']</code> * @param string $name - name attribute * @param array $param - additional parameters (@see appropriate element class for details) * @return unknown_type */ public static function create_form_element($type, $name, $param = null) { $elm_class = pkgman_manager::getp('html')->config['form_element_map'][$type]; if (empty($elm_class)) { throw new Exception("Unmapped element type [{$type}]"); } return new $elm_class($type, $name, $param); }