Asset Css
@param $name
@param $rel
@param $version
@return bool|string
3505
public static function assetCss($name, $rel = 'stylesheet', $version = false)
    {
        // Get cache
        $cache = Cache::get('potion_assets', []);

        // Check for asset
        if (!isset($cache[$name])) {
            return false;
        }

        // Url
        $url = self::assetUrl($name, $version);

        // Return
        return "<link href=\"{$url}\" rel=\"{$rel}\" type=\"text/css\" />";
    }
1250714
public function getFromURL($url, $name = false)
    {
        $tmp_path = sys_get_temp_dir() . '/';

        if (Validator::validate(Validator::V_LINK, $url)) {
            $image = getimagesize($url);
            switch ($image['mime']) {
                case 'image/gif':
                case 'image/png':
                case 'image/bmp':
                case 'image/jpeg':
                    if ($image['mime'] == 'image/gif') {
                        $type = '.gif';
                    }
                    if ($image['mime'] == 'image/png') {
                        $type = '.png';
                    }
                    if ($image['mime'] == 'image/bmp') {
                        $type = '.bmp';
                    }
                    if ($image['mime'] == 'image/jpeg') {
                        $type = '.jpg';
                    }

                    if (!$name) {
                        $name = uniqid('post-') . $type;
                    } else {
                        $name .= '-' . uniqid("", true) . $type;
                    }
                    file_put_contents($tmp_path . $name, file_get_contents($url));

                    $this->getFromPath($name, sys_get_temp_dir());
                    $this->width  = $image[0];
                    $this->height = $image[1];

                    return true;
                default:
                    return false;
            }
        }

        return false;
    }
1323980
private function getFullQualifiedAssetName($name)
    {
        $name = $this->getUnquotedAssetName($name);

        if (strpos($name, '.') === false) {
            $name = $this->getName() . '.' . $name;
        }

        return strtolower($name);
    }
1307312
private function applyCssRules($files, $name)
	{
		$css = '';
		foreach ($files as $file) {
			$css .= file_get_contents($file);
		}
		$contents = file_put_contents($name, $this->rules->rules($css));
		return $contents;
	}
68408
public static function checkAliasVersion(AssetTypeInterface $assetType, $dependency, $version)
    {
        $pos = strpos($version, '#');

        if ($pos > 0 && !preg_match('{[0-9a-f]{40}$}', $version)) {
            $dependency = substr($version, 0, $pos);
            $version = substr($version, $pos);
            $searchVerion = substr($version, 1);

            if (false === strpos($version, '*') && Validator::validateTag($searchVerion, $assetType)) {
                $dependency .= '-'.str_replace('#', '', $version);
            }
        }

        return array($dependency, $version);
    }
752792
public function bundle($files, $name = 'app')
    {
        if (!$files) {
            return '';
        }

        $hash = substr(md5(implode('', $files)), 0, $this->_length);
        $extension = pathinfo($files[0], PATHINFO_EXTENSION);
        if ($pos = strpos($extension, '?')) {
            $extension = substr($extension, 0, $pos);
        }

        $bundle = ($name[0] !== '/' ? "/assets/bundle/$name" : $name) . ".$hash.$extension";

        if ($this->configure->debug || !is_file($target = $this->alias->get('@public') . "/$bundle")) {
            $r = '';
            foreach ($files as $file) {
                if ($file[0] !== '@') {
                    $file = '@public' . $file;
                }
                $source_file = $file;

                if ($pos = strpos($file, '?')) {
                    $file = substr($file, 0, $pos);
                }

                if (($content = file_get_contents($this->alias->resolve($file))) === false) {
                    throw new FileNotFoundException(['bundled `:file` file is not exists', 'file' => $file]);
                }

                if ($extension === 'css') {
                    $content = $this->_replaceCssUrl($file, $content);
                }

                $content = preg_replace('@/\*\# sourceMappingURL=[^*]+\s+\*/@', '', $content);

                $r .= PHP_EOL . PHP_EOL . "/* SOURCE_FILE `$source_file` */" . PHP_EOL . $content;
            }

            $this->filesystem->filePut("@public$bundle", $r);
        }

        return $this->alias->resolve("@asset$bundle");
    }
168785
public static function renderIcon(Environment $twigEnvironment, $name, $style = null) {

        $handler = explode(":", $name);
        if (2 !== count($handler)) {
            return "";
        }

        $output = "";

        switch ($handler[0]) {

            case "fa": // Font Awesome
                $output = (new FontAwesomeTwigExtension($twigEnvironment))->renderIcon($handler[1], $style);
                break;

            case "mc": // Meteocons
                $output = (new MeteoconsTwigExtension($twigEnvironment))->renderIcon($handler[1], $style);
                break;

            case "zmdi": // Material Design Iconic Font
                $output = (new MaterialDesignIconicFontTwigExtension($twigEnvironment))->renderIcon($handler[1], $style);
                break;
        }

        return $output;
    }
146618
protected function getAsset($name) {
		$path  = $this->assetsPath . DIRECTORY_SEPARATOR . $name;
		$asset = file_get_contents($path);
		
		if ($asset === false) {
			throw new InvalidPath('Unable to get asset "' . $name . '" by path "' . $path . '"');
		}
		
		return $asset;
	}
