You are here

pagestyle.block.inc in Page Style 5

Same filename and directory in other branches
  1. 6 includes/pagestyle.block.inc
  2. 7 includes/pagestyle.block.inc

Block, page and theme functions.

File

includes/pagestyle.block.inc
View source
<?php

/**
 * @file
 * Block, page and theme functions.
 */

/**
 * Returns an array of allowed values.
 *
 * @return
 *   An array of allowed values.
 */
function pagestyle_allowed_values() {
  $pagestyle_allowed = array(
    'black_white',
    'white_black',
    'yellow_blue',
    'standard',
  );
  return $pagestyle_allowed;
}

/**
 * Cookie expires.
 *
 * @return
 *   The cookie expires in seconds.
 */
function pagestyle_cookie_expires($mode = 'php') {
  $pagestyle_cookie_expires = variable_get('pagestyle_cookie_expires', 365);
  $output = $pagestyle_cookie_expires * 24 * 60 * 60;
  if ($mode == 'js') {
    $output = $pagestyle_cookie_expires;
  }
  return $output;
}

/**
 * Menu callback; Set the pagestyle to Black/White, then redirects to the previous page.
 */
function pagestyle_black_white() {
  $pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'php');
  $pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
  $ps_name = t('Black') . '/' . t('White');
  $pagestyle_message = variable_get('pagestyle_message', 1);
  if (!isset($_COOKIE['pagestyle']) && $pagestyle_message == 1) {
    drupal_set_message(t('The page style have not been saved, because your browser do not accept cookies.'), 'error');
  }
  else {
    $_SESSION['pagestyle'] = 'black_white';
    setcookie("pagestyle", "black_white", time() + $pagestyle_cookie_expires, $pagestyle_cookie_domain, "");
    if ($pagestyle_message == 1) {
      drupal_set_message(t('The page style have been saved as %ps_name.', array(
        '%ps_name' => $ps_name,
      )));
    }
  }
  pagestyle_clear_cache();
  drupal_goto();
}

/**
 * Menu callback; Set the pagestyle to White/Black, then redirects to the previous page.
 */
function pagestyle_white_black() {
  $pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'php');
  $pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
  $ps_name = t('White') . '/' . t('Black');
  $pagestyle_message = variable_get('pagestyle_message', 1);
  if (!isset($_COOKIE['pagestyle']) && $pagestyle_message == 1) {
    drupal_set_message(t('The page style have not been saved, because your browser do not accept cookies.'), 'error');
  }
  else {
    $_SESSION['pagestyle'] = 'white_black';
    setcookie("pagestyle", "white_black", time() + $pagestyle_cookie_expires, $pagestyle_cookie_domain, "");
    if ($pagestyle_message == 1) {
      drupal_set_message(t('The page style have been saved as %ps_name.', array(
        '%ps_name' => $ps_name,
      )));
    }
  }
  pagestyle_clear_cache();
  drupal_goto();
}

/**
 * Menu callback; Set the pagestyle to Yellow/Blue, then redirects to the previous page.
 */
function pagestyle_yellow_blue() {
  $pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'php');
  $pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
  $ps_name = t('Yellow') . '/' . t('Blue');
  $pagestyle_message = variable_get('pagestyle_message', 1);
  if (!isset($_COOKIE['pagestyle']) && $pagestyle_message == 1) {
    drupal_set_message(t('The page style have not been saved, because your browser do not accept cookies.'), 'error');
  }
  else {
    $_SESSION['pagestyle'] = 'yellow_blue';
    setcookie("pagestyle", "yellow_blue", time() + $pagestyle_cookie_expires, $pagestyle_cookie_domain, "");
    if ($pagestyle_message == 1) {
      drupal_set_message(t('The page style have been saved as %ps_name.', array(
        '%ps_name' => $ps_name,
      )));
    }
  }
  pagestyle_clear_cache();
  drupal_goto();
}

/**
 * Menu callback; change the pagestyle to Standard, then redirects to the previous page.
 */
