Setup application theme.

@return  void
348504
protected function _setTheme()
    {
        $theme = $this->request->getParam('theme');
        if ($theme) {
            $this->viewBuilder()->setTheme($theme);
        }
    }
29671
public function main()
    {
        # The theme is activated.
        # Location: Resources/Themes/Default/
        Theme::active('Default');
        
        # The current settings are being configured.
        Masterpage::headPage('Sections/head')
                  ->bodyPage('Sections/body')
                  ->browserIcon(FILES_DIR . 'favicon.ico')
                  ->backgroundImage(FILES_DIR . 'background.jpg');
    }
744080
protected function loadThemes()
    {
        $themesDirs = array(
            __DIR__.'/../../data/themes/Ladybug/Theme',
            __DIR__.'/../../../ladybug-themes/Ladybug/Theme'
        );

        foreach ($themesDirs as $dir) {
            if (is_dir($dir)) {
                $finder = new Finder();
                $finder->in($dir)->files()->depth(1)->name('*Theme.php');

                foreach ($finder as $file) {
                    /** @var SplFileInfo $file */
                    $this->registerTheme($file);
                }
            }
        }
    }
1281470
public function setUp()
    {
        if ($this->resource) {
            $this->stub = 'controller/resource';
        } elseif ($this->scaffold) {
            $this->stub = 'controller/scaffold';
            $this->scaffolder = new ControllerScaffolder($this->getClass(), $this->getPrefix());
        }
    }
818653
public function setup()
    {
        $this->di->set('config', $this->config);

        $this->initEnvironment($this->config);
        $this->initErrorHandler($this->config);
        $this->initLoader($this->config);
        $this->initModules($this->config);
        $this->initRoutes($this->config);
        $this->initServices($this->config);
        $this->initDispatcher();

        $this->application->setDI($this->di);
        DI::setDefault($this->di);

        return $this;
    }
372751
public function setup()
    {
        if (!$this->_checkRequestType('jsonapi')) {
            return;
        }

        $appClass = Configure::read('App.namespace') . '\Application';

        // If `App\Application` class exists it means Cake 3.3's PSR7 middleware
        // implementation is used and it's too late to register new error handler.
        if (!class_exists($appClass, false)) {
            $this->registerExceptionHandler();
        }
    }
156934
public function configure()
    {
        $name = $this->current();
        $config = $this->config;

        $this->loadConfiguration($name, $config);

        /** @var UniformResourceLocator $locator */
        $locator = $this->grav['locator'];

        $registered = stream_get_wrappers();

        $schemes = $config->get("themes.{$name}.streams.schemes", []);
        $schemes += [
            'theme' => [
                'type' => 'ReadOnlyStream',
                'paths' => $locator->findResources("themes://{$name}", false)
            ]
        ];

        foreach ($schemes as $scheme => $config) {
            if (isset($config['paths'])) {
                $locator->addPath($scheme, '', $config['paths']);
            }
            if (isset($config['prefixes'])) {
                foreach ($config['prefixes'] as $prefix => $paths) {
                    $locator->addPath($scheme, $prefix, $paths);
                }
            }

            if (\in_array($scheme, $registered, true)) {
                stream_wrapper_unregister($scheme);
            }
            $type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
            if ($type[0] !== '\\') {
                $type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type;
            }

            if (!stream_wrapper_register($scheme, $type)) {
                throw new \InvalidArgumentException("Stream '{$type}' could not be initialized.");
            }
        }

        // Load languages after streams has been properly initialized
        $this->loadLanguages($this->config);
    }
312095
public static function loadThemes()
    {
        $themesFolder = new Folder(ROOT . DS . 'themes');
        $themes = $themesFolder->read()[0];
        $loader = require ROOT . DS . 'vendor' . DS . 'autoload.php';
        foreach ($themes as $theme) {
            $loader->addPsr4('WasabiTheme\\' . $theme . '\\', [$themesFolder->path . DS . $theme . DS . 'src']);
            Plugin::load('WasabiTheme/' . $theme, [
                'path' => $themesFolder->path . DS . $theme . DS,
                'bootstrap' => true,
                'routes' => false
            ]);
        }
    }
491293
protected function loadThemer()
    {
        $app = app();

        $this->styles     = $app->make(Styles::class);
        $this->scripts    = $app->make(Scripts::class);

        if (method_exists($this, 'share')) {
            $this->share([
                 'styles'  => $this->styles,
                 'scripts' => $this->scripts,
                 'images'  => $app->make(Images::class),
             ]);
        }
    }
139389
public function main_init() {
		if ( $this->_initialized ) {
			return;
		}
		$this->_initialized = true;

		$this->filter->do_action( 'app_initialize', $this );
		$this->setup_property();
		$this->setup_textdomain();
		$this->setup_settings();
		$this->filter->do_action( 'app_initialized', $this );
	}
760733
public function reload_theme() {
        if (!is_null($this->_theme)) {
            $this->_theme = theme_config::load($this->_theme->name);
        }
    }
