function advagg_admin_toggle_bypass_cookie in Advanced CSS/JS Aggregation 7
Same name and namespace in other branches
- 6 advagg.admin.inc \advagg_admin_toggle_bypass_cookie()
- 7.2 advagg.admin.inc \advagg_admin_toggle_bypass_cookie()
Set or remove the AdvAggDisabled cookie.
File
- includes/
admin.inc, line 728 - 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.'));
}
}