function pagestyle_standard() {
  $pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'php');
  $pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
  $ps_name = t('Standard');
  $pagestyle_message = variable_get('pagestyle_message', 1);
  if (!isset($_COOKIE['pagestyle']) && $pagestyle_message == 1) {
    drupal_set_message(t('The page style have not been saved, because your browser do not accept cookies.'), 'error');
  }
  else {
    $_SESSION['pagestyle'] = 'standard';
    setcookie("pagestyle", "standard", time() + $pagestyle_cookie_expires, $pagestyle_cookie_domain, "");
    if ($pagestyle_message == 1) {
      drupal_set_message(t('The page style have been saved as %ps_name.', array(
        '%ps_name' => $ps_name,
      )));
    }
  }
  pagestyle_clear_cache();
  drupal_goto();
}

/**
 * Menu callback; change the pagestyle to the cookie value, then redirects to the previous page.
 */
function pagestyle_set() {
  $pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'php');
  $pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
  $pagestyle_normal = variable_get('pagestyle_normal', 'standard');
  $pagestyle_text = array(
    'black_white' => t('Black') . '/' . t('White'),
    'white_black' => t('White') . '/' . t('Black'),
    'yellow_blue' => t('Yellow') . '/' . t('Blue'),
    'standard' => t('Standard'),
  );
  $pagestyle_message = variable_get('pagestyle_message', 1);
  $pagestyle_post = array();
  $pagestyle_cookie = array();

  // allowed values
  $pagestyle_allowed = pagestyle_allowed_values();

  // check the type and the content
  if (in_array($_COOKIE['pagestyle'], $pagestyle_allowed)) {
    $pagestyle_cookie['pagestyle'] = (string) filter_xss($_COOKIE['pagestyle']);
  }

  // set session/cookie
  if (!isset($_COOKIE['pagestyle']) && $pagestyle_message == 1) {
    drupal_set_message(t('The page style have not been saved, because your browser do not accept cookies.'), 'error');
  }
  elseif (isset($_COOKIE['pagestyle'])) {
    $_SESSION['pagestyle'] = $pagestyle_cookie['pagestyle'];
    setcookie("pagestyle", $pagestyle_cookie['pagestyle'], time() + $pagestyle_cookie_expires, $pagestyle_cookie_domain, "");
    if ($pagestyle_message == 1) {
      drupal_set_message(t('The page style have been saved as %pagestyle.', array(
        '%pagestyle' => $pagestyle_text[$pagestyle_cookie['pagestyle']],
      )));
    }
  }
  pagestyle_clear_cache();
  drupal_goto();
}

/**
 * Clear defined cache tables
 */
function pagestyle_clear_cache() {
  $tables = array(
    'cache_page',
    'cache',
  );
  foreach ($tables as $table) {
    cache_clear_all('*', $table, TRUE);
  }
}

/**
 * Block Title
 *
 * @return
 *   "Page Style" and "Current Style" or "Theme" and "Current Theme".
 *
 * @see pagestyle_admin_settings()
 */
function pagestyle_block_title($title = 'title') {
  $pagestyle_block_title = variable_get('pagestyle_block_title', 'page_style');
  $pagestyle_block_title_text = t('Page Style');
  $pagestyle_current_pagestyle_text = t('Current Style');
  switch ($pagestyle_block_title) {
    case 'theme':
      $pagestyle_block_title_text = t('Theme');
      $pagestyle_current_pagestyle_text = t('Current Theme');
      break;
  }
  if ($title == 'title') {
    return $pagestyle_block_title_text;
  }
  elseif ($title == 'current') {
    return $pagestyle_current_pagestyle_text;
  }
}

/**
 * Returns an array of available values for the select element in the block page style.
 *
 * @return
 *   An array of available values, for selecting the page style.
 *
 * @see pagestyle_form()
 */
function pagestyle_block_form_options() {
  $pagestyle_black_white = variable_get('pagestyle_black_white', 1);
  $pagestyle_white_black = variable_get('pagestyle_white_black', 1);
  $pagestyle_yellow_blue = variable_get('pagestyle_yellow_blue', 1);
  $pagestyle_standard = variable_get('pagestyle_standard', 1);
  $ps_options = array(
    $var['black_white'] = array(
      'class' => 'black_white',
      'name' => t('Black/White'),
      'display' => $pagestyle_black_white,
    ),
    $var['white_black'] = array(
      'class' => 'white_black',
      'name' => t('White/Black'),
      'display' => $pagestyle_white_black,
    ),
    $var['yellow_blue'] = array(
      'class' => 'yellow_blue',
      'name' => t('Yellow/Blue'),
      'display' => $pagestyle_yellow_blue,
    ),
    $var['standard'] = array(
      'class' => 'standard',
      'name' => t('Standard'),
      'display' => $pagestyle_standard,
    ),
  );
  $options = array();
  foreach ($ps_options as $name) {
    if ($name['display'] == 1) {
      $options[$name['class']] = $name['name'];
    }
  }
  return $options;
}

