Sets symbolic links for vendor assets to be created
@return array
482804
protected function setVendorLinks()
    {
        $links = array_unique(array_merge(Configure::read('VENDOR_LINKS', []), [
            'npm-asset' . DS . 'js-cookie' . DS . 'src' => 'js-cookie',
            'sunhater' . DS . 'kcfinder' => 'kcfinder',
            'enyo' . DS . 'dropzone' . DS . 'dist' => 'dropzone',
        ]));

        return Configure::write('VENDOR_LINKS', $links) ? $links : false;
    }
954904
private static function buildLinksTags() :string {
		// this is where formatted links tags go
		$links = [];
		// pack and minify
		self::packAndMinifyLinks();
		// for each available link
		foreach(self::$_links as $href => $attributes) {
			// sort the attributes (compulse order needs)
			ksort($attributes);
			// build as base stylesheet link and merge its attributes
			$links[] = new \Polyfony\Element('link', $attributes);
		}
		return implode('', $links);
	}
18753
public function set_assets() {

		$this->assets['style']['metabox']   = $this->url . 'assets/css/metabox' . UIX_ASSET_DEBUG . '.css';
		$this->assets['script']['baldrick'] = [
			'src'  => $this->url . 'assets/js/jquery.baldrick' . UIX_ASSET_DEBUG . '.js',
			'deps' => [ 'jquery' ],
		];
		parent::set_assets();
	}
805212
protected function registerAssetPublisher(): void
    {
        $this->app->singleton('asset.publisher', function (Application $app) {
            $publicPath = $app->publicPath();

            // The asset "publisher" is responsible for moving package's assets into the
            // web accessible public directory of an application so they can actually
            // be served to the browser. Otherwise, they would be locked in vendor.
            $publisher = new Asset($app->make('files'), $publicPath);

            $publisher->setPackagePath($app->basePath().'/vendor');

            return $publisher;
        });
    }
323725
private function prepareAssets()
	{
		$lib = $this;
		$attached_groups = $this->getAttachedGroups();
		array_walk($lib->attached_groups, function($group_name) use($lib){
			$groups = $lib->getGroups();
			$group_contents = $groups[$group_name];
			array_walk($group_contents, function($value, $key) use($lib, $group_name){
				switch($key)
				{
					case 'css':
					array_walk($value, function($value, $key) use($lib, $group_name){
						$lib->registerCss($group_name.'/'.$value,$group_name);
					});
					break;
					case 'js':
					array_walk($value, function($value, $key) use($lib, $group_name){
						$lib->registerJs($group_name.'/'.$value,$lib->getOption('jsPosition'),$group_name);
					});
					break;
				}
			});
		});
		return $this;
	}
929789
protected function generateLinkMetaTags()
    {
        $rootLine = GeneralUtility::getRootLine();

        $currentPage = end($rootLine);
        $rootPage    = reset($rootLine);

        $currentIsRootpage = ($currentPage['uid'] === $rootPage['uid']);

        // Only generate up, prev and next if NOT rootpage
        // to prevent linking to other domains
        // see https://github.com/webdevops/TYPO3-metaseo/issues/5
        if (!$currentIsRootpage) {
            $startPage = $GLOBALS['TSFE']->cObj->cObjGetSingle('HMENU', $this->tsSetupSeo['sectionLinks.']['start.']);
            $startPageUrl = null;
            if (!empty($startPage)) {
                $startPageUrl = $this->generateLink($startPage);
            }

            $prevPage =  $GLOBALS['TSFE']->cObj->cObjGetSingle('HMENU', $this->tsSetupSeo['sectionLinks.']['prev.']);
            $prevPageUrl = null;
            if (!empty($prevPage)) {
                $prevPageUrl = $this->generateLink($prevPage);
            }

            $nextPage =  $GLOBALS['TSFE']->cObj->cObjGetSingle('HMENU', $this->tsSetupSeo['sectionLinks.']['next.']);
            $nextPageUrl = null;
            if (!empty($nextPage)) {
                $nextPageUrl = $this->generateLink($nextPage);
            }
        }

        // Start (first page in rootline -> root page)
        if (!empty($startPageUrl)) {
            $this->metaTagList['link.rel.start'] = array(
                'tag'        => 'link',
                'attributes' => array(
                    'rel'  => 'start',
                    'href' => $startPageUrl,
                ),
            );
        }

        // Prev (previous page in rootline)
        if (!empty($prevPageUrl)) {
            $this->metaTagList['link.rel.prev'] = array(
                'tag'        => 'link',
                'attributes' => array(
                    'rel'  => 'prev',
                    'href' => $prevPageUrl,
                ),
            );
        }

        // Next (next page in rootline)
        if (!empty($nextPageUrl)) {
            $this->metaTagList['link.rel.next'] = array(
                'tag'        => 'link',
                'attributes' => array(
                    'rel'  => 'next',
                    'href' => $nextPageUrl,
                ),
            );
        }
    }
