public function get($key, $option_group = false, $return_full = false, $orderby = false, $module = false)
{
if ($option_group != false) {
$cache_group = 'options/' . $option_group;
} else {
$cache_group = 'options/global';
}
if ($this->options_memory == null) {
$this->options_memory = array();
}
if (isset($this->override_memory[$option_group]) and isset($this->override_memory[$option_group][$key])) {
return $this->override_memory[$option_group][$key];
}
$function_cache_id = false;
$args = func_get_args();
foreach ($args as $k => $v) {
$function_cache_id = $function_cache_id . serialize($k) . serialize($v);
}
$function_cache_id = 'option_' . __FUNCTION__ . '_' . $option_group . '_' . crc32($function_cache_id);
if (isset($this->options_memory[$function_cache_id])) {
return $this->options_memory[$function_cache_id];
}
$table = $this->tables['options'];
$data = array();
if (is_array($key)) {
$data = $key;
} else {
$data['option_key'] = $key;
}
$option_key_1 = '';
$option_key_2 = '';
if ($option_group != false) {
$option_group = $this->app->database_manager->escape_string($option_group);
$data['option_group'] = $option_group;
}
if ($module != false) {
$module = $this->app->database_manager->escape_string($module);
$data['module'] = $module;
}
$data['limit'] = 1;
$ok = $this->app->database_manager->escape_string($data['option_key']);
$filter = array();
// $filter['limit'] = 1;
$filter['option_key'] = $key;
if ($option_group != false) {
$filter['option_group'] = $option_group;
}
if ($module != false) {
$filter['module'] = $module;
}
$filter['table'] = $table;
$get_all = mw()->database_manager->get($filter);
if (!is_array($get_all)) {
return false;
}
$get = array();
foreach ($get_all as $get_opt) {
if (isset($get_opt['option_key']) and $key == $get_opt['option_key']) {
$get[] = $get_opt;
}
}
if (!empty($get)) {
if ($return_full == false) {
if (!is_array($get)) {
return false;
}
$get = $get[0]['option_value'];
if (isset($get['option_value']) and strval($get['option_value']) != '') {
$get['option_value'] = $this->app->url_manager->replace_site_url_back($get['option_value']);
}
$this->options_memory[$function_cache_id] = $get;
return $get;
} else {
$get = $get[0];
if (isset($get['option_value']) and strval($get['option_value']) != '') {
$get['option_value'] = $this->app->url_manager->replace_site_url_back($get['option_value']);
}
if (isset($get['field_values']) and $get['field_values'] != false) {
$get['field_values'] = unserialize(base64_decode($get['field_values']));
}
$this->options_memory[$function_cache_id] = $get;
return $get;
}
} else {
$this->options_memory[$function_cache_id] = false;
return false;
}
}