Пример #1
0
function minify_get_combined_files_url($files, $debug = false)
{
    $response = sfContext::getInstance()->getResponse();
    $app_static_url = sfConfig::get('app_static_url');
    if (!is_array($files)) {
        $files = array($files);
    }
    $prefix = $debug ? '/no' : '';
    $ts = sfTimestamp::getTimestamp($files);
    $prefix = empty($ts) ? $prefix : '/' . $ts . $prefix;
    return $app_static_url . $prefix . join($files, ',');
}
/**
 * This one is a copy from get_stylesheets from symfony except that it also looks for custom css
 */
function get_all_stylesheets($debug = false)
{
    $response = sfContext::getInstance()->getResponse();
    $response->setParameter('stylesheets_included', true, 'symfony/view/asset');
    $static_base_url = sfConfig::get('app_static_url');
    $already_seen = array();
    $html = '';
    foreach (array('first', '', 'last', 'print', 'custom_first', 'custom', 'custom_last') as $position) {
        foreach ($response->getStylesheets($position) as $files => $options) {
            if (!is_array($files)) {
                $files = array($files);
            }
            foreach ($files as $file) {
                $file = stylesheet_path($file);
                if (isset($already_seen[$file])) {
                    continue;
                }
                $already_seen[$file] = 1;
                $ts = sfTimestamp::getTimestamp($file);
                $prefix = $debug ? '/no' : '';
                $prefix = empty($ts) ? $prefix : '/' . $ts . $prefix;
                $html .= stylesheet_tag($static_base_url . $prefix . $file, $options);
            }
        }
    }
    return $html;
}