617197
protected function getAssetVersions() {
        if (!$this->_assetVersions) {
            $this->_assetVersions = new AssetVersionList(
                $this->version,
                $this->solution['serviceSid'],
                $this->solution['sid']
            );
        }

        return $this->_assetVersions;
    }
697078
protected function _createsymlinks($check = false) {
		$this->out(__d('cake_installer', 'Creating symbolic links to files'));
		$this->hr();

		$resultCheck = $this->InstallerCheck->checkSymLinksExists();
		if ($resultCheck) {
			if ($check) {
				$this->out('<success>' . __d('cake_installer', 'This action has already been successfully completed. Skipped.') . '</success>');

				return true;
			} elseif ($this->useActionNotify) {
				if (!$this->_checkSure(__d('cake_installer', 'All symbolic links to files exists. Rewrite?'))) {
					return true;
				}
			}
		}

		$symlinksList = $this->ConfigInstaller->getListSymlinksCreation();
		if (empty($symlinksList)) {
			$this->out('<info>' . __d('cake_installer', 'List of symbolic links is empty') . '</info>');

			return true;
		}

		$this->waiting->animateMessage();
		$truncateOpt = [
			'ellipsis' => '...',
			'exact' => true,
			'html' => false
		];
		$result = true;
		$messages = [];
		foreach ($symlinksList as $link => $target) {
			if (empty($link)) {
				continue;
			}

			$badTarget = ((empty($target) || !file_exists($target)) ? true : false);
			$linkExists = false;
			if (file_exists($link)) {
				if (is_link($link) && (stripos(readlink($link), $target) === 0)) {
					$linkExists = true;
				} else {
					if (is_dir($link)) {
						//@codingStandardsIgnoreStart
						@rmdir($link);
						//@codingStandardsIgnoreEnd
					} else {
						unlink($link);
					}
				}
			}

			//@codingStandardsIgnoreStart
			if ($linkExists || (!$badTarget && @symlink($target, $link))) {
				//@codingStandardsIgnoreEnd
				$state = '<success>' . __d('cake_installer', 'Ok') . '</success>';
			} else {
				$state = '<error>' . __d('cake_installer', 'Bad') . '</error>';
				$result = false;
			}

			$state = '[' . $state . ']';
			$message = ' * ' . CakeText::truncate($link, $this->maxWidth - 12, $truncateOpt);
			$messages[] = $this->state->getState($message, $state, $this->maxWidth - 1);
			$this->waiting->animateMessage();
		}
		if (empty($messages)) {
			$messages[] = '<info>' . __d('cake_installer', 'List of symbolic links is empty') . '</info>';
		}

		$this->waiting->hideMessage();
		$this->out($messages, 1);
		$this->hr();
		if ($result) {
			$this->out('<success>' . __d('cake_installer', 'Creating symbolic links completed successfully.') . '</success>');
		} else {
			$this->out('<error>' . __d('cake_installer', 'Creating symbolic links unsuccessfully.') . '</error>');
		}

		return $result;
	}
1323811
protected function paths()
    {
        $paths = array('APPPATH' => $this->constants['APPPATH']);

        $paths['VENDOR'] = $this->constants['VENDOR'];

        $paths['VIEWPATH'] = $this->constants['VIEWPATH'];

        foreach ((array) $paths as $key => $value) {
            $defined = defined($key);

            $defined || define($key, $value);
        }

        defined('BASEPATH') || $this->basepath();
    }
1317097
protected function setPaths()
    {
        $pathPackage = realpath(__DIR__.'/../../../../');
        $pathBase = realpath(base_path());

        // Set CLI path.
        $this->pathCli = $pathBase.'/vendor/bin/'.$this::CLI_TOOL;
        if (!file_exists($this->pathCli)) {
            $this->pathCli = $pathPackage.'/vendor/bin/'.$this::CLI_TOOL;
        }

        // Set ruleset paths.
        $this->pathRulesetStock = $pathPackage.'/rulesets/'.$this::CLI_TOOL.'.xml';
        $this->pathRulesetLocal = $pathBase.'/'.$this::CLI_TOOL.'.xml';
        $this->pathRulesetLocalLegacy = $pathBase.'/app/'.$this::CLI_TOOL.'.xml';

        // Set active ruleset.
        $this->pathRuleset = $this->pathRulesetStock;
        if (is_readable($this->pathRulesetLocal)) {
            $this->pathRuleset = $this->pathRulesetLocal;
        } elseif (is_readable($this->pathRulesetLocalLegacy)) {
            $this->pathRuleset = $this->pathRulesetLocalLegacy;
        }
    }
