You are here

function textsize_allowed_values in Text Size 5

Same name and namespace in other branches
  1. 6 includes/textsize.block.inc \textsize_allowed_values()
  2. 7 includes/textsize.block.inc \textsize_allowed_values()

Returns an array of allowed values.

Return value

An array of allowed values.

6 calls to textsize_allowed_values()
textsize_check in ./textsize.module
Check the cookie "textsize" value of changing (bye JavaScript) for anonymus user.
textsize_decrease in includes/textsize.block.inc
Menu callback; decrease the textsize, then redirects to the previous page.
textsize_form in includes/textsize.block.inc
Implement hook_form().
textsize_get_current in ./textsize.module
Return the current text size.
textsize_increase in includes/textsize.block.inc
Menu callback; increase the textsize, then redirects to the previous page.

... See full list

File

includes/textsize.block.inc, line 14
block, page and theme functions.

Code

function textsize_allowed_values() {
  $ts_in = variable_get('textsize_increment', 5);
  $ts_no = variable_get('textsize_normal', 75);
  $ts_mi = variable_get('textsize_minimum', 50);
  $ts_ma = variable_get('textsize_maximum', 150);
  $textsize_allowed_values = array();
  if (is_numeric($ts_in) && is_numeric($ts_no) && is_numeric($ts_mi) && is_numeric($ts_ma)) {
    if ($ts_in >= 1 && $ts_no >= 1 && $ts_mi >= 1 && $ts_ma >= 3) {
      $ts_st = $ts_no - floor(($ts_no - $ts_mi) / $ts_in) * $ts_in;
      $ts_en = $ts_no + floor(($ts_ma - $ts_no) / $ts_in) * $ts_in;
      for ($value = $ts_st; $value <= $ts_en; $value = $value + $ts_in) {
        $textsize_allowed_values[] = $value;
      }
    }
  }
  return $textsize_allowed_values;
}