Processes the icon configuration for all site tree classes and resolves resources.

@return void
559601
protected function initSiteTreeIcons()
    {
        foreach (ClassInfo::subclassesFor(SiteTree::class) as $class) {
            
            $icon = Config::inst()->get($class, 'icon');
            
            $path = ModuleResourceLoader::singleton()->resolvePath($icon);
            
            if ($path !== $icon) {
                
                $path = preg_replace('#^vendor/#i', 'resources/', $path);
                
                Config::modify()->set($class, 'icon', $path);
                
            }
            
        }
    }
1129400
protected function _process()
	{
		$this->_msg('Rebuilding catalog index for performance data', 0);

		$catalogManager = MShop_Catalog_Manager_Factory::createManager( $this->_getContext() );
		$catalogManager->getSubManager( 'index' )->rebuildIndex();

		$this->_status( 'done' );
	}
739555
public function bootstrap()
    {
        if(!$this->isBootstrapped())
        {
            $manager = $this->getObject('manager');

            /*
             * Load resources
             *
             * If cache is enabled and the bootstrapper has been run we do not reload the config resources
             */
            if(!$this->getConfig()->bootstrapped)
            {
                $factory = $this->getObject('object.config.factory');

                foreach($this->_manifests as $manifest)
                {
                    if (isset($manifest['identifier']))
                    {
                        $identifier = $manifest['identifier'];

                        if (isset($this->_components[$identifier])) {
                            throw new \RuntimeException(sprintf('Cannot re-bootstrap component: %s', $identifier));
                        }

                        //Set the path
                        $this->_components[$identifier] = $manifest['paths'];

                        //Set the namespace
                        if (isset($manifest['namespace']))
                        {
                            $namespace = $manifest['namespace'];
                            $this->_namespaces[$identifier] = array($namespace => $manifest['paths']);
                        }
                    }
                }

                foreach($this->_manifests as  $manifest)
                {
                    if (isset($manifest['extends']))
                    {
                        $extends = $manifest['extends'];

                        if (!isset($this->_components[$extends])) {
                            throw new \RuntimeException(sprintf('Component: %s not found', $extends));
                        }

                        if(isset($manifest['identifier']))
                        {
                            $identifier = $manifest['identifier'];

                            //Append paths
                            $this->_components[$identifier] = array_merge(
                                $this->_components[$identifier],
                                $this->_components[$extends]
                            );

                            //Set the namespace
                            if (isset($manifest['namespace']))
                            {
                                $namespace = $manifest['namespace'];

                                //Append the namespace
                                $this->_namespaces[$identifier] = array_merge(
                                    $this->_namespaces[$identifier],
                                    $this->_namespaces[$extends]
                                );
                            }
                        }
                        else
                        {
                            //Prepend paths
                            $this->_components[$extends] = array_merge(
                                $manifest['paths'],
                                $this->_components[$extends]
                            );

                            //Set the namespace
                            if (isset($manifest['namespace']))
                            {
                                $namespace = $manifest['namespace'];

                                //Prepend the namespace
                                $this->_namespaces[$extends] = array_merge(
                                    array($namespace => $manifest['paths']),
                                    $this->_namespaces[$extends]
                                );
                            }
                        }
                    }
                }

                $identifiers = array();
                $aliases     = array();

                foreach($this->_files as $path)
                {
                    $array = $factory->fromFile($path, false);

                    //Priority
                    if(isset($array['priority'])) {
                        $priority = $array['priority'];
                    } else {
                        $priority = self::PRIORITY_NORMAL;
                    }

                    //Aliases
                    if(isset($array['aliases']))
                    {
                        if(!isset($aliases[$priority])) {
                            $aliases[$priority] = array();
                        }

                        $aliases[$priority] = array_merge($aliases[$priority], $array['aliases']);;
                    }

                    //Identifiers
                    if(isset($array['identifiers']))
                    {
                        if(!isset($identifiers[$priority])) {
                            $identifiers[$priority] = array();
                        }

                        foreach ($array['identifiers'] as $identifier => $config)
                        {
                            if (array_key_exists($identifier, $identifiers[$priority]))
                            {
                                $existing = new ObjectConfig($identifiers[$priority][$identifier]);
                                $existing->append($config);

                                $identifiers[$priority][$identifier] = $existing->toArray();
                            }
                            else $identifiers[$priority][$identifier] = $config;
                        }
                    }
                }

                /*
                 * Set the identifiers
                 *
                 * Collect identifiers by priority and then flatten the array.
                 */
                $identifiers_flat = array();

                ksort($identifiers);
                foreach ($identifiers as $priority => $merges) {
                    $identifiers_flat = array_merge_recursive($identifiers_flat, $merges);
                }

                foreach ($identifiers_flat as $identifier => $config) {
                    $manager->setIdentifier(new ObjectIdentifier($identifier, $config));
                }

                /*
                 * Set the aliases
                 *
                 * Collect aliases by priority and then flatten the array.
                 */
                $aliases_flat = array();

                foreach ($aliases as $priority => $merges) {
                    $aliases_flat = array_merge($merges, $aliases_flat);
                }

                foreach($aliases_flat as $alias => $identifier) {
                    $manager->registerAlias($identifier, $alias);
                }

                /*
                 * Reset the bootstrapper in the object manager
                 *
                 * If cache is enabled this will prevent the bootstrapper from reloading the config resources
                 */
                $identifier = new ObjectIdentifier('lib:object.bootstrapper', array(
                    'bootstrapped' => true,
                    'directories'  => $this->_directories,
                    'components'   => $this->_components,
                    'namespaces'   => $this->_namespaces,
                    'files'        => $this->_files,
                    'aliases'      => $aliases_flat,
                ));

                $manager->setIdentifier($identifier)
                    ->setObject('lib:object.bootstrapper', $this);
            }
            else
            {
                foreach($this->_aliases as $alias => $identifier) {
                    $manager->registerAlias($identifier, $alias);
                }
            }

            /*
             * Setup the component class locator
             *
             * Locators are always setup as the  cannot be cached in the registry objects.
             */
            foreach($this->_namespaces as $identifier => $namespaces)
            {
                //Register the namespace in the component class locator
                foreach($namespaces as $namespace => $paths) {
                    $manager->getClassLoader()->getLocator('component')->registerNamespace($namespace, $paths);
                }

                //Register the namespace in the component objects locator
                $manager->getLocator('component')->registerIdentifier($identifier, array_keys($namespaces));
            }

            $this->_bootstrapped = true;
        }
    }
