public function get($name, $default = false) { $cacheKey = 'option_' . md5($name); if (isset($this->notoption[$name])) { if ($default) { return $default; } return false; } if (isset($this->autoload[$name])) { $value = $this->autoload[$name]; } else { if (false !== ($cachedOption = $this->getCached($name))) { $value = $cachedOption; } else { if (Cache::tags('options')->has($cacheKey)) { $value = Cache::tags('options')->get($cacheKey); } else { $query = $this->option->findBy('option_name', $name); if ($query) { $value = $query->option_value; $this->cache($name, $value); Cache::tags('options')->put($cacheKey, $value, $this->get('options_cache_expires', 60)); } else { $this->notoption[$name] = true; if ($default) { return $default; } return false; } } } } return unjsonizeMaybe($value); }
public function getByMid($metaType, $metaId) { if (!$metaType || !is_numeric($metaId)) { return false; } $metaId = abs((int) $metaId); if (!$metaId) { return false; } if (!($repositoryClassInstance = $this->metaRepoExists($metaType))) { return false; } $meta = $this->{$repositoryClassInstance}->find($metaId); if (!count($meta)) { return false; } if (isset($meta->meta_value)) { $meta->meta_value = unjsonizeMaybe($meta->meta_value); } return $meta; }