/**
 * Implement hook_form().
 *
 * Generate the select form for the block.
 *
 * @see pagestyle_block()
 */
function pagestyle_form() {
  $pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'php');
  $pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
  $pagestyle_block_title = pagestyle_block_title($title = 'title');
  $pagestyle_normal = variable_get('pagestyle_normal', 'standard');
  $pagestyle = pagestyle_get_current($value = 'int');
  $options = pagestyle_block_form_options();
  $pagestyle_text = array(
    'black_white' => t('Black') . '/' . t('White'),
    'white_black' => t('White') . '/' . t('Black'),
    'yellow_blue' => t('Yellow') . '/' . t('Blue'),
    'standard' => t('Standard'),
  );
  $pagestyle_message = variable_get('pagestyle_message', 1);
  $pagestyle_post = array();
  $pagestyle_cookie = array();

  // allowed values
  $pagestyle_allowed = pagestyle_allowed_values();

  // check the type and the content
  if (isset($_COOKIE['pagestyle']) && isset($_POST['pagestyle_select'])) {
    if (in_array($_POST['pagestyle_select'], $pagestyle_allowed)) {
      $pagestyle_post['pagestyle'] = (string) filter_xss($_POST['pagestyle_select']);
    }

    // set session/cookie
    setcookie("pagestyle", $pagestyle_post['pagestyle'], time() + $pagestyle_cookie_expires, $pagestyle_cookie_domain, "");
    $_SESSION['pagestyle'] = $pagestyle_post['pagestyle'];
    if ($pagestyle_message == 1) {
      drupal_set_message(t('The page style have been saved as %pagestyle_post.', array(
        '%pagestyle_post' => $pagestyle_text[$pagestyle_post['pagestyle']],
      )));
    }
    pagestyle_clear_cache();
  }
  elseif (!isset($_COOKIE['pagestyle']) && isset($_POST['pagestyle_select']) && $pagestyle_message == 1) {
    drupal_set_message(t('The page style have not been saved, because your browser do not accept cookies.'), 'error');
  }
  $subtitle = NULL;
  if (variable_get('pagestyle_display_subtitle', 0) == 1) {
    $subtitle = $pagestyle_block_title;
  }
  $form = array();
  $form['pagestyle_select'] = array(
    '#type' => 'select',
    '#title' => $subtitle,
    '#name' => 'pagestyle_select',
    '#options' => $options,
    '#default_value' => variable_get('pagestyle_select', $pagestyle),
    '#weight' => 0,
    '#attributes' => array(
      'class' => 'pagestyle',
    ),
  );
  $form['pagestyle_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#weight' => 1,
  );
  $form['#skip_duplicate_check'] = TRUE;
  return $form;
}

/**
 * Implement theme().
 *
 * @see pagestyle_block()
 */