1282394
public function init()
    {
        if ($this->isSeoEnabled() && empty($this->seoOptions)) {
            $this->seoOptions = [
                'target' => '_blank',
                'rel'    => 'noopener',
            ];
        }

        if ($this->enableIcons || $this->enableDefaultIcons) {
            $this->icons = ArrayHelper::merge(self::DEFAULT_ICONS_MAP, $this->icons);
        }
    }
493795
protected function onReconfigure()
    {
        parent::onReconfigure();
        $this->client->resetApplication();
        $this->configureClient($this->config);
        $this->client->startApp();
    }
738704
private function processAssets()
    {
        $js = $this->assetmanager->getAssetHandler('js');

        $afh = new \Core\Asset\AssetFileHandler();
        $afh->setFilename($this->config->get('Core', 'dir.cache') . '/script.js');
        $afh->setTTL($this->config->get('Core', 'cache.ttl.js'));

        $js->setFileHandler($afh);

        $css = $this->assetmanager->getAssetHandler('css');

        $theme = $this->config->get('Core', 'style.theme.name');

        $css->addProcessor(new \Core\Asset\Processor\ReplaceProcessor('../fonts/', '../Themes/' . $theme . '/fonts/'));
        $css->addProcessor(new \Core\Asset\Processor\ReplaceProcessor('../img/', '../Themes/' . $theme . '/img/'));

        $afh = new \Core\Asset\AssetFileHandler();
        $afh->setFilename($this->config->get('Core', 'dir.cache') . '/style.css');
        $afh->setTTL($this->config->get('Core', 'cache.ttl.css'));

        $css->setFileHandler($afh);

        foreach ($this->apps as $app) {
            foreach ($app->javascript as $aio) {
                $js->addObject($aio);
            }

            foreach ($app->css as $aio) {
                $css->addObject($aio);
            }
        }

        // Process assets
        $this->assetmanager->process();
    }
1202823
protected static function bootDefaultTheme()
    {
        $resolver = static::getDatasourceResolver();
        if ($resolver->getDefaultDatasource()) {
            return;
        }

        $defaultTheme = App::runningInBackend()
            ? Theme::getEditThemeCode()
            : Theme::getActiveThemeCode();

        Theme::load($defaultTheme);

        $resolver->setDefaultDatasource($defaultTheme);
    }
379158
protected function process()
    {

        // initialize the array for the links
        $artefacts = array();

        // load the link type mappings
        $linkTypes = $this->getLinkTypeMappings();

        // prepare the links for the found link types and merge the found artefacts
        foreach ($linkTypes as $linkTypeCode => $columns) {
            $artefacts = array_merge($artefacts, $this->prepareArtefacts($linkTypeCode, $columns));
        }

        // append the links to the subject
        $this->addArtefacts($artefacts);
    }
