banner)) { throw new \Exception('Banner asset not found'); } self::$theme_data->banner_url = asset('themes/' . self::$theme_data->name . '/' . self::$theme_data->banner); self::$theme_data->inline_rules = ''; foreach (self::$theme_data->rules as $key => $value) { self::$theme_data->inline_rules .= $key . ': ' . $value . ' !important;'; } if (isset(self::$theme_data->icon)) { if (!file_exists($path . '/' . self::$theme_data->icon->asset)) { throw new \Exception('Icon asset not found'); } self::$theme_data->icon->url = asset('themes/' . self::$theme_data->name . '/' . self::$theme_data->icon->asset); self::$theme_data->icon->inline_rules = new \stdClass(); self::$theme_data->icon->inline_rules->base = ''; foreach (self::$theme_data->icon->base as $key => $value) { self::$theme_data->icon->inline_rules->base .= $key . ': ' . $value . ' !important;'; } self::$theme_data->icon->inline_rules->img = ''; foreach (self::$theme_data->icon->img as $key => $value) { self::$theme_data->icon->inline_rules->img .= $key . ': ' . $value . ' !important;'; } } if (isset(self::$theme_data->accessory)) { if (!file_exists($path . '/' . self::$theme_data->accessory->asset)) { throw new \Exception('Icon asset not found'); } self::$theme_data->accessory->url = asset('themes/' . self::$theme_data->name . '/' . self::$theme_data->accessory->asset); self::$theme_data->accessory->inline_rules = new \stdClass(); self::$theme_data->accessory->inline_rules->base = ''; foreach (self::$theme_data->accessory->base as $key => $value) { self::$theme_data->accessory->inline_rules->base .= $key . ': ' . $value . ' !important;'; } self::$theme_data->accessory->inline_rules->img = ''; foreach (self::$theme_data->accessory->img as $key => $value) { self::$theme_data->accessory->inline_rules->img .= $key . ': ' . $value . ' !important;'; } } } catch (\Exception $e) { throw $e; } } /** * @return mixed * @throws \Exception */ public static function data() { try { return self::$theme_data; } catch (\Exception $e) { throw $e; } } /** * @return bool */ public static function ready() { return (is_object(self::$theme_data)); } /** * @return array * @throws \Exception */ public static function list() { try { $result = []; $folders = scandir(public_path() . '/themes'); foreach ($folders as $folder) { if (((substr($folder, 0, 1)) !== '.') && (is_dir(public_path() . '/themes/' . $folder))) { $result[] = $folder; } } return $result; } catch (\Exception $e) { throw $e; } } }