You are here

query_parameters_to_url.install in Query Parameters To URL 7

Query Arguments To URL install file.

File

query_parameters_to_url.install
View source
<?php

/**
 * @file
 * Query Arguments To URL install file.
 */

/**
 * Implements hook_uninstall().
 */
function query_parameters_to_url_uninstall() {

  // Load the module file, so we get the constant names and functions.
  drupal_load('module', 'query_parameters_to_url');
  variable_del(QUERY_PARAMETERS_TO_URL_ENABLED);
  variable_del(QUERY_PARAMETERS_TO_URL_ADDITIONAL_PATHS_HOOKS_ENABLED);
  variable_del(QUERY_PARAMETERS_TO_URL_REWRITE_HOOKS_ENABLED);
  variable_del(QUERY_PARAMETERS_TO_URL_REDIRECT_PROTECTION_ENABLED);
  variable_del(QUERY_PARAMETERS_TO_URL_URL_AND_QUERY_DELIMITER);
  variable_del(QUERY_PARAMETERS_TO_URL_QUERY_NESTED_KEY_DELIMITER);
  variable_del(QUERY_PARAMETERS_TO_URL_QUERY_NESTED_VALUES_DELIMITER);
  variable_del(QUERY_PARAMETERS_TO_URL_PATH_REG_EXP);
  variable_del(QUERY_PARAMETERS_TO_URL_REDIRECT_THRESHOLD);
  variable_del(QUERY_PARAMETERS_TO_URL_IGNORE_ADMIN_PATHS);
  variable_del(QUERY_PARAMETERS_TO_URL_ALLOW_REWRITTEN_MENU_ITEM_SAVE);
  variable_del(QUERY_PARAMETERS_TO_URL_REDIRECT_STATUS_CODE);
}

/**
 * Implements hook_enable().
 */
function query_parameters_to_url_enable() {

  // Notify user that globalredirect might have problems with the module.
  if (module_exists('globalredirect')) {
    drupal_set_message(t('Because you have Global Redirect module installed, it might cause issues for the Query Parameters To URL module to work properly. Please file any problems you have to the issue queue.'), 'warning');
  }
}

/**
 * Implements hook_requirements().
 */
function query_parameters_to_url_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break during installation.
  $t = get_t();
  if ($phase == 'runtime') {

    // Check if clean urls are enabled.
    $clean_url = variable_get('clean_url', FALSE);
    if ($clean_url) {
      $requirements['query_parameters_to_url_clean_urls'] = array(
        'title' => $t('Query Parameters to Url: Clean URLs'),
        'value' => 'Enabled',
        'severity' => REQUIREMENT_OK,
      );
    }
    else {
      $clean_url_link = l($t('Clean URLs'), 'admin/config/search/clean-urls');
      $requirements['query_parameters_to_url_clean_urls'] = array(
        'title' => $t('Query Parameters to Url: Clean URLs'),
        'description' => $t('Warning: !link should be enabled so that the module can properly function.', array(
          '!link' => $clean_url_link,
        )),
        'value' => 'Not Enabled',
        'severity' => REQUIREMENT_WARNING,
      );
    }
  }
  return $requirements;
}