945362
private function setDummyReplacements()
    {
        $this->dummyReplacements = [
          'DefaultTitle' => $this->getAttribute('title'),
          'DefaultTheme' => $this->getAttribute('namespace'),
          'DefaultOrganisation' => $this->getAttribute('organisation'),
          'DefaultAuthor' => $this->getAttribute('authorName'),
          'DefaultEmail' => $this->getAttribute('authorEmail'),
        ];
        return $this;
    }
438190
private function generateResourceRoutes()
    {
        $this->comment("Resources routes...");
        if (!$this->checkWilling('resource')) {
            return $this->line("\tskip");
        }

        $variables = [
            'STARTER' => $this->starter,
        ];
        $routesPath = $this->getDestinationPath('resource.routes');
        $routesContent = Utils::renderTemplate(
            config('zgldh-scaffold.templates.resource.routes', 'zgldh.scaffold::raw.resources.assets.routes'),
            $variables);
        Utils::writeFile($routesPath, $routesContent);

        $routeLine = "require('{$this->moduleDirectoryName}/{$this->starter->getModuleName()}/resources/assets/routes.js').default";
        Utils::addToVueRoute($routeLine);
    }
995761
protected function registerAssetSymlinker()
    {
//        $this->app->singleton('asset.symlinker', function() {
//            $publicPath = sandbox_path('packages/antares');
//
//            return new AssetSymlinker(new Filesystem, $publicPath);
//        });

        $this->app->singleton(AssetSymlinker::class, function() {
            $publicPath = sandbox_path('packages/antares');

            return new AssetSymlinker(new Filesystem, $publicPath);
        });

        $this->app->alias(AssetSymlinker::class, 'asset.symlinker');
    }
956926
public static function bindings()
    {
        return [
            Contracts\CategoryRepositoryContract::class => Categories\Repositories\CategoriesRepository::class,
            Contracts\FeaturesRepositoryContract::class => Features\Repositories\FeaturesRepository::class,
        ];
    }
1085554
public function setup_assets() {
		$suffix = $this->get_assets_suffix();

		if ( ! is_admin() ) {
			if ( ! empty( $this->jquery_uri ) ) {
				$this->update_jquery();
			}
			$remove_emoji_exists = array_key_exists( 'remove_emoji', $this->options );
			if ( ! $remove_emoji_exists ||
				( $remove_emoji_exists && $this->options['remove_emoji'] )
			) {
				$this->remove_emoji();
			}
		}

		// Load the JS files.
		if ( apply_filters( self::HOOK_PREFIX . 'include_js', true ) ) {
			$handle = sprintf( '%s-%s', $this->environment, 'js' );
			wp_register_script( $handle, str_replace( '.js', $suffix, $this->js_uri ) . '.js', [], $this->js_version, true );
			$localize_script = apply_filters( self::HOOK_PREFIX . 'localize_script', 'lean_localize_js' );
			$localize_data = apply_filters( self::HOOK_PREFIX . 'localize_data', [] );
			wp_localize_script( $handle, $localize_script, $localize_data );
			wp_enqueue_script( $handle );
		}

		// Load the CSS files.
		if ( apply_filters( self::HOOK_PREFIX . 'include_css', true ) ) {
			wp_enqueue_style(
				sprintf( '%s-%s', $this->environment, 'style' ),
				str_replace( '.css', $suffix, $this->css_uri ) . '.css',
				array(),
				$this->css_version,
				'all'
			);
		}

		if ( $this->load_comments ) {
			$this->load_comments_assets();
		}
	}
