protected function _init() { global $conf; /* Hylax Driver */ $this->gateway = Hylax_Driver::singleton($conf['fax']['driver'], $conf['fax']['params']); /* Hylax storage driver. */ $this->storage = Hylax_Storage::singleton('sql', $conf['sql']); }
function Hylax_Storage_sql($params) { parent::Hylax_Storage($params); $this->initialise(); /* Set up the storage attributes object in the $_attributes var. */ $attrib_params = array('primary_table' => 'hylax_faxes', 'attribute_table' => 'hylax_fax_attributes', 'id_column' => 'fax_id'); $this->_attributes = new Hylax_SQL_Attributes($this->_db, $attrib_params); }
/** * Attempts to return a reference to a concrete Hylax_Storage instance * based on $driver. * * It will only create a new instance if no Hylax_Storage instance with the * same parameters currently exists. * * This should be used if multiple storage sources are required. * * This method must be invoked as: $var = &Hylax_Storage::singleton() * * @param string $driver The type of concrete Hylax_Storage subclass to * return. * @param array $params A hash containing any additional configuration or * connection parameters a subclass might need. * * @return mixed The created concrete Hylax_Storage instance, or false on * error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] =& Hylax_Storage::factory($driver, $params); } return $instances[$signature]; }