Return a large array of the CSS & JS files loaded on this page.

Paramètres

$js_files_excluded: array of js files to not include in the output array.

$css_files_excluded: array of css files to not include in the output array.

Return value

array.

Fichier

./advagg.module, line 3210

Code

function advagg_get_js_css_get_array($js_files_excluded = array(), $css_files_excluded = array()) {
    global $conf, $_advagg;
    // Setup variables.
    $variables = array(
        'css' => array(),
        'js' => array(),
    );
    // Setup render functions.
    $css_function = variable_get('advagg_css_render_function', ADVAGG_CSS_RENDER_FUNCTION);
    $js_function = variable_get('advagg_js_render_function', ADVAGG_JS_RENDER_FUNCTION);
    $conf['advagg_css_render_function'] = 'advagg_css_array';
    $conf['advagg_js_render_function'] = 'advagg_js_array';
    // Run CSS code.
    $css_array = array();
    $variables['css'] = drupal_add_css(CSS_DEFAULT);
    if (module_exists('less')) {
        less_preprocess_page($variables, NULL);
    }
    $css_func_inline = advagg_add_css_inline();
    if (!empty($css_func_inline)) {
        $variables['css'] = advagg_merge_inline_css($variables['css'], $css_func_inline);
    }
    // Remove excluded CSS files.
    foreach ($variables['css'] as $media => $types) {
        foreach ($types as $type => $values) {
            foreach ($values as $filename => $preprocess) {
                if (in_array($filename, $css_files_excluded)) {
                    unset($variables['css'][$media][$type][$filename]);
                }
            }
        }
    }
    $css_array = advagg_process_css($variables['css']);
    // Run JS code.
    $js_array = array();
    $variables['js']['header'] = drupal_add_js(NULL, array(
        'type' => NULL,
    ));
    if (variable_get('advagg_closure', ADVAGG_CLOSURE) && !empty($_advagg['closure'])) {
        $variables['js']['footer'] = drupal_add_js(NULL, array(
            'type' => NULL,
            'scope' => 'footer',
        ));
    }
    advagg_jquery_updater($variables['js']['header']);
    // Remove excluded JS files.
    foreach ($variables['js'] as $scope => $values) {
        foreach ($values as $type => $data) {
            foreach ($data as $filename => $info) {
                if (in_array($filename, $js_files_excluded)) {
                    unset($variables['js'][$scope][$type][$filename]);
                }
            }
        }
    }
    $js_array = advagg_process_js($variables['js']);
    // Set render functions back to defaults.
    $conf['advagg_css_render_function'] = $css_function;
    $conf['advagg_js_render_function'] = $js_function;
    // Return arrays.
    return array(
        'js' => $js_array,
        'css' => $css_array,
    );
}