当前位置: 首页>>代码示例>>PHP>>正文


PHP AssetCollection::all方法代码示例

本文整理汇总了PHP中Assetic\Asset\AssetCollection::all方法的典型用法代码示例。如果您正苦于以下问题:PHP AssetCollection::all方法的具体用法?PHP AssetCollection::all怎么用?PHP AssetCollection::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Assetic\Asset\AssetCollection的用法示例。


在下文中一共展示了AssetCollection::all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: all

 public function all()
 {
     if (!$this->initialized) {
         $this->initialize();
     }
     return parent::all();
 }
开发者ID:TuxCoffeeCorner,项目名称:tcc,代码行数:7,代码来源:GlobAsset.php

示例2: all

 /**
  * {@inheritdoc}
  */
 public function all()
 {
     if (!$this->loaded) {
         $this->loadResourcesFromRepo();
     }
     return parent::all();
 }
开发者ID:puli,项目名称:assetic-extension,代码行数:10,代码来源:PuliGlobAsset.php

示例3: __construct

 public function __construct(AssetCollection $coll)
 {
     $this->assets = $coll->all();
     $this->filters = $coll->getFilters();
     $this->output = $coll->getTargetPath();
     if (false === ($pos = strpos($this->output, '.'))) {
         $this->output .= '_*';
     } else {
         $this->output = substr($this->output, 0, $pos) . '_*' . substr($this->output, $pos);
     }
 }
开发者ID:rfc1483,项目名称:cascade,代码行数:11,代码来源:AssetCollection.php

示例4: smarty_function_assets

/**
 * Include and manage Assets into templates.
 *
 * Supported styles:
 *  - CSS
 *  - LESS via /vendor/leafo/LessphpFilter
 *  - SCSS via /vendor/leafo/ScssphpFilter
 *
 * Supported scripts:
 *  - JavaScript
 *  - Coffee Script via Assetic\Filter\CoffeeScriptFilter
 *
 * @param array                    $options  Assets source options.
 * @param Smarty_Internal_Template $template Smarty Template object.
 *
 * @uses   Core\Config
 * @uses   Core\Utils
 * @see    Assetic
 *
 * @return string
 */
function smarty_function_assets(array $options, Smarty_Internal_Template $template)
{
    $result = array();
    if (isset($options['source'])) {
        $assetsPath = Core\Config()->paths('assets');
        $optimization_enabled = Core\Config()->ASSETS['optimize'];
        $combination_enabled = Core\Config()->ASSETS['combine'];
        $caching_enabled = Core\Config()->ASSETS['cache'];
        $dist_path = $assetsPath['distribution'];
        $source_path = $assetsPath['source'];
        $dist_url = Core\Config()->urls('assets');
        $media = isset($options['media']) ? $options['media'] : 'all';
        $rel = isset($options['rel']) ? $options['rel'] : 'stylesheet';
        $mimetype = isset($options['type']) ? $options['type'] : 'text/css';
        $assets = is_array($options['source']) ? $options['source'] : array($options['source']);
        $assets_id = md5(implode(Core\Utils::arrayFlatten($assets)));
        $assets_to_process = array();
        /* Format assets if needed */
        if (!Core\Utils::arrayIsAssoc($options['source'])) {
            $formatted_assets = array();
            foreach ($options['source'] as $file) {
                $file_extension = pathinfo($file, PATHINFO_EXTENSION);
                $formatted_assets[$file_extension][] = $file;
                $formatted_assets[$file_extension] = array_unique($formatted_assets[$file_extension]);
            }
            $assets = $formatted_assets;
        }
        if ($caching_enabled) {
            if ($combination_enabled) {
                if (array_intersect(array('css', 'less', 'scass'), array_keys($assets))) {
                    $cached_asset = 'css' . DIRECTORY_SEPARATOR . $assets_id . '.css';
                    if (file_exists($dist_path . $cached_asset)) {
                        $target = str_replace(DIRECTORY_SEPARATOR, '/', $cached_asset);
                        $result[] = sprintf('<link href="%s" rel="%s" type="%s" media="%s" />', $dist_url . $target, $rel, $mimetype, $media);
                    } else {
                        $assets_to_process = $assets;
                    }
                } elseif (array_intersect(array('js'), array_keys($assets))) {
                    $cached_asset = 'js' . DIRECTORY_SEPARATOR . $assets_id . '.js';
                    if (file_exists($dist_path . $cached_asset)) {
                        $target = str_replace(DIRECTORY_SEPARATOR, '/', $cached_asset);
                        $result[] = sprintf('<script src="%s"></script>', $dist_url . $target);
                    } else {
                        $assets_to_process = $assets;
                    }
                }
            } else {
                foreach ($assets as $type => $files) {
                    switch ($type) {
                        case 'css':
                        case 'less':
                        case 'scass':
                            foreach ($files as $file) {
                                $filename = basename($file, '.css');
                                $filename = basename($filename, '.less');
                                $filename = basename($filename, '.scss');
                                $cached_asset = 'css' . DIRECTORY_SEPARATOR . $filename . '.css';
                                if (file_exists($dist_path . $cached_asset)) {
                                    $target = str_replace(DIRECTORY_SEPARATOR, '/', $cached_asset);
                                    $result[] = sprintf('<link href="%s" rel="%s" type="%s" media="%s" />', $dist_url . $target, $rel, $mimetype, $media);
                                } else {
                                    $assets_to_process[$type][] = $file;
                                }
                            }
                            break;
                        case 'js':
                        case 'coffee':
                            foreach ($files as $file) {
                                $filename = basename($file, '.js');
                                $filename = basename($filename, '.coffee');
                                $cached_asset = 'js' . DIRECTORY_SEPARATOR . $filename . '.js';
                                if (file_exists($dist_path . $cached_asset)) {
                                    $target = str_replace(DIRECTORY_SEPARATOR, '/', $cached_asset);
                                    $result[] = sprintf('<script src="%s"></script>', $dist_url . $target);
                                } else {
                                    $assets_to_process[$type][] = $file;
                                }
                            }
                            break;
//.........这里部分代码省略.........
开发者ID:weareathlon,项目名称:silla.io,代码行数:101,代码来源:function.assets.php

示例5: recursiveAssets

 private function recursiveAssets(AssetCollection $ac, &$tag)
 {
     foreach ($ac->all() as $el) {
         if ($el instanceof AssetCollection) {
             $this->recursiveAssets($el, $tag);
         } elseif ($el instanceof StringAsset) {
             $tag[] = array('url' => false, 'content' => $el->dump());
         } else {
             $filename = $el->getSourceRoot() . '/' . $el->getSourcePath();
             if (strpos($filename, '://') === false) {
                 $filename = base_url($filename);
             }
             $tag[$filename] = array('url' => true, 'content' => $filename);
         }
     }
 }
开发者ID:2329697501,项目名称:CI_Assetic,代码行数:16,代码来源:assetic.php


注:本文中的Assetic\Asset\AssetCollection::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。