1045340
protected function setUp()
    {
        if (empty($this->asset)) {
            return;
        }

        $this->asset = $this->normalizePath($this->asset);
        $this->realPath = $this->locateResource();

        // The asset has not been located, so the full path is the asset itself
        if (null === $this->realPath) {
            $this->realPath = $this->asset;
        }
        $this->absolutePath = $this->retrieveBundleWebFolder();
    }
87726
public function init()
    {
        // Check filepath
        if (empty($this->filepath)) {
            return;
        }

        // Get configurations
        $configs = include $this->filepath;

        // Check
        if (empty($configs)) {
            return;
        }

        // Iterate on configs
        foreach ($configs as $key => $props) {
            $props = !is_array($props) && !is_bool($props) ? [$props] : $props;

            if ('post_type' === $key) {
                // Add or Remove post type supports
                $this->addRemovePostTypeSupport($props);
            } else {
                // Add new theme supports
                $this->addRemoveThemeSupport($key, $props);
            }
        }
    }
6404
public function boot()
    {
        $manager = new ThemeManager($this->app['files'], $this->app[Template::class], $this->app['cache.store']);

        $this->app->singleton('boomcms.template.manager', function () use ($manager) {
            return $manager;
        });

        $this->themes = $manager->getInstalledThemes();

        foreach ($this->themes as $theme) {
            // Merge the configuration in the theme's src/config/boomcms.php file
            Config::merge($theme->getConfigDirectory().DIRECTORY_SEPARATOR.'boomcms.php');
        }

        foreach ($this->themes as $theme) {
            $this->loadViewsFromTheme($theme);
            $theme->init();
        }
    }
1104486
public function configure()
    {
        // environment
        $this->setEnv($this->getEnvFromEnvironmentVariables());

        // application root dir.
        $this->config('directory.root', dirname(dirname(__DIR__)));
        
        // application dir.
        $this->addAppPathUsePsr4(__DIR__, __NAMESPACE__, 'Samurai\\', self::PRIORITY_LOW);

        // set directory names.
        $this->config('directory.config.samurai', 'Config/Samurai');
        $this->config('directory.config.routing', 'Config/App');
        $this->config('directory.config.database', 'Config/Database');
        $this->config('directory.config.renderer', 'Config/Renderer');
        $this->config('directory.controller', 'Controller');
        $this->config('directory.model', 'Model');
        $this->config('directory.filter', 'Filter');
        $this->config('directory.layout', 'View/Layout');
        $this->config('directory.template', 'View');
        $this->config('directory.database.data', 'Database');
        $this->config('directory.database.migration', 'Database/Migration');
        $this->config('directory.database.seed', 'Database/Seed');
        $this->config('directory.database.schema', 'Database/Schema');
        $this->config('directory.locale', 'Locale');
        $this->config('directory.task', 'Task');
        $this->config('directory.spec', 'Spec');
        $this->config('directory.skeleton', 'Skeleton');
        $this->config('directory.log', 'Log');
        $this->config('directory.temp', 'Temp');

        // controllers
        $this->config('controller.namespaces', ['Samurai\Samurai']);
        
        // main dicon
        $this->config('container.dicon.', 'Config/Samurai/samurai.dicon');

        // set encodings.
        $this->config('encoding.input', 'UTF-8');
        $this->config('encoding.output', 'UTF-8');
        $this->config('encoding.internal', 'UTF-8');
        $this->config('encoding.text.html', 'UTF-8');

        // set caches.
        $this->config('cache.yaml.enable', true);
        $this->config('cache.yaml.expire', 60 * 60 * 24);    // 1 day
        
        // timezone.
        $this->config('locale', 'ja');
        $this->setTimezone('Asia/Tokyo');
        
        // autoload by samurai
        $loader = new Loader($this);
        $loader->register();
        $this->loader = $loader;
    }
618970
public static function setup_theme() {

		global $pagenow;

		if ( ( is_admin() && 'themes.php' == $pagenow ) || ! self::can_switch_themes() ) {
			return;
		}

		self::check_reset();
		self::load_cookie();

		if ( empty( self::$theme ) ) {
			return;
		}

		add_filter( 'pre_option_template', array( self::$theme, 'get_template' ) );
		add_filter( 'pre_option_stylesheet', array( self::$theme, 'get_stylesheet' ) );
		add_filter( 'pre_option_stylesheet_root', array( self::$theme, 'get_theme_root' ) );
		$parent = self::$theme->parent();
		add_filter( 'pre_option_template_root', array( empty( $parent ) ? self::$theme : $parent, 'get_theme_root' ) );
		add_filter( 'pre_option_current_theme', '__return_false' );
	}
304599
private function loadTheme()
    {
        if ($this->isThemeCacheValid()) {
            return;
        }
        $this->invalidateCache();

        $themeDir = $this->app['filesystem']->getDir('themes://' . $this->get('general/theme'));

        $this->data['theme'] = $this->parseTheme($themeDir, $this->data['general']);
    }