You are here

pagestyle.install in Page Style 7

Same filename and directory in other branches
  1. 5 pagestyle.install
  2. 6 pagestyle.install

This file install and uninstall the Page Style module.

File

pagestyle.install
View source
<?php

/**
 * @file
 * This file install and uninstall the Page Style module.
 */

/**
 * Implement hook_install().
 */
function pagestyle_install() {
  $abbr_url = '<abbr title="' . t('Uniform Resource Locator') . '">URL</abbr>s';
  $abbr_ajax = '<abbr title="' . t('Asynchronous JavaScript and XML') . '">AJAX</abbr>';
  setcookie("pagestyle", 'standard', time() + 365 * 24 * 60 * 60, variable_get('pagestyle_cookie_domain', base_path(), ""));
  $_SESSION['pagestyle'] = 'standard';
  $link_cleanurls = l(t('Clean URLs'), 'admin/config/search/clean-urls', array(
    'attributes' => array(
      'title' => t('Internal link to:') . ' ' . t('Clean URLs'),
    ),
  ));
  if (variable_get('pagestyle_javascript', 1) == 1 || variable_get('pagestyle_javascript', 1) == 2) {
    drupal_set_message(t('Enable Clean !abbr_url for !abbr_ajax compatibility.', array(
      '!abbr_url' => $abbr_url,
      '!abbr_ajax' => $abbr_ajax,
    )) . ' ' . $link_cleanurls, "warning");
  }
}

/**
 * Implement hook_uninstall().
 */
function pagestyle_uninstall() {
  setcookie("pagestyle", 76, time() - 31536000, variable_get('pagestyle_cookie_domain', base_path()), "");
  unset($_SESSION['pagestyle']);
  variable_del('pagestyle_block_title');
  variable_del('pagestyle_block_type');
  variable_del('pagestyle_link_type');
  variable_del('pagestyle_normal');
  variable_del('pagestyle_browser_style_switcher');
  variable_del('pagestyle_javascript');
  variable_del('pagestyle_message');
  variable_del('pagestyle_disable_on_admin_theme');
  variable_del('pagestyle_cookie_expires');
  variable_del('pagestyle_cookie_domain');
  variable_del('pagestyle_display_subtitle');
  variable_del('pagestyle_black_white');
  variable_del('pagestyle_white_black');
  variable_del('pagestyle_yellow_blue');
  variable_del('pagestyle_standard');
  variable_del('pagestyle_display_links');
  variable_del('pagestyle_display_current_text_value');
  variable_del('pagestyle_fontweight_black_white');
  variable_del('pagestyle_fontweight_white_black');
  variable_del('pagestyle_fontweight_yellow_blue');
  variable_del('pagestyle_display_list_inline');
  variable_del('pagestyle_display_current_inline');
  variable_del('pagestyle_set_anonymous_session');
}

/**
 * Update 7110 for 7.x-1.1: Delete unused varibales and presend informations.
 */
function pagestyle_update_7110() {
  $ret = array();

  // 1 Delete variable pagestyle_fontweight_standard.
  variable_del('pagestyle_fontweight_standard', 'normal');
  drupal_set_message(t('Page Style') . ' ' . t('module') . '. ' . t('Update') . ' #7110: ' . t('Variable deleted:') . ' "<del><em>pagestyle_fontweight_standard: normal</em></del>".', 'status');

  // 2 Present information about the Page Style switcher in the browser menu.
  drupal_set_message(t('Page Style') . ' ' . t('module') . '. ' . t('Update') . ' #7110: ' . t('Feature deactivated:') . ' "<em>' . t('Advanced settings') . '/' . l(t('Add Page Style switcher in the browser menu'), 'admin/config/user-interface/pagestyle', array(
    'attributes' => array(
      'title' => t('Internal link to:') . ' ' . t('Add Page Style switcher in the browser menu'),
    ),
    'fragment' => 'edit-pagestyle-browser-style-switcher',
  )) . ': ' . t('Unchecked') . '</em>".', 'warning');

  // 3 Present information about caching.
  drupal_set_message(t('Page Style') . ' ' . t('module') . '. ' . t('Update') . ' #7110: ' . t('New feature:') . ' ' . ' "<em>' . t('Advanced settings') . '/' . t('Scripting languages') . '/' . l('PHP + JavaScript + ' . t('Optimized for performance'), 'admin/config/user-interface/pagestyle', array(
    'attributes' => array(
      'title' => t('Internal link to:') . ' ' . 'PHP + JavaScript + ' . t('Optimized for performance'),
    ),
    'fragment' => 'edit-pagestyle-javascript-2',
  )) . ': ' . t('Unchecked') . '</em>". ' . t('If you use caching, set it to:') . ' "' . t('Checked') . '".', 'status');
  return $ret;
}

Functions

Namesort descending Description
pagestyle_install Implement hook_install().
pagestyle_uninstall Implement hook_uninstall().
pagestyle_update_7110 Update 7110 for 7.x-1.1: Delete unused varibales and presend informations.