本文整理汇总了PHP中Assets::_sort方法的典型用法代码示例。如果您正苦于以下问题:PHP Assets::_sort方法的具体用法?PHP Assets::_sort怎么用?PHP Assets::_sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets
的用法示例。
在下文中一共展示了Assets::_sort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: all_js
/**
* Get all JS assets
*
* @param bool $footer
* @return bool|string
*/
public static function all_js($footer = false)
{
if (empty(self::$_js)) {
return false;
}
$assets = array();
foreach (self::$_js as $handle => $data) {
if ($data['footer'] === $footer) {
$assets[$handle] = $data;
}
}
if (empty($assets)) {
return false;
}
$sorted = array();
foreach (Assets::_sort($assets) as $handle => $data) {
$sorted[] = Assets::get_js($handle);
}
return implode("\n ", $sorted);
}
示例2: all_group
/**
* Get all of a groups assets, sorted by dependencies
*
* @param string Group name
* @return string Assets content
*/
public static function all_group($group)
{
if (!isset(Assets::$groups[$group])) {
return FALSE;
}
foreach (Assets::_sort(Assets::$groups[$group]) as $handle => $data) {
$assets[] = Assets::get_group($group, $handle);
}
return implode("\n", $assets);
}
示例3: minify
/**
*
* @param string $cache_dir_path
* @return array
*/
public static function minify($cache_dir_path = NULL)
{
Assets::$_js_minify = Assets::$_css_minify = array();
foreach (Assets::_sort(Assets::$js) as $handle => $js) {
Assets::$_js_minify[] = $js['src'];
}
foreach (Assets::_sort(Assets::$css) as $handle => $css) {
Assets::$_css_minify[] = $css['src'];
}
return array(self::_minify(Assets::$_css_minify, 'css', $cache_dir_path), self::_minify(Assets::$_js_minify, 'js', $cache_dir_path));
}