1095055
public function init()
    {
        if (null === $this->twig) {
            /** @var Config $config */
            $config = $this->grav['config'];
            /** @var UniformResourceLocator $locator */
            $locator = $this->grav['locator'];
            /** @var Language $language */
            $language = $this->grav['language'];

            $active_language = $language->getActive();

            // handle language templates if available
            if ($language->enabled()) {
                $lang_templates = $locator->findResource('theme://templates/' . ($active_language ? $active_language : $language->getDefault()));
                if ($lang_templates) {
                    $this->twig_paths[] = $lang_templates;
                }
            }

            $this->twig_paths = array_merge($this->twig_paths, $locator->findResources('theme://templates'));

            $this->grav->fireEvent('onTwigTemplatePaths');

            // Add Grav core templates location
            $core_templates = array_merge($locator->findResources('system://templates'), $locator->findResources('system://templates/testing'));
            $this->twig_paths = array_merge($this->twig_paths, $core_templates);

            $this->loader = new \Twig_Loader_Filesystem($this->twig_paths);

            // Register all other prefixes as namespaces in twig
            foreach ($locator->getPaths('theme') as $prefix => $_) {
                if ($prefix === '') {
                    continue;
                }

                $twig_paths = [];

                // handle language templates if available
                if ($language->enabled()) {
                    $lang_templates = $locator->findResource('theme://'.$prefix.'templates/' . ($active_language ? $active_language : $language->getDefault()));
                    if ($lang_templates) {
                        $twig_paths[] = $lang_templates;
                    }
                }

                $twig_paths = array_merge($twig_paths, $locator->findResources('theme://'.$prefix.'templates'));

                $namespace = trim($prefix, '/');
                $this->loader->setPaths($twig_paths, $namespace);
            }

            $this->grav->fireEvent('onTwigLoader');

            $this->loaderArray = new \Twig_Loader_Array([]);
            $loader_chain = new \Twig_Loader_Chain([$this->loaderArray, $this->loader]);

            $params = $config->get('system.twig');
            if (!empty($params['cache'])) {
                $cachePath = $locator->findResource('cache://twig', true, true);
                $params['cache'] = new \Twig_Cache_Filesystem($cachePath, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION);
            }

            if (!$config->get('system.strict_mode.twig_compat', true)) {
                // Force autoescape on for all files if in strict mode.
                $params['autoescape'] = 'html';
            } elseif (!empty($this->autoescape)) {
                $params['autoescape'] = $this->autoescape ? 'html' : false;
            }

            if (empty($params['autoescape'])) {
                user_error('Grav 2.0 will have Twig auto-escaping forced on (can be emulated by turning off \'system.strict_mode.twig_compat\' setting in your configuration)', E_USER_DEPRECATED);
            }

            $this->twig = new TwigEnvironment($loader_chain, $params);

            if ($config->get('system.twig.undefined_functions')) {
                $this->twig->registerUndefinedFunctionCallback(function ($name) {
                    if (function_exists($name)) {
                        return new \Twig_SimpleFunction($name, $name);
                    }

                    return new \Twig_SimpleFunction($name, function () {
                    });
                });
            }

            if ($config->get('system.twig.undefined_filters')) {
                $this->twig->registerUndefinedFilterCallback(function ($name) {
                    if (function_exists($name)) {
                        return new \Twig_SimpleFilter($name, $name);
                    }

                    return new \Twig_SimpleFilter($name, function () {
                    });
                });
            }

            $this->grav->fireEvent('onTwigInitialized');

            // set default date format if set in config
            if ($config->get('system.pages.dateformat.long')) {
                /** @var \Twig_Extension_Core $extension */
                $extension = $this->twig->getExtension('Twig_Extension_Core');
                $extension->setDateFormat($config->get('system.pages.dateformat.long'));
            }
            // enable the debug extension if required
            if ($config->get('system.twig.debug')) {
                $this->twig->addExtension(new \Twig_Extension_Debug());
            }
            $this->twig->addExtension(new TwigExtension());
            $this->twig->addExtension(new DeferredExtension());

            $this->grav->fireEvent('onTwigExtensions');

            /** @var Pages $pages */
            $pages = $this->grav['pages'];

            // Set some standard variables for twig
            $this->twig_vars += [
                    'config'            => $config,
                    'system'            => $config->get('system'),
                    'theme'             => $config->get('theme'),
                    'site'              => $config->get('site'),
                    'uri'               => $this->grav['uri'],
                    'assets'            => $this->grav['assets'],
                    'taxonomy'          => $this->grav['taxonomy'],
                    'browser'           => $this->grav['browser'],
                    'base_dir'          => rtrim(ROOT_DIR, '/'),
                    'home_url'          => $pages->homeUrl($active_language),
                    'base_url'          => $pages->baseUrl($active_language),
                    'base_url_absolute' => $pages->baseUrl($active_language, true),
                    'base_url_relative' => $pages->baseUrl($active_language, false),
                    'base_url_simple'   => $this->grav['base_url'],
                    'theme_dir'         => $locator->findResource('theme://'),
                    'theme_url'         => $this->grav['base_url'] . '/' . $locator->findResource('theme://', false),
                    'html_lang'         => $this->grav['language']->getActive() ?: $config->get('site.default_lang', 'en'),
                    'language_codes'    => new LanguageCodes,
                ];
        }

        return $this;
    }
