Load in the theme.info file for the given (or active) theme.

@param   string  $theme  Name of the theme (null for active)
@return  array   Theme info array
176262
public function load_info($theme = null)
	{
		if ($theme === null)
		{
			$theme = $this->active;
		}

		if (is_array($theme))
		{
			$path = $theme['path'];
			$name = $theme['name'];
		}
		else
		{
			$path = $this->find($theme);
			$name = $theme;
			$theme = array(
				'name' => $name,
				'path' => $path
			);
		}

		if ( ! $path)
		{
			throw new \ThemeException(sprintf('Could not find theme "%s".', $theme));
		}

		if (($file = $this->find_file($this->config['info_file_name'], array($theme))) == $this->config['info_file_name'])
		{
			if ($this->config['require_info_file'])
			{
				throw new \ThemeException(sprintf('Theme "%s" is missing "%s".', $name, $this->config['info_file_name']));
			}
			else
			{
				return array();
			}
		}

		return \Config::load($file, false, true);
	}
926347
public function add(Theme $theme)
    {
        if ($this->exists($theme->name)) {
            throw new Exceptions\themeAlreadyExists($theme);
        }
        $this->themes[] = $theme;
        return $theme;
    }
1115904
public function setTheme(string $theme): FieldTypeInterface
    {
        $this->options['theme'] = $theme;

        // Update all attached fields with the given theme.
        foreach ($this->repository->all() as $field) {
            /** @var FieldTypeInterface $field */
            $field->setTheme($theme);
        }

        // Update all attached groups with the given theme.
        foreach ($this->repository()->getGroups() as $group) {
            /** @var SectionInterface $group */
            $group->setTheme($theme);
        }

        return $this;
    }
844731
protected function getBasePath(Theme $theme = null) : string
    {
        $theme = $theme ?? $this->getTheme();

        if (isset($this->fullPaths[$theme->getKey()])) {
            return $this->fullPaths[$theme->getKey()];
        }

        return $this->fullPaths[$theme->getKey()] = $this->createPath($theme->getPath(), $this->directory);
    }
366319
public function load($template)
    {
        $path['manifest'] = $this->_buildManifestPath($template);

        if (file_exists($path['manifest'])) {

            $this->alias = $template;
            $this->thumbnail = AnRequest::root().'/templates/'.$template.'/thumbnail.png';

            $manifest = json_decode(file_get_contents($path['manifest']));

            foreach ($this->_attributes as $key => $value) {
                if (array_key_exists($key, $manifest)) {
                    $this->$key = $manifest->$key;
                }
            }

            $path['params'] = $this->_buildParamsPath($template);

            if (file_exists($path['params'])) {
                $this->params = parse_ini_file($path['params']);
            }

            return $this;
        }

        return false;
    }
890779
public function getThemeRegionConfig($theme)
    {
        $regions = variable_get('ucms_layout_regions_' . $theme, []);

        if (null === $regions) {
            $regions = array_keys(system_region_list($theme));
            $regions = array_fill_keys($regions, self::CONTEXT_PAGE);
        }

        return array_map('intval', $regions);
    }
1216106
protected function loadViewsFromTheme(Theme $theme)
    {
        $views = $theme->getViewDirectory();

        $this->loadViewsFrom($views, $theme->getName());
        $this->loadViewsFrom($views.'/boomcms', 'boomcms');
        $this->loadViewsFrom($views.'/chunks', 'boomcms.chunks');
    }
276401
protected function registerAutoload($theme)
	{
        $composer = require(base_path('vendor/autoload.php'));
        
        $class = 'Themes\\'.$theme.'\\';
        $path  = $this->path('src/');

        if (! array_key_exists($class, $composer->getClassMap())) {
            $composer->addPsr4($class, $path);
        }
	}
969712
public function getThemeConfig($theme)
	{
		Yii::import('mustangostang.spyc.Spyc');
		define('DS', DIRECTORY_SEPARATOR);

		$themeName = $this->urlTitle($theme);
		$configPath = Yii::getPathOfAlias('webroot.themes.'.$theme).DS.$themeName.'.yaml';

		if(file_exists($configPath))
			return Spyc::YAMLLoad($configPath);
		else
			return null;
	}
1261889
public static function find($theme)
    {
        $paths = App::path('Plugin');
        foreach ($paths as $path) {
            $path = FS::clean($path . '/', DS);
            $themeFolder = $path . $theme;

            if (FS::isDir($themeFolder)) {
                return $themeFolder;
            }
        }

        return Configure::read('plugins.' . $theme);
    }
696836
public function setTheme($theme)
    {
        if (!self::isValidTheme($theme)) {
            throw new Exception(
                'Theme ' . $theme . ' is not valid. Please use one of [' . join(', ', self::$themes) . ']'
            );
        }

        $this->theme = $theme;
    }
30520
public function setTheme(Theme $theme = null)
    {
        $theme_path = null;
        if ($theme) $theme_path = THEME_DIR.'/'.$theme->name;
        self::getDbConnection()->update('dir_data',array('templateDir'=>$theme_path),array('id'=>$this->id));
		$this->updateCache();
		return $this;
    }
1074043
protected function set_theme($theme = null, $type = 'active')
	{
		// set the theme if given
		if ($theme !== null)
		{
			// remove the defined theme asset paths from the asset instance
			empty($this->active['asset_path']) or $this->asset->remove_path($this->active['asset_path']);
			empty($this->fallback['asset_path']) or $this->asset->remove_path($this->fallback['asset_path']);

			$this->{$type} = $this->create_theme_array($theme);

			// add the asset paths to the asset instance
			empty($this->fallback['asset_path']) or $this->asset->add_path($this->fallback['asset_path']);
			empty($this->active['asset_path']) or $this->asset->add_path($this->active['asset_path']);
		}

		// and return the theme config
		return $this->{$type};
	}
686786
public function getThemeName($theme = null)
	{
		if (Config::get('@.THEME_ON'))
		{
			// 参数传入的主题
			if (is_string($theme) && '' !== $theme)
			{
				return $theme;
			}
			// 类设定的主题
			else if (is_string($this->theme) && '' !== $this->theme)
			{
				return $this->theme;
			}
			// 配置中默认主题
			else
			{
				return Config::get('@.THEME', null);
			}
		}
		else
		{
			return '';
		}
	}
1117940
public function update(Theme &$theme)
    {
        $data = $theme->exportData();
        $endpoint = '/admin/themes/'.$theme->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'theme' => $data
            )
        );
        $theme->setData($response['theme']);
    }
224326
public static function theme($theme = null)
    {
        if (!self::$_initialized) {
            self::init();
        }

        if ($theme !== null) {
            if (!isset(self::$_themes[$theme])) {
                throw new Exception(__d('wasabi_cms', 'Theme "{0}" does not exist.', $theme));
            }
            self::$_theme = self::$_themes[$theme];
        }

        return self::$_theme;
    }
1262961
public function absolutePath($theme = null)
    {
        if (is_null($theme)) {
            $theme = $this->getCurrent();
        }

        return $this->config['paths']['absolute'].'/'.$theme;
    }