Implements hook_advagg_get_js_file_contents_alter().

Related topics

File

advagg_relocate/advagg_relocate.advagg.inc, line 44

Code

function advagg_relocate_advagg_get_js_file_contents_alter(&$contents, $filename, $aggregate_settings) {
    // Do nothing if this is disabled.
    if (empty($aggregate_settings['variables']['advagg_relocate_js'])) {
        return;
    }
    module_load_include('inc', 'advagg', 'advagg');
    // Get info on file.
    $info = advagg_get_info_on_file($filename);
    if (!empty($info['advagg_relocate'])) {
        // Set values so it thinks its an inline script.
        $value['data'] =& $contents;
        $key = $filename;
        $scripts_found = advagg_relocate_js_script_rewrite_list($key, $value, $aggregate_settings);
        // Do rewrite of the data.
        if (!empty($scripts_found)) {
            $js[$key] =& $value;
            advagg_relocate_js_script_rewrite($js, $scripts_found);
        }
    }
}