public function __construct() { parent::__construct(); $this->table = user_table; $this->auth_name = user_auth_name; $this->session = Load::helper('session'); $this->cookie = Load::helper('cookie'); $this->initUser(); }
public function __construct($params = array()) { $this->host = isset($params['host']) ? $params['host'] : database_host; $this->username = isset($params['username']) ? $params['username'] : database_username; $this->password = isset($params['password']) ? $params['password'] : database_password; $this->database = isset($params['database']) ? $params['database'] : database_database; $this->charset = isset($params['charset']) ? $params['charset'] : database_charset; $this->return_in_object = database_return_in_object; $this->table = isset($params['table']) ? $params['table'] : null; $this->id = isset($params['id']) ? $params['id'] : null; $this->fcache = Load::helper('cache', array('dir' => 'sql')); $this->default_cache_time = -2; $this->default_use_mcache = isset($params['default_use_mcache']) ? $params['default_use_mcache'] : database_default_use_mcache; $this->default_use_scache = isset($params['default_use_scache']) ? $params['default_use_scache'] : database_default_use_scache; $this->session = $this->default_use_scache ? Load::helper('session') : null; $this->cached_data = $this->default_use_scache ? $this->session->get('db_cached_data') : array(); $this->reset_vars(); }
public function get($address, $options = array()) { $url = 'http://maps.googleapis.com/maps/api/geocode/json?address='; $url .= urlencode($address); foreach ($this->options as $k => $v) { if (isset($this->options[$k])) { $v = $this->options[$k]; } $url .= '&' . $k . '=' . $v; } foreach ($options as $k => $v) { if (isset($options[$k])) { $v = $options[$k]; } $url .= '&' . $k . '=' . $v; } $url .= '&sensor=false'; $curl = Load::helper('curl'); $response_json = $curl->get($url); $response = json_decode($response_json, true); return $response['status'] == 'OK' ? $response : false; }