Returns an array of values needed for aggregation

Parameters

$noagg: (optional) Bool indicating that aggregation should be disabled if TRUE.

$type: (optional) String. js or css.

Return value

array of values to be imported via list() function.

2 calls to advagg_process_css_js_prep()
advagg_process_css in includes/css.inc
Returns a themed representation of all stylesheets that should be attached to the page.
advagg_process_js in ./advagg.module
Returns a themed presentation of all JavaScript code for the current page.

File

./advagg.module, line 1819

Code

function advagg_process_css_js_prep($noagg = FALSE, $type = NULL) {
    global $conf;
    $preprocess = !defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update';
    // URL bypass.
    if ($noagg || isset($_GET['advagg']) && $_GET['advagg'] == 0 && user_access('bypass advanced aggregation')) {
        $preprocess = FALSE;
        $conf['advagg_use_full_cache'] = FALSE;
    }
    // Cookie bypass.
    $cookie_name = 'AdvAggDisabled';
    $key = md5(drupal_get_private_key());
    if (!empty($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] == $key) {
        $preprocess = FALSE;
        $conf['advagg_use_full_cache'] = FALSE;
    }
    $scheme = file_default_scheme();
    if ($scheme !== 'public') {
        $custom_path = variable_get('advagg_custom_files_dir', ADVAGG_CUSTOM_FILES_DIR);
        if (!empty($custom_path)) {
            $scheme = 'public';
        }
    }
    if ($preprocess) {
        if ($type == 'js' && !variable_get('advagg_preprocess_js', ADVAGG_PREPROCESS_JS)) {
            $preprocess = FALSE;
        }
        if ($type == 'css' && !variable_get('advagg_preprocess_css', ADVAGG_PREPROCESS_CSS)) {
            $preprocess = FALSE;
        }
    }
    // A dummy query-string is added to filenames, to gain control over
    // browser-caching. The string changes on every update or full cache
    // flush, forcing browsers to load a new copy of the files, as the
    // URL changed.
    $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1);
    return array(
        $preprocess,
        $scheme,
        $query_string,
    );
}