/** * class constructor for json store implementation. see Xapp_Util_Std_Store::__constructor for more details * * @error 16901 * @see Xapp_Util_Std_Store::__constructor * @param null|mixed $mixed expects one of the above value options * @param null|mixed $options expects optional class instance options * @throws Xapp_Util_Json_Exception */ public function __construct($mixed = null, $options = null) { xapp_init_options($options, $this); if ($mixed !== null) { if (is_object($mixed)) { $this->_object =& $mixed; } else { if (is_array($mixed)) { $this->_object = Xapp_Util_Json::convert($mixed); } else { if (is_file($mixed)) { $this->_file = $mixed; if (($mixed = file_get_contents($mixed)) !== false) { $this->_object = Xapp_Util_Json::decode($mixed); } else { throw new Xapp_Util_Json_Exception("unable to read from file: {$mixed}", 1690101); } } else { if (is_string($mixed) && Xapp_Util_Json::isJson($mixed)) { $this->_object = Xapp_Util_Json::decode($mixed); } else { if (is_string($mixed) && strpos($mixed, '.') !== false && is_writeable(dirname($mixed))) { $this->_file = $mixed; } else { throw new Xapp_Util_Json_Exception("passed first argument in constructor is not a valid object or file path", 1690102); } } } } } } }
/** * default class constructor for all driver implementations that need no * special constructor. concrete driver implementations should always call * parent constructor * * @error 15401 * @param null|mixed $options expects optional xapp option array or object */ protected function __construct($options = null) { xapp_init_options($options, $this); $this->init(); }
/** * class constructor can receive the following first argument: * - null * - object expects the working object passed in constructor * - array expects any working array that will be converted to object * - string as serialized value * - file name pointer that exists (will load object from file) * - file name pointer that does not exists but will be used as save location * will throw exception if any of the above values fails to validate. NOTE: return values from certain methods * are returning a reference to the object of the store. the reference can be manipulated outside the class if * the methods are called like $ref =& $store->get('//path'); * * @error 17001 * @param null|mixed $mixed expects one of the above value options * @param null|mixed $options expects optional class instance options * @throws Xapp_Util_Std_Exception */ public function __construct($mixed = null, $options = null) { xapp_init_options($options, $this); if ($mixed !== null) { if (is_object($mixed)) { $this->_object =& $mixed; } else { if (is_array($mixed)) { if (array_keys($mixed) === range(0, count($mixed) - 1)) { $this->_object = $mixed; } else { $this->_object = (object) $mixed; } } else { if (is_file($mixed)) { $this->_file = $mixed; if (($mixed = file_get_contents($mixed)) !== false) { $this->_object = self::decode($mixed); } else { throw new Xapp_Util_Std_Exception(xapp_sprintf(_("unable to read from file: %s"), $mixed), 1700101); } } else { if (is_string($mixed) && preg_match('/^([adObis]\\:|N\\;)/', trim($mixed))) { $this->_object = self::decode($mixed); } else { if (is_string($mixed) && strpos($mixed, '.') !== false && is_writeable(dirname($mixed))) { $this->_file = $mixed; } else { throw new Xapp_Util_Std_Exception(_("passed first argument in constructor is not a valid object or file path"), 1700102); } } } } } } }
/** * class constructor initialize autloader but can only be called via singleton. constructor checks for * autoloading capacities, sets xapp default autoload directory and processes any other directories passed * in first parameter which can be: * 1) string = containing a relative or absolute path * 2) array = containing an array of relative or absolute paths * 3) array = containing an array with at least 2 values per key e.g. $dir = array(array('path', 'ns', 'divider'),..) * when defining a namespace in variant 3) it will add this namespace and/or divider in front of file name so a class * named Xapp_Registry residing in /Registry/Registry.php can be mapped because file name does not have the namespace * in the file name. * * directories can be passed relative or absolute. when passed relative autoloader will try to complete the relative * path looking inside xapps root/base path for a valid directory. if nothing is found will throw an error. * * if you are using multiple autoloaders beware. phps native __autoload function can only be set once and if set * prior to xapp could lead to Xapp_Autoloader being useless. * * @error 10701 * @param null|string|array $dirs expects a directory path or multiple as array * @param null|mixed $options expects the class instance options * @throws Xapp_Error */ protected function __construct($dirs = null, $options = null) { xapp_init_options($options, $this); if (strnatcmp(phpversion(), '5.3.0') < 0 || !function_exists('spl_autoload_register')) { if (!function_exists('__autoload')) { function __autoload($class) { self::instance()->load($class); } } else { throw new Xapp_Error(_("xapp autoloader can not overwrite autoloading since __autoload is already set"), 1070101); } } else { @spl_autoload_register(array(get_class($this), 'load'), true); } $this->init($dirs); }
/** * class constructor set class instance options and calls parent constructor * * @error 15101 * @param null|array|object $options expects optional options */ public function __construct($options = null) { xapp_init_options($options, $this); parent::__construct(); }
/** * class constructor needs rpc server as first parameter either as instance * or driver string, e.g. "json", if empty will create default server with * "json" driver. the third parameter expects a absolute file pointer or string * of php.ini style which can also be used to define all class options and control * the behaviour of the gateway * * @error 14001 * @param null|string|Xapp_Rpc_Server $server expects on of the above explained values * @param null|array|object $options expects optional options * @param null|string $conf expects file pointer or string of gateway config */ public function __construct($server = null, $options = null, $conf = null) { if ($server instanceof Xapp_Rpc_Server) { $this->_server = $server; } else { if (is_null($server)) { $this->_server = Xapp_Rpc_Server::factory('json'); } else { $this->_server = Xapp_Rpc_Server::factory((string) $server); } } if ($options !== null) { xapp_init_options($options, $this); } if ($conf !== null) { $this->conf($conf); } $this->init(); }
/** * constructor initializes options and registers profile listeners according * to the set options * * @error 15201 * @param null|mixed $options expects optional options */ public function __construct($options = null) { xapp_init_options($options, $this); if (xapp_is_option(self::PROFILE_SQL, $this)) { Xapp_Event::listen('xapp.orm.query', function ($sql, $params, $time) { foreach ($params as $p) { $sql = preg_replace('/\\?/i', Xapp_Orm::quote($p), $sql, 1); $sql = htmlspecialchars($sql); } xapp_profile('query', $sql, $time); }); } if (xapp_is_option(self::PROFILE_ERROR, $this)) { Xapp_Event::listen('xapp.error', function ($e) { xapp_profile('error', $e); }); } if (xapp_get_option(self::MODE, $this) === 1 || xapp_get_option(self::MODE, $this) === true) { Xapp_Event::listen('xapp.shutdown', function () { xapp_profile(false); }); } }
/** * class constructor receives instance options and set error action * map if not already set. * * @error 11601 * @param null|mixed $options expects options object */ public function __construct($options = null) { if (!isset($options[self::ACTION_MAP])) { $options[self::ACTION_MAP] = array(XAPP_ERROR_IGNORE => null, XAPP_ERROR_NOTICE => self::LOG, XAPP_ERROR_WARNING => self::LOG, XAPP_ERROR_ERROR => self::LOG, XAPP_ERROR_ALERT => self::LOG | self::MAIL, XAPP_ERROR_DEBUG => self::DUMP); } xapp_init_options($options, $this); $this->init(); }
/** * class constructor sets to be searched object and class options * * @error 16701 * @param object|array $object expects the object to be searched * @param null|mixed $options expects optional options * @throws Xapp_Util_Std_Exception */ public function __construct(&$object, $options = null) { $class = get_class(); xapp_init_options($options, $class); if (is_array($object) || is_object($object)) { $this->_object =& $object; } else { throw new Xapp_Util_Std_Exception(_("passed object in constructor is not an object or array"), 1670101); } }