668010
public function getAssets()
    {
        $assets = [];
        $resources = $this->config()->getItem('meliscore/ressources');
        $useBuildAssets = (bool) $resources['build']['use_build_assets'];

        $cssBuild = $resources['build']['css'];
        $jsBuild = $resources['build']['js'];
        $webpack = file_get_contents($this->getWebPackMixFile());
        $webpackStatic = '';

        if (file_exists($this->getWebPackMixStaticFile())) {
            $webpackStatic = file_get_contents($this->getWebPackMixStaticFile());
        }

        $webpack .= $webpackStatic;

        $scripts = $this->getMergedAssets($useBuildAssets)['js'];
        $stylesheets = $this->getMergedAssets($useBuildAssets)['css'];

        $assets = [
            'css' => $stylesheets,
            'js' => $scripts,
        ];

        $nonBundledCss = $this->getMergedAssets()['css'];
        $nonBundledJs = $this->getMergedAssets()['js'];


        if ($useBuildAssets) {

            $nonBundledJs = array_map(function ($a) {
                // remove the URI query
                $a = str_replace('/', '\/', $a);

                return preg_replace('/\?(.+?)*/', '', $a);
            }, $nonBundledJs);

            $nonBundledCss = array_map(function ($a) {
                // remove the URI query
                $a = str_replace('/', '\/', $a);

                return preg_replace('/\?(.+?)*/', '', $a);
            }, $nonBundledCss);


            // check each file if it has been included in the build assets, if not then stack it
            // to the the assets
            foreach ($nonBundledJs as $key => $script) {
                if (!preg_match("/$script/", $webpack)) {
                    $jsBuild[$script] = $script;
                }
            }

            foreach ($nonBundledCss as $style) {
                if (!preg_match("/$style/", $webpack)) {
                    $cssBuild[$style] = $style;
                }
            }

            $cssBuild = array_map(function ($a) {
                return str_replace('\/', '/', $a);
            }, $cssBuild);

            $jsBuild = array_map(function ($a) {
                return str_replace('\/', '/', $a);
            }, $jsBuild);

        }

        return $assets;
    }
411517
public static function get_symlinks( )
    {
        Self::$arrSymlinks = array();               // leeres Array
        $url = TL_ROOT . '/';

        Self::iterateDir( $url );                   // Symlinks suchen
        asort( Self::$arrSymlinks );                // alphabetisch sortieren

        $links = array();
        foreach( Self::$arrSymlinks as $link ) {
            $links[] = Self::getLinkData( $link );
        }

        $script = "<?php\n\n"
                . "// This file is part of a backup, included in the zip archive.\n"
                . "// Place the restoreSymlinks.php in the web directory of your\n"
                . "// contao 4 and call http://domain.tld/restoreSymlinks.php\n"
                . "// After running script clear symfony-cache, e.g. with Contao Manager\n\n"
                . '$arrSymlinks = unserialize(\'' . serialize( $links ) . "');\n\n"
                . "// Check current position\n"
                . 'if( !is_dir( "../web" ) || !file_exists( "./app.php" ) ) {' . "\n"
                . "\t" . 'die( "The file is not in the correct directory" );' . "\n"
                . "}\n\n"
                . "// detect OS\n"
                . '$windows = strtoupper(substr(PHP_OS, 0, 3)) === "WIN";      // Windows or not' . "\n\n"
                . "// get absolute path to contao\n"
                . '$rootpath = getcwd();' . "\n"
                . '$rootpath = substr( $rootpath, 0 , strlen($rootpath) - 3 );' . "\n\n"
                . "// Restore the symlinks\n"
                . '$errors = 0;' . "\n"
                . '$counter = 0;' . "\n"
                . 'foreach( $arrSymlinks as $link ) {' . "\n"
                . "\t// get linkpath\n"
                . "\t" . '$l = $rootpath . $link["link"];                         // absolute address of symlink' . "\n"
                . "\t" . 'if( $windows ) $l = str_replace( "/", "\\\\", $l );       // for windows change slashes' . "\n\n"
                . "\t// get targetpath\n"
                . "\t" . 'if( $windows ) {' ."\n"
                . "\t\t" . '$t = str_replace( "/", "\\\\", $rootpath . $link["target"] );' . "\n"
                . "\t}\n"
                . "\telse {\n"
                . "\t\t" . '$t = $link["target"];' . "\n"
                . "\t\t" . 'for( $i = 0; $i < $link["depth"]; $i++ ) {' . "\n"
                . "\t\t\t" . '$t = "../" . $t;' . "\n"
                . "\t\t}\n"
                . "\t}\n\n"
                . "\t// check if link seem to be a directory\n"
                . "\t" . 'if( file_exists( $l ) && !is_link( $l ) ) {' . "\n"
                . "\t\t" . 'rename( $l, $l . ".removed" );                      // rename directory or file' . "\n"
                . "\t}\n\n"
                . "\t// no action, if link is a symlink\n"
                . "\t" . 'if( is_link( $l ) ) continue;' . "\n\n"
                . "\t// set new symlink\n"
                . "\t" . '$counter++;' . "\n"
                . "\t" . 'if( !symlink( $t, $l ) ) {' . "\n"
                . "\t\t" . 'echo "Symlink failed: " . $l . "<br>";' . "\n"
                . "\t\t" . '$errors++;' . "\n"
                . "\t}\n"
                . "}\n\n"
                . 'echo "Program terminated with " . $errors . " errors, " . $counter . " new symlinks<br><br>PLEASE DELETE THE SCRIPT FROM THE DIRECTORY NOW!<br>CLEAR THE SYMFONY-CACHE, e.g. with Contao Manager<br>";' . "\n\n";

        return $script;
    }