function theme_pagestyle_text() {
  $pagestyle_block_title = pagestyle_block_title($title = 'title');
  $pagestyle_current_pagestyle_text = pagestyle_block_title($title = 'current');
  $pagestyle_block_type = variable_get('pagestyle_block_type', 'text');
  $pagestyle_black_white = variable_get('pagestyle_black_white', 1);
  $pagestyle_white_black = variable_get('pagestyle_white_black', 1);
  $pagestyle_yellow_blue = variable_get('pagestyle_yellow_blue', 1);
  $pagestyle_standard = variable_get('pagestyle_standard', 1);
  $block_[$pagestyle_block_type] = 'block_' . $pagestyle_block_type;
  $dest = drupal_get_destination();
  $block_title = $pagestyle_block_title;
  $list_inline = "list";
  $subtitle_add = NULL;
  if (variable_get('pagestyle_display_list_inline', 0) == 1) {
    $list_inline = "inline";
    $subtitle_add = ": ";
  }
  $current_inline = "pagestyle_current_list";
  if (variable_get('pagestyle_display_current_inline', 0) == 1) {
    $current_inline = "pagestyle_current_inline";
  }
  $subtitle = NULL;
  $subtitle_text = NULL;
  if (variable_get('pagestyle_display_subtitle', 0) == 1) {
    $subtitle = "subtitle";
    $subtitle_text = $pagestyle_block_title . $subtitle_add;
  }
  $display_links = "display";
  if (variable_get('pagestyle_display_links', 1) == 0) {
    $display_links = "display_hidden";
  }
  $black_white = NULL;
  if ($pagestyle_black_white == 1) {
    $black_white = "black_white";
  }
  $white_black = NULL;
  if ($pagestyle_white_black == 1) {
    $white_black = "white_black";
  }
  $yellow_blue = NULL;
  if ($pagestyle_yellow_blue == 1) {
    $yellow_blue = "yellow_blue";
  }
  $standard = NULL;
  if ($pagestyle_standard == 1) {
    $standard = "standard";
  }
  $current_pagestyle = NULL;
  $display_current_pagestyle = "display";
  $display_current_pagestyle_text = "display";
  switch (variable_get('pagestyle_display_current_text_value', 'text_value')) {
    case "text_value":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display";
      $display_current_pagestyle_text = "display";
      break;
    case "value":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display";
      $display_current_pagestyle_text = "display_hidden";
      break;
    case "hidden":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display_hidden";
      $display_current_pagestyle_text = "display_hidden";
      break;
    case "remove":
      $display_current_pagestyle = "display_hidden";
      $display_current_pagestyle_text = "display_hidden";
      break;
  }
  $current_pagestyle_text = $pagestyle_current_pagestyle_text;
  $pagestyle = pagestyle_get_current($value = 'name');
  if ($subtitle) {
    $output .= '<h3 class="' . $list_inline . '">' . $subtitle_text . '</h3>' . "\n";
  }
  $output .= '<ul class="pagestyle_' . $list_inline . '">' . "\n";
  if ($black_white) {
    $output .= '  <li class="ps_black_white">' . l('<span class="' . $display_links . '">' . t('Black') . '/' . t('White') . '</span>', 'pagestyle/black_white', $attributes = array(
      'title' => $block_title . ': ' . t('Black') . '/' . t('White'),
      'class' => 'ps_icon ps_black_white' . $link_type . ' pagestyle_black_white text_' . $display_links,
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  if ($white_black) {
    $output .= '  <li class="ps_white_black">' . l('<span class="' . $display_links . '">' . t('White') . '/' . t('Black') . '</span>', 'pagestyle/white_black', $attributes = array(
      'title' => $block_title . ': ' . t('White') . '/' . t('Black'),
      'class' => 'ps_icon ps_white_black' . $link_type . ' pagestyle_white_black text_' . $display_links,
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  if ($yellow_blue) {
    $output .= '  <li class="ps_yellow_blue">' . l('<span class="' . $display_links . '">' . t('Yellow') . '/' . t('Blue') . '</span>', 'pagestyle/yellow_blue', $attributes = array(
      'title' => $block_title . ': ' . t('Yellow') . '/' . t('Blue'),
      'class' => 'ps_icon ps_yellow_blue' . $link_type . ' pagestyle_yellow_blue text_' . $display_links,
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  if ($standard) {
    $output .= '  <li>' . l('<span class="' . $display_links . '">' . t('Standard') . '</span>', 'pagestyle/standard', $attributes = array(
      'title' => $block_title . ': ' . t('Standard'),
      'class' => 'ps_icon ps_standard' . $link_type . ' pagestyle_standard text_' . $display_links,
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  $output .= '</ul>' . "\n";
  if ($current_pagestyle) {
    $output .= '<p class="pagestyle_current ' . $current_inline . ' ' . $display_current_pagestyle . ' current_text_' . $display_current_pagestyle_text . '"><span class="' . $display_current_pagestyle_text . '">' . $current_pagestyle_text . ': </span><span id="pagestyle_current" title="' . $current_pagestyle_text . ': ' . $pagestyle . '">' . $pagestyle . '</span></p>' . "\n";
  }
  $output .= '<div class="ps_clear"></div>' . "\n";
  return $output;
}

/**
 * Implement theme().
 *
 * @see pagestyle_block()
 */
function theme_pagestyle_image() {
  $pagestyle_block_title = pagestyle_block_title($title = 'title');
  $pagestyle_current_pagestyle_text = pagestyle_block_title($title = 'current');
  $pagestyle_block_type = variable_get('pagestyle_block_type', 'text');
  $pagestyle_black_white = variable_get('pagestyle_black_white', 1);
  $pagestyle_white_black = variable_get('pagestyle_white_black', 1);
  $pagestyle_yellow_blue = variable_get('pagestyle_yellow_blue', 1);
  $pagestyle_standard = variable_get('pagestyle_standard', 1);
  $block_[$pagestyle_block_type] = 'block_' . $pagestyle_block_type;
  $dest = drupal_get_destination();
  $block_title = $pagestyle_block_title;
  $list_inline = "list";
  $subtitle_add = NULL;
  if (variable_get('pagestyle_display_list_inline', 0) == 1) {
    $list_inline = "inline";
    $subtitle_add = ": ";
  }
  $current_inline = "pagestyle_current_list";
  if (variable_get('pagestyle_display_current_inline', 0) == 1) {
    $current_inline = "pagestyle_current_inline";
  }
  $subtitle = NULL;
  $subtitle_text = NULL;
  if (variable_get('pagestyle_display_subtitle', 0) == 1) {
    $subtitle = "subtitle";
    $subtitle_text = $pagestyle_block_title . $subtitle_add;
  }
  $display_links = "display";
  if (variable_get('pagestyle_display_links', 1) == 0) {
    $display_links = "display_hidden";
  }
  $black_white = NULL;
  if ($pagestyle_black_white == 1) {
    $black_white = "black_white";
  }
  $white_black = NULL;
  if ($pagestyle_white_black == 1) {
    $white_black = "white_black";
  }
  $yellow_blue = NULL;
  if ($pagestyle_yellow_blue == 1) {
    $yellow_blue = "yellow_blue";
  }
  $standard = NULL;
  if ($pagestyle_standard == 1) {
    $standard = "standard";
  }
  $current_pagestyle = NULL;
  $display_current_pagestyle = "display";
  $display_current_pagestyle_text = "display";
  switch (variable_get('pagestyle_display_current_text_value', 'text_value')) {
    case "text_value":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display";
      $display_current_pagestyle_text = "display";
      break;
    case "value":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display";
      $display_current_pagestyle_text = "display_hidden";
      break;
    case "hidden":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display_hidden";
      $display_current_pagestyle_text = "display_hidden";
      break;
    case "remove":
      $display_current_pagestyle = "display_hidden";
      $display_current_pagestyle_text = "display_hidden";
      break;
  }
  $current_pagestyle_text = $pagestyle_current_pagestyle_text;
  $pagestyle = pagestyle_get_current($value = 'name');
  if ($subtitle) {
    $output .= '<h3 class="' . $list_inline . '">' . $subtitle_text . '</h3>' . "\n";
  }
  $output .= '<ul class="pagestyle_' . $list_inline . '">' . "\n";
  if ($black_white) {
    $output .= '  <li class="ps_black_white">' . l('<img src="' . base_path() . drupal_get_path("module", "pagestyle") . '/images/black_white_16.gif" alt=' . t('Black') . '/' . t('White') . ' class="ps_black_white ps_rollover" />', 'pagestyle/black_white', $attributes = array(
      'title' => $block_title . ': ' . t('Black') . '/' . t('White'),
      'class' => 'ps_black_white text_display_hidden ps_rollover',
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  if ($white_black) {
    $output .= '  <li class="ps_white_black">' . l('<img src="' . base_path() . drupal_get_path("module", "pagestyle") . '/images/white_black_16.gif" alt=' . t('White') . '/' . t('Black') . ' class="ps_white_black ps_rollover" />', 'pagestyle/white_black', $attributes = array(
      'title' => $block_title . ': ' . t('White') . '/' . t('Black'),
      'class' => 'ps_white_black text_display_hidden ps_rollover',
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  if ($pagestyle_yellow_blue == 1) {
    $output .= '  <li class="ps_yellow_blue">' . l('<img src="' . base_path() . drupal_get_path("module", "pagestyle") . '/images/yellow_blue_16.gif" alt=' . t('Yellow') . '/' . t('Blue') . ' class="ps_yellow_blue ps_rollover" />', 'pagestyle/yellow_blue', $attributes = array(
      'title' => $block_title . ': ' . t('Yellow') . '/' . t('Blue'),
      'class' => 'ps_yellow_blue text_display_hidden ps_rollover',
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  if ($standard) {
    $output .= '  <li>' . l('<img src="' . base_path() . drupal_get_path("module", "pagestyle") . '/images/standard_16.gif" alt=' . t('Standard') . ' class="ps_standard ps_rollover" />', 'pagestyle/standard', $attributes = array(
      'title' => $block_title . ': ' . t('Standard'),
      'class' => 'ps_standard text_display_hidden ps_rollover' . $link_type,
    ), $query = $dest, $fragment = NULL, $absolute = FALSE, $html = TRUE) . '</li>' . "\n";
  }
  $output .= '</ul>' . "\n";
  if ($current_pagestyle) {
    $output .= '<p class="pagestyle_current ' . $current_inline . ' ' . $display_current_pagestyle . ' current_text_' . $display_current_pagestyle_text . '"><span class="' . $display_current_pagestyle_text . '">' . $current_pagestyle_text . ': </span><span id="pagestyle_current" title="' . $current_pagestyle_text . ': ' . $pagestyle . '">' . $pagestyle . '</span></p>' . "\n";
  }
  $output .= '<div class="ps_clear"></div>' . "\n";
  return $output;
}

/**
 * Implement theme().
 *
 * @see pagestyle_form()
 */
function theme_pagestyle_form($form) {
  $pagestyle_current_pagestyle_text = pagestyle_block_title($title = 'current');
  $display_current_pagestyle = variable_get('pagestyle_display_current_pagestyle', 'display');
  $pagestyle = pagestyle_get_current($value = 'name');
  $current_pagestyle_text = $pagestyle_current_pagestyle_text;
  $list_inline = "list";
  if (variable_get('pagestyle_display_list_inline', 0) == 1) {
    $list_inline = "inline";
  }
  $current_inline = "pagestyle_current_list";
  if (variable_get('pagestyle_display_current_inline', 0) == 1) {
    $current_inline = "pagestyle_current_inline";
  }
  $current_pagestyle = NULL;
  $display_current_pagestyle = "display";
  $display_current_pagestyle_text = "display";
  switch (variable_get('pagestyle_display_current_text_value', 'text_value')) {
    case "text_value":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display";
      $display_current_pagestyle_text = "display";
      break;
    case "value":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display";
      $display_current_pagestyle_text = "display_hidden";
      break;
    case "hidden":
      $current_pagestyle = "current_pagestyle";
      $display_current_pagestyle = "display_hidden";
      $display_current_pagestyle_text = "display_hidden";
      break;
    case "remove":
      $display_current_pagestyle = "display_hidden";
      $display_current_pagestyle_text = "display_hidden";
      break;
  }
  $output = '<div id="pagestyle" class="pagestyle_' . $list_inline . ' ' . $current_inline . '">' . "\n";
  $output .= drupal_render($form);
  if ($current_pagestyle) {
    $output .= '<p class="pagestyle_current ' . $current_inline . ' ' . $display_current_pagestyle . ' current_text_' . $display_current_pagestyle_text . ' text_display"><span class="' . $display_current_pagestyle_text . '">' . $current_pagestyle_text . ': </span><span id="pagestyle_current" title="' . $current_pagestyle_text . ': ' . $pagestyle . '">' . $pagestyle . '</span></p>' . "\n";
  }
  $output .= '</div>' . "\n";
  $output .= '<div class="ps_clear"></div>' . "\n";
  return $output;
}

Functions

Namesort descending Description
pagestyle_allowed_values Returns an array of allowed values.
pagestyle_black_white Menu callback; Set the pagestyle to Black/White, then redirects to the previous page.
pagestyle_block_form_options Returns an array of available values for the select element in the block page style.
pagestyle_block_title Block Title
pagestyle_clear_cache Clear defined cache tables
pagestyle_cookie_expires Cookie expires.
pagestyle_form Implement hook_form().
pagestyle_set Menu callback; change the pagestyle to the cookie value, then redirects to the previous page.
pagestyle_standard Menu callback; change the pagestyle to Standard, then redirects to the previous page.
pagestyle_white_black Menu callback; Set the pagestyle to White/Black, then redirects to the previous page.
pagestyle_yellow_blue Menu callback; Set the pagestyle to Yellow/Blue, then redirects to the previous page.
theme_pagestyle_form Implement theme().
theme_pagestyle_image Implement theme().
theme_pagestyle_text Implement theme().