1010835
protected function process()
    {

        // clean-up the repositories etc. to free memory
        $this->getCustomerAddressBunchProcessor()->cleanUp();

        // temporary persist the last customer address entity ID
        $this->setLastEntityId($this->getValue(ColumnKeys::ENTITY_ID));
    }
433999
public function process()
	{
		$view = $this->getView();
		$context = $this->getContext();
		$config = $context->getConfig();
		$session = $context->getSession();

		$name = $config->get( 'client/html/locale/select/currency/param-name', 'currency' );

		if( ( $currencyId = $view->param( $name ) ) !== null ) {
			$session->set( 'aimeos/locale/currencyId', $currencyId );
		}

		parent::process();
	}
1021006
protected function process()
    {

        // query whether or not, the image changed
        if ($this->isParentImage($this->getValue(ColumnKeys::IMAGE_PATH))) {
            return;
        }

        // try to load the product SKU and map it the entity ID
        $this->parentId = $this->getValue(ColumnKeys::IMAGE_PARENT_SKU, null, array($this, 'mapParentSku'));

        // reset the position counter for the product media gallery value
        $this->resetPositionCounter();

        // initialize and persist the product media gallery
        $productMediaGallery = $this->initializeProductMediaGallery($this->prepareProductMediaGalleryAttributes());
        $this->valueId = $this->persistProductMediaGallery($productMediaGallery);

        // persist the product media gallery to entity data
        if ($productMediaGalleryValueToEntity = $this->initializeProductMediaGalleryValueToEntity($this->prepareProductMediaGalleryValueToEntityAttributes())) {
            $this->persistProductMediaGalleryValueToEntity($productMediaGalleryValueToEntity);
        }

        // temporarily persist parent/value ID
        $this->setParentId($this->parentId);
        $this->setParentValueId($this->valueId);
    }
528245
protected function prepareResources()
    {
        // Publish config
        $config = realpath(__DIR__.'/../config/config.php');

        $this->mergeConfigFrom($config, 'cartalyst.sentinel');

        $this->publishes([
            $config => config_path('cartalyst.sentinel.php'),
        ], 'config');

        // Publish migrations
        $migrations = realpath(__DIR__.'/../migrations');

        $this->publishes([
            $migrations => $this->app->databasePath().'/migrations',
        ], 'migrations');
    }
4920
private function configureDirs()
    {
        // Configure dirs from environment variables and composer extra values.
        foreach ($this->resolver->names() as $name) {
            $default = $this->resolver->raw($name);
            $path = $this->options->get($name . '-dir', $default);
            if ($path !== $default) {
                $this->verbose("Setting <info>$name</> path to <info>$path</>.");
                $this->resolver->define($name, $path);
            }
        }

        if ($this->io->confirm("Do you want to use Bolt's standard folder structure?")) {
            return;
        }

        (new PathCustomizer($this->resolver, $this->io))->run();

        $this->io->writeln("\n<info>Customizing!</info>\n");
    }
814804
protected function handlePATCH()
    {
        if (!empty($this->resource)) {
            if ($this->request->getParameterAsBool(ApiOptions::REGENERATE)) {
                /** @var AppModel $appClass */
                $appClass = static::$model;
                $app = $appClass::find($this->resource)->first();
                $app->api_key = $appClass::generateApiKey($app->name);
                $app->save();
            }
        }

        return parent::handlePATCH();
    }
143095
protected function _process()
	{
		$this->_msg('Rebuilding catalog index for demo data', 0);

		MShop_Factory::createManager( $this->_additional, 'catalog/index' )->rebuildIndex();

		$this->_status( 'done' );
	}
383641
public function compile()
	{
		$this->rrmdir($this->config['dir']['site']);
		$this->compilePosts();
		$this->compilePages();
		$this->compileCategories();
		$this->compileAssets();
		$this->compilePaginations();
		$this->compileAuthors();
	}