function advagg_admin_toggle_bypass_cookie in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 7.2 advagg.admin.inc \advagg_admin_toggle_bypass_cookie()
- 7 includes/admin.inc \advagg_admin_toggle_bypass_cookie()
Set or remove the AdvAggDisabled cookie.
1 string reference to 'advagg_admin_toggle_bypass_cookie'
- advagg_admin_settings_form in ./
advagg.admin.inc - Form builder; Configure advagg settings.
File
- ./
advagg.admin.inc, line 693 - Admin page callbacks for the advanced CSS/JS aggregation module.
Code
function advagg_admin_toggle_bypass_cookie() {
global $base_path;
$cookie_name = 'AdvAggDisabled';
$key = md5(drupal_get_private_key());
// If the cookie does exist then remove it.
if (!empty($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] == $key) {
setcookie($cookie_name, '', -1, $base_path, '.' . $_SERVER['HTTP_HOST']);
unset($_COOKIE[$cookie_name]);
drupal_set_message(t('AdvAgg Bypass Cookie Removed.'));
}
else {
setcookie($cookie_name, $key, 0, $base_path, '.' . $_SERVER['HTTP_HOST']);
$_COOKIE[$cookie_name] = $key;
drupal_set_message(t('AdvAgg Bypass Cookie Set.'));
}
}