611549
public function installPackage(string $name, string $version, bool $dev = true)
    {
        $node = $dev ? 'require-dev' : 'require';

        if (array_key_exists($node, $this->definition)
            && array_key_exists($name, $this->definition[$node])
        ) {
            return;
        }

        $application = new Application();
        $command     = new RequireCommand();

        $definition = clone $application->getDefinition();
        $definition->addArguments($command->getDefinition()->getArguments());
        $definition->addOptions($command->getDefinition()->getOptions());

        $input = new ArrayInput(
            [
                'command' => 'require',
                'packages' => [$name . ':' . $version],
                '--dev' => $dev,
                '--no-scripts' => true,
                '--no-interaction' => true,
                '--no-plugins' => true,
                '--working-dir' => $this->workingDir
            ],
            $definition
        );

        $application->setAutoExit(false);
        $application->run($input, $this->output);
    }
1308342
public static function loadModuleIfAbsent($mod, $version = null, $compare = '>=')
    {
        if (!extension_loaded($mod)) {
            if (!get_cfg_var('enable_dl')) {
                return false;
            }
            if (!@dl(basename($mod) . '.so')) {
                return false;
            }
        }
        if (!$version) {
            return true;
        }
        try {
            $ext = new \ReflectionExtension($mod);
            return version_compare($ext->getVersion(), $version, $compare);
        } catch (\ReflectionException $e) {
            return false;
        }
    }
23874
public function isCurrentThemeCompatible( $version = 1, $theme = null ) {

		if ( null === $theme ) {
			$theme = wp_get_theme();
		}

		$basepath = $this->getDir( $theme );

		$types = [
			'prince',
			'epub',
			'web',
		];

		foreach ( $types as $type ) {
			$path = '';
			if ( 1 === $version && 'web' !== $type ) {
				$path = $basepath . "/export/$type/style.scss";
			} elseif ( 1 === $version && 'web' === $type ) {
				$path = $basepath . '/style.scss';
			}

			if ( 2 === $version ) {
				$path = $basepath . "/assets/styles/$type/style.scss";
			}

			$fullpath = realpath( $path );
			if ( ! is_file( $fullpath ) ) {
				return false;
			}
		}

		return true;
	}
526262
public function getPackage($name, $version = NULL, $variant = 'default')
	{
		$name = strtolower($name);
		if (!isset($this->packages[$name])) {
			throw new PackageNotFoundException('Package "' . $name . '" does not exist');
		}

		if (!$this->packages[$name]->hasVariant($variant)) {
			throw new PackageVariantNotFoundException('Package "' . $name . '" does not have variant "' . $variant . '"');
		}

		/* @var Package */
		$package = $this->packages[$name];

		if ($version) {
			$version = str_replace('~', NULL, $version);
			$version = str_replace('^', '>=', $version);
			$matches = Strings::match($version, '~(lt|<>|<=|le|>=|<|>|gt|ge|==|=|eq|!=|ne)*\s?(.+)~i');

			$versionNumber = $matches[2];
			$versionOperator = $matches[1];

			if (version_compare($package->getVersion(), $versionNumber, $versionOperator ?: '>=') === FALSE) {
				throw new BadPackageVersionException('Package "' . $name . '" is version "' . $package->getVersion() . '", but version "' . $version . '" required.');
			}
		}

		return $package;
	}
1249492
public static function element($name) {
        if (isset(static::$html5[$name])) {
            return static::$html5[$name];
        }
        if (isset(static::$svg[$name])) {
            return static::$svg[$name];
        }
        if (isset(static::$mathml[$name])) {
            return static::$mathml[$name];
        }

        return false;
    }
159503
public function getFontAwesome($useMinified = true, $version = self::VERSION_FONTAWESOME) : string
    {
        return sprintf('<link rel="stylesheet" href="%s">', $this->getFontAwesomeCssLink($useMinified, $version));
    }
598517
protected function asset($group, $name)
    {
        if ( ! isset($this->assets[$group][$name])) return '';

        $asset = $this->assets[$group][$name];

        // If the bundle source is not a complete URL, we will go ahead and prepend
        // the bundle's asset path to the source provided with the asset. This will
        // ensure that we attach the correct path to the asset.
        if (filter_var($asset['source'], FILTER_VALIDATE_URL) === false)
        {
            $asset['source'] = $this->path($asset['source']);
        }

        // If source is not a path to asset, render without wrap a HTML.
        if (strpos($asset['source'], '<') !== false)
        {
            return $asset['source'];
        }

        // This line fixing config path.
        $asset['source'] = $this->configAssetUrl($asset['source']);

        //return HTML::$group($asset['source'], $asset['attributes']);
        return $this->html($group, $asset['source'], $asset['attributes']);
    }
1324024
public function renderIfExists($name = null)
    {
        if (is_null($name)) {
            $params = $this->currentRoute->get();
            $name = $params[0];
        }

        if (! $this->exists($name)) {
            return '';
        }

        return $this->render($name);
    }
444316
public function style_and_script($assets, $name, $path="", $cache=0, $version=false) {
        echo $this->script($assets, $name, $path, $cache, $version);
        echo $this->style($assets, $name, $path, $cache, $version);
    }