You are here

function popup_descriptions_rule in Popup 7

Same name and namespace in other branches
  1. 8 modules/popup_descriptions/includes/popup_descriptions.admin.inc \popup_descriptions_rule()
  2. 7.x modules/popup_descriptions/includes/popup_descriptions.admin.inc \popup_descriptions_rule()
1 string reference to 'popup_descriptions_rule'
popup_descriptions_menu in modules/popup_descriptions/popup_descriptions.module
Implementation of hook_menu

File

modules/popup_descriptions/includes/popup_descriptions.admin.inc, line 112

Code

function popup_descriptions_rule($op, $type, $id = FALSE) {
  if (variable_get('description-popup-mode', 0) == 0) {
    variable_set('description-popup-mode', 'specific');
  }
  if ($type == 'id') {
    variable_set('description-popup-id', 1);
    if ($op == 'add') {
      variable_set('description-popup-ids', variable_get('description-popup-ids') . "\n" . $id);
    }
    else {
      $ids = preg_split('/[\\n\\r]+/', variable_get('description-popup-ids'));
      if (($key = array_search($id, $ids)) !== FALSE) {
        unset($ids[$key]);
      }
      variable_set('description-popup-ids', implode("\n", $ids));
    }
  }
  else {
    variable_set('description-popup-path', 1);
    $path = $_GET['destination'];
    if ($op == 'add') {
      variable_set('description-popup-paths', variable_get('description-popup-paths') . "\n" . $path);
    }
    else {
      $paths = preg_split('/[\\n\\r]+/', variable_get('description-popup-paths'));
      if (($key = array_search($path, $paths)) !== FALSE) {
        unset($paths[$key]);
      }
      variable_set('description-popup-paths', implode("\n", $paths));
    }
  }
  drupal_goto();
}