public function getCurrencies($codes = null) { $runtime_cache = new waRuntimeCache('shop_currencies'); if ($runtime_cache->isCached()) { $data = $runtime_cache->get(); } else { $data = array(); if ($cache = wa('shop')->getCache()) { $data = $cache->get('currencies'); } if (!$data) { $data = array(); $primary = $this->getPrimaryCurrency(); $currencies = waCurrency::getAll(true); foreach ($this->query("SELECT * FROM " . $this->table . " ORDER BY sort") as $c) { $code = $c['code']; if (isset($currencies[$code])) { $c['rate'] = (double) $c['rate']; $data[$code] = $currencies[$code] + $c; $data[$code]['is_primary'] = $primary == $code; } } if (!empty($cache)) { $cache->set('currencies', $data, 86400); } } $runtime_cache->set($data); } if ($codes) { $result = array(); foreach ((array) $codes as $code) { if (isset($data[$code])) { $result[$code] = $data[$code]; } } return $result; } else { return $data; } }
public function getAuth() { $cache = new waRuntimeCache('wa-config/auth'); if ($cache->isCached()) { return $cache->get(); } else { $data = $this->getConfigFile('auth'); $cache->set($data); return $data; } }