| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Display a text size changer on the page for better web accessibility.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_help().
|
| 11 |
*/
|
| 12 |
function textsize_help($section='') {
|
| 13 |
$output = '';
|
| 14 |
switch ($section) {
|
| 15 |
case 'admin/help#textsize':
|
| 16 |
$output='<p>'. t('This module display a text size changer in a block for better web accessibility. The module is a complete <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> module and use no JavaScript or <abbr title="MySQL">MySQL</abbr>. Cookies are required, for saving the style in old browsers.') .'</p>'."\n";
|
| 17 |
$output .= '<h3>'. t('Features') .'</h3>'."\n";
|
| 18 |
$output .= '<ul>'."\n";
|
| 19 |
$output .= '<li>'. t('<abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> conform. More Information on: ') . l('bundesrecht.juris.de', 'http://bundesrecht.juris.de/bitv/anlage_8.html') .'. '. t('Keep the conditions: ') ."\n";
|
| 20 |
$output .= ' <ol>'."\n";
|
| 21 |
$output .= ' <li>'. t('<abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> 1.1 (alt text in the images).') .'</li>'."\n";
|
| 22 |
$output .= ' <li>'. t('<abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> 3.1 (standard links with text and not images).') .'</li>'."\n";
|
| 23 |
$output .= ' <li>'. t('<abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> 6.3 (no JavaScript rquired).') .'</li>'."\n";
|
| 24 |
$output .= ' <li>'. t('<abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> 11.1 (open and standard code).') .'</li>'."\n";
|
| 25 |
$output .= ' <li>'. t('<abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> 13.6 (links in a list).') .'</li>'."\n";
|
| 26 |
$output .= ' </ol>'."\n";
|
| 27 |
$output .= '</li>'."\n";
|
| 28 |
$output .= '<li>'. t('No Javascript required.') .'</li>'."\n";
|
| 29 |
$output .= '<li>'. t('No <abbr xml:lang="en" title="Cascading Style Sheet" lang="en">CSS</abbr> required') .'</li>'."\n";
|
| 30 |
$output .= '<li>'. t('No images in the code (<abbr xml:lang="en" title="Cascading Style Sheet" lang="en">CSS</abbr> generated), only one link text (for example "Increase").') .'</li>'."\n";
|
| 31 |
$output .= '<li>'. t('Uniform markin of menu, based on the open source browser <a href="http://www.mozilla.com/en-US/firefox/">Firefox 2.0</a>.') .'</li>'."\n";
|
| 32 |
$output .= '<li>'. t('<abbr lang="en" xml:lang="en" title="Portable Network Graphics">PNG</abbr> images for new browsers and <abbr lang="en" xml:lang="en" title="Graphic Interchange Format">GIF</abbr> images for old browsers (Internet Explorer 6).') .'</li>'."\n";
|
| 33 |
$output .= '<li>'. t('Tested themes: Bluemarine, Garland.') .'</li>'."\n";
|
| 34 |
$output .= '<li>'. t('Design editable with the function: "theme_textsize_html()" in template.php.') .'</li>'."\n";
|
| 35 |
$output .= '</ul>'."\n";
|
| 36 |
$output .='<h3>'. t('Global settings') .'</h3>'."\n";
|
| 37 |
$output .='<p>'. t('Show or hide description in the links') .': '. t('By hide text in the links, it shows only the logos in a line.') .' '. t('Screen readers can anymore read the text link.') .'</p>'."\n";
|
| 38 |
$output .='<p>'. t('The <abbr lang="en" xml:lang="en" title="Portable Network Graphics">PNG</abbr> and <abbr lang="en" xml:lang="en" title="Graphic Interchange Format">GIF</abbr> images are in the directory "/modules/textsize/images/" and the source file in "/modules/textsize/images/source/".') .'</p>'."\n";
|
| 39 |
$output .='<p>'. t('Show or hide current text size') .': '. t('By hide current text size, it shows no text and code.') .'</p>'."\n";
|
| 40 |
$output .= '<h3>'. t('Advanced settings') .'</h3>'."\n";
|
| 41 |
$output .= '<p>'. t('Increases/decreases step') .': '. t('Percentage by which each click increases/decreases the text size. The value have to be between 1-50% and a number.') .'</p><p>'. t('Text Size Normal') .': '. t('The default normal text size is 100%. The value have to be between 10-200% and a number.') .'</p>'."\n";
|
| 42 |
$output .= '<h3>'. t('Important information') .'</h3>'."\n";
|
| 43 |
$output .= '<p class="warning">'. t('Warning: For Internet Explorer: Your theme have to use font sitze with "em" or "%", not pixel or points!') .'</p>'."\n";
|
| 44 |
$output .= '<p class="icon info">'. t('If you are using a theme with "font-size 0.9em" in the CSS (like the garland theme), set the text size normal to 90%.') .'</p>'."\n";
|
| 45 |
break;
|
| 46 |
}
|
| 47 |
return $output;
|
| 48 |
}
|
| 49 |
|
| 50 |
/**
|
| 51 |
* Implementation of hook_perm().
|
| 52 |
*/
|
| 53 |
function textsize_perm() {
|
| 54 |
return array('administer textsize', 'access textsize content');
|
| 55 |
}
|
| 56 |
|
| 57 |
/**
|
| 58 |
* Implementation of hook_menu()
|
| 59 |
*/
|
| 60 |
function textsize_menu($may_cache) {
|
| 61 |
$items = array();
|
| 62 |
if ($may_cache) {
|
| 63 |
$items[] = array(
|
| 64 |
'path' => 'admin/settings/textsize',
|
| 65 |
'title' => t('Text Size configuration'),
|
| 66 |
'description' => t('Settings for the display and values.'),
|
| 67 |
'access callback' => 'user_access',
|
| 68 |
'callback' => 'drupal_get_form',
|
| 69 |
'callback arguments' => array('textsize_admin_settings'),
|
| 70 |
'access' => user_access('administer textsize')
|
| 71 |
);
|
| 72 |
}
|
| 73 |
return $items;
|
| 74 |
}
|
| 75 |
|
| 76 |
/**
|
| 77 |
* Administration page (menu callback)
|
| 78 |
*/
|
| 79 |
function textsize_admin_settings() {
|
| 80 |
$textsize_text = array(
|
| 81 |
'increase' => t('Increase'),
|
| 82 |
'decrease' => t('Decrease'),
|
| 83 |
'normal' => t('Normal')
|
| 84 |
);
|
| 85 |
$form['textsize'] = array(
|
| 86 |
'#type' => 'fieldset',
|
| 87 |
'#title' => t('Global settings'),
|
| 88 |
'#collapsible' => true,
|
| 89 |
'#collapsed' => false,
|
| 90 |
);
|
| 91 |
$form['textsize']['textsize_images'] = array(
|
| 92 |
'#type' => 'radios',
|
| 93 |
'#title' => t('Link display'),
|
| 94 |
'#options' => array(
|
| 95 |
t('Links in a list') .' [1]',
|
| 96 |
t('Links not in a list') .' [2]',
|
| 97 |
t('Links in a list, images in the <abbr lang="en" xml:lang="en" title="Extensible Hypertext Markup Language">XHTML</abbr> source code.') .' [3]',
|
| 98 |
t('Links not in a list, images in the <abbr lang="en" xml:lang="en" title="Extensible Hypertext Markup Language">XHTML</abbr> source code') .' [2][3]',
|
| 99 |
),
|
| 100 |
'#default_value' => variable_get('textsize_images', 0), // default to show text links.
|
| 101 |
'#description' => '[1] '. t('Images are showed with <abbr lang="en" xml:lang="en" title="Cascading Style Sheets">CSS</abbr>.') .' <span class="ok">'. t('For Web Accessibility') .'</span><br />[2] '.'<span class="warning">'. t('Warning: Links ar not in a list! Not for: <abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> 13.6!') .'</span><br />[3] '. t('No Link text, only images in the <abbr lang="en" xml:lang="en" title="Extensible Hypertext Markup Language">XHTML</abbr> source code with standard 0 pixel margin.') .' <span class="warning">'. t('Warning: Not for: <abbr lang="de" xml:lang="de" title="Barrierefreie Informationstechnik-Verordnung">BITV</abbr> 3.1! No hover action!') .'</span>',
|
| 102 |
);
|
| 103 |
|
| 104 |
$form['textsize']['textsize_list_inline'] = array(
|
| 105 |
'#type' => 'select',
|
| 106 |
'#title' => t('List display'),
|
| 107 |
'#options' => array(
|
| 108 |
'' => t('normal'),
|
| 109 |
'_inline' => t('inline'),
|
| 110 |
),
|
| 111 |
'#default_value' => variable_get('textsize_list_inline', ''),
|
| 112 |
'#description' => t('Set the display of the list.'),
|
| 113 |
);
|
| 114 |
$form['textsize']['textsize_hidden'] = array(
|
| 115 |
'#type' => 'radios',
|
| 116 |
'#title' => t('Text display'),
|
| 117 |
'#options' => array(
|
| 118 |
'' => t('Show text in the links'),
|
| 119 |
'display_hidden' => t('Hide text in the links') .' [4]',
|
| 120 |
),
|
| 121 |
'#default_value' => variable_get('textsize_hidden', ''), // default to show text links.
|
| 122 |
'#description' => t('By hide text in the links, it shows only the logos.') .' <br/>[4] <span class="icon info">'. t('Not for links with images in the <abbr lang="en" xml:lang="en" title="Extensible Hypertext Markup Language">XHTML</abbr> source code.') .'</span>',
|
| 123 |
);
|
| 124 |
|
| 125 |
$form['textsize']['textsize_current'] = array(
|
| 126 |
'#type' => 'radios',
|
| 127 |
'#title' => t('Current text size display'),
|
| 128 |
'#options' => array(
|
| 129 |
t('Show current text size'),
|
| 130 |
t('Hide current text size'),
|
| 131 |
),
|
| 132 |
'#default_value' => variable_get('textsize_current', 0), // default to show current text size
|
| 133 |
'#description' => t('By hide current text size, it shows no text and code.'),
|
| 134 |
);
|
| 135 |
$form['textsize_adv'] = array(
|
| 136 |
'#type' => 'fieldset',
|
| 137 |
'#title' => t('Advanced settings'),
|
| 138 |
'#collapsible' => true,
|
| 139 |
'#collapsed' => true,
|
| 140 |
);
|
| 141 |
$form['textsize_adv']['textsize_increment'] = array(
|
| 142 |
'#type' => 'textfield',
|
| 143 |
'#title' => t('Increases/decreases step'),
|
| 144 |
'#default_value' => variable_get('textsize_increment', 10),
|
| 145 |
'#size' => 2,
|
| 146 |
'#field_suffix' => t('%'),
|
| 147 |
'#maxlength' => 2,
|
| 148 |
'#description' => t("Percentage by which each click increases/decreases the text size. The default increases/decreases step is 10% and the value have to be between 1-50% and a number.")
|
| 149 |
);
|
| 150 |
$form['textsize_adv']['textsize_normal'] = array(
|
| 151 |
'#type' => 'textfield',
|
| 152 |
'#title' => t('Text Size Normal'),
|
| 153 |
'#default_value' => variable_get('textsize_normal', 100),
|
| 154 |
'#size' => 3,
|
| 155 |
'#field_suffix' => t('%'),
|
| 156 |
'#maxlength' => 3,
|
| 157 |
'#description' => t("The default normal text size is 100%. The value have to be between 10-200% and a number.")
|
| 158 |
);
|
| 159 |
$form['textsize_adv']['textsize_link_separator'] = array(
|
| 160 |
'#type' => 'textfield',
|
| 161 |
'#title' => t('Link separator'),
|
| 162 |
'#default_value' => variable_get('textsize_link_separator', ' | '),
|
| 163 |
'#size' => 8,
|
| 164 |
'#maxlength' => 8,
|
| 165 |
'#description' => t('If you set the links not in a list, you can enter a hidden link seperator (like ¦) or leave it blank for none. Standard is " | ".')
|
| 166 |
);
|
| 167 |
$form['#validate'] = array(
|
| 168 |
'textsize_validate_form' => array()
|
| 169 |
);
|
| 170 |
return system_settings_form($form);
|
| 171 |
}
|
| 172 |
|
| 173 |
/**
|
| 174 |
* Validate the administration form with drupal_validate_form
|
| 175 |
*/
|
| 176 |
function textsize_validate_form($form, &$form_state) {
|
| 177 |
if (!is_numeric($form_state['textsize_normal'])) {
|
| 178 |
form_set_error('textsize_normal', t('Please enter a number in "Text Size Normal".'));
|
| 179 |
}
|
| 180 |
if ($form_state['textsize_normal'] < 10 || $form_state['textsize_normal'] > 200) {
|
| 181 |
form_set_error($prefix .'_default', t('Default font size setting should between 10-200%.'));
|
| 182 |
}
|
| 183 |
if (!is_numeric($form_state['textsize_increment'])) {
|
| 184 |
form_set_error('textsize_increment', t('Please enter a number in "Increases/decreases step".'));
|
| 185 |
}
|
| 186 |
if ($form_state['textsize_increment'] <= 0 || $form_state['textsize_increment'] > 50) {
|
| 187 |
form_set_error('textsize_increment', t('Increase/decreases steps value setting should between 1-50%.'));
|
| 188 |
}
|
| 189 |
if (is_numeric($form_state['textsize_link_separator'])) {
|
| 190 |
form_set_error('textsize_link_separator', t('Please enter text or special characters in "Link seperator".'));
|
| 191 |
}
|
| 192 |
}
|
| 193 |
|
| 194 |
/**
|
| 195 |
* Generate HTML for the block
|
| 196 |
*/
|
| 197 |
function textsize_block($op='list', $delta=0) {
|
| 198 |
$textsize_list = variable_get('textsize_list', '');
|
| 199 |
$textsize_current = variable_get('textsize_current', 0);
|
| 200 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 201 |
$textsize_increment = variable_get('textsize_increment', 10);
|
| 202 |
$textsize_text = array(
|
| 203 |
'increase' => t('Increase'),
|
| 204 |
'decrease' => t('Decrease'),
|
| 205 |
'normal' => t('Normal')
|
| 206 |
);
|
| 207 |
$current = array( 'text' => t('Current Size'));
|
| 208 |
$prefix = array( 'title' => t('Text Size'));
|
| 209 |
|
| 210 |
|
| 211 |
if ($op == "list") {
|
| 212 |
$block[0]["info"] = t("Text Size");
|
| 213 |
return $block;
|
| 214 |
}
|
| 215 |
else if ($op == 'view') {
|
| 216 |
if (user_access('access textsize content')) {
|
| 217 |
$textsize_images = variable_get('textsize_images', 0);
|
| 218 |
|
| 219 |
switch ($textsize_images) {
|
| 220 |
case 0:
|
| 221 |
$block_content = theme_textsize_html();
|
| 222 |
break;
|
| 223 |
case 1:
|
| 224 |
$block_content = theme_textsize_html1();
|
| 225 |
break;
|
| 226 |
case 2:
|
| 227 |
$block_content = theme_textsize_html2();
|
| 228 |
break;
|
| 229 |
case 3:
|
| 230 |
$block_content = theme_textsize_html3();
|
| 231 |
break;
|
| 232 |
default:
|
| 233 |
$block_content = theme_textsize_html();
|
| 234 |
}
|
| 235 |
|
| 236 |
// set up the block
|
| 237 |
$block['subject'] = t('Text Size');
|
| 238 |
$block['content'] = $block_content;
|
| 239 |
return $block;
|
| 240 |
}
|
| 241 |
}
|
| 242 |
}
|
| 243 |
|
| 244 |
/**
|
| 245 |
* Display the current text size as HTML text
|
| 246 |
*/
|
| 247 |
function textsize_current_content() {
|
| 248 |
$textsize_current = variable_get('textsize_current', 0);
|
| 249 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 250 |
$textsize = $_COOKIE['textsize'];
|
| 251 |
$current = array( 'text' => t('Current Size'));
|
| 252 |
|
| 253 |
if (isset($_COOKIE['textsize'])) {
|
| 254 |
$textsize = $_COOKIE['textsize'];
|
| 255 |
}
|
| 256 |
else {$textsize = $textsize_normal;
|
| 257 |
}
|
| 258 |
switch ($textsize_current) {
|
| 259 |
case 0:
|
| 260 |
$textsize_current_content = '<p>'. $current['text'] .': '. $textsize .'%</p>'."\n";
|
| 261 |
break;
|
| 262 |
case 1:
|
| 263 |
$textsize_current_content = '';
|
| 264 |
break;
|
| 265 |
default:
|
| 266 |
$textsize_current_content = '<p>'. $current['text'] .': '. $textsize .'%</p>'."\n";
|
| 267 |
break;
|
| 268 |
}
|
| 269 |
return $textsize_current_content;
|
| 270 |
}
|
| 271 |
|
| 272 |
/**
|
| 273 |
* Implementation of hook_theme().
|
| 274 |
*/
|
| 275 |
function textsize_html_theme() {
|
| 276 |
return array(
|
| 277 |
'textsize_html' => array(
|
| 278 |
'file' => 'textsize_html.inc',
|
| 279 |
'template' => 'textsize_html',
|
| 280 |
'arguments' => array('content'),
|
| 281 |
),
|
| 282 |
'textsize_html1' => array(
|
| 283 |
'file' => 'textsize_html1.inc',
|
| 284 |
'template' => 'textsize_html1',
|
| 285 |
'arguments' => array('content'),
|
| 286 |
),
|
| 287 |
'textsize_html2' => array(
|
| 288 |
'file' => 'textsize_html2.inc',
|
| 289 |
'template' => 'textsize_html2',
|
| 290 |
'arguments' => array('content'),
|
| 291 |
),
|
| 292 |
'textsize_html3' => array(
|
| 293 |
'file' => 'textsize_html3.inc',
|
| 294 |
'template' => 'textsize_html3',
|
| 295 |
'arguments' => array('content'),
|
| 296 |
),
|
| 297 |
);
|
| 298 |
}
|
| 299 |
/**
|
| 300 |
* Theme Standard. Links in a list.
|
| 301 |
*/
|
| 302 |
function theme_textsize_html() {
|
| 303 |
$textsize_hidden = variable_get('textsize_hidden', '');
|
| 304 |
$textsize_list_inline = variable_get('textsize_list_inline', '');
|
| 305 |
$textsize_current = variable_get('textsize_current', 0);
|
| 306 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 307 |
$textsize_increment = variable_get('textsize_increment', 10);
|
| 308 |
$textsize_text = array(
|
| 309 |
'increase' => t('Increase'),
|
| 310 |
'decrease' => t('Decrease'),
|
| 311 |
'normal' => t('Normal')
|
| 312 |
);
|
| 313 |
$current = array( 'text' => t('Current Size'));
|
| 314 |
$prefix = array( 'title' => t('Text Size'));
|
| 315 |
|
| 316 |
$output = '<ul class="textsize'. $textsize_list_inline .'">'."\n";
|
| 317 |
$output .= '<li><a title="'. $prefix['title'] .': '. $textsize_text['increase'] .'" class="icon textsize_increase" href="'. $_SERVER['PHP_SELF'] .'?textsize=+'. $textsize_increment .'" ><span class="'. $textsize_hidden .'">'. $textsize_text['increase'] .'</span></a></li>'."\n";
|
| 318 |
$output .= '<li><a title="'. $prefix['title'] .': '. $textsize_text['decrease'] .'" class="icon textsize_decrease" href="'. $_SERVER['PHP_SELF'] .'?textsize=-'. $textsize_increment .'" ><span class="'. $textsize_hidden .'">'. $textsize_text['decrease'] .'</span></a></li>'."\n";
|
| 319 |
$output .= '<li><a title="'. $prefix['title'] .': '. $textsize_text['normal'] .'" class="icon textsize_normal" href="'. $_SERVER['PHP_SELF'] .'?textsize_normal='. $textsize_normal .'" ><span class="'. $textsize_hidden .'">'. $textsize_text['normal'] .'</span></a></li>'."\n";
|
| 320 |
$output .= '</ul>'."\n";
|
| 321 |
$output .= textsize_current_content();
|
| 322 |
return $output;
|
| 323 |
}
|
| 324 |
|
| 325 |
/**
|
| 326 |
* Theme 1. Links not a list.
|
| 327 |
*/
|
| 328 |
function theme_textsize_html1() {
|
| 329 |
$textsize_list = variable_get('textsize_list', 0);
|
| 330 |
$textsize_list_inline = variable_get('textsize_list_inline', '');
|
| 331 |
$textsize_current = variable_get('textsize_current', 0);
|
| 332 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 333 |
$textsize_increment = variable_get('textsize_increment', 10);
|
| 334 |
$textsize_text = array(
|
| 335 |
'increase' => t('Increase'),
|
| 336 |
'decrease' => t('Decrease'),
|
| 337 |
'normal' => t('Normal')
|
| 338 |
);
|
| 339 |
$current = array( 'text' => t('Current Size'));
|
| 340 |
$prefix = array( 'title' => t('Text Size'));
|
| 341 |
$textsize_link_separator = variable_get('textsize_link_separator', ' | ');
|
| 342 |
|
| 343 |
$output = '<p class="textsize'. $textsize_list_inline .'">'."\n";
|
| 344 |
$output .= '<a title="'. $prefix['title'] .': '. $textsize_text['increase'] .'" class="icon textsize_increase" href="'. $_SERVER['PHP_SELF'] .'?textsize=+'. $textsize_increment .'" ><span class="'. $textsize_hidden .'">'. $textsize_text['increase'] .'</span></a>';
|
| 345 |
$output .= '<span class="display_hidden">'. $textsize_link_separator .'</span>';
|
| 346 |
$output .= '<a title="'. $prefix['title'] .': '. $textsize_text['decrease'] .'" class="icon textsize_decrease" href="'. $_SERVER['PHP_SELF'] .'?textsize=-'. $textsize_increment .'" ><span class="'. $textsize_hidden .'">'. $textsize_text['decrease'] .'</span></a>';
|
| 347 |
$output .= '<span class="display_hidden">'. $textsize_link_separator .'</span>';
|
| 348 |
$output .= '<a title="'. $prefix['title'] .': '. $textsize_text['normal'] .'" class="icon textsize_normal" href="'. $_SERVER['PHP_SELF'] .'?textsize_normal='. $textsize_normal .'" ><span class="'. $textsize_hidden .'">'. $textsize_text['normal'] .'</span></a>';
|
| 349 |
$output .= '</p>'."\n";
|
| 350 |
$output .= textsize_current_content();
|
| 351 |
return $output;
|
| 352 |
}
|
| 353 |
|
| 354 |
/**
|
| 355 |
* Theme 2. Links in a list, images in the XHTML source code.
|
| 356 |
*/
|
| 357 |
function theme_textsize_html2() {
|
| 358 |
$textsize_list = variable_get('textsize_list', 0);
|
| 359 |
$textsize_list_inline = variable_get('textsize_list_inline', '');
|
| 360 |
$textsize_current = variable_get('textsize_current', 0);
|
| 361 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 362 |
$textsize_increment = variable_get('textsize_increment', 10);
|
| 363 |
$textsize_text = array(
|
| 364 |
'increase' => t('Increase'),
|
| 365 |
'decrease' => t('Decrease'),
|
| 366 |
'normal' => t('Normal')
|
| 367 |
);
|
| 368 |
$current = array( 'text' => t('Current Size'));
|
| 369 |
$prefix = array( 'title' => t('Text Size'));
|
| 370 |
|
| 371 |
$output = '<ul class="textsize'. $textsize_list_inline .'">'."\n";
|
| 372 |
$output .= '<li><a title="'. $prefix['title'] .': '. $textsize_text['increase'] .'" class="" href="'. $_SERVER['PHP_SELF'] .'?textsize=+'. $textsize_increment .'" ><img src="modules/textsize/images/increase_16.gif" alt="'. $textsize_text['increase'] .'"></a></li>'."\n";
|
| 373 |
$output .= '<li><a title="'. $prefix['title'] .': '. $textsize_text['decrease'] .'" class="" href="'. $_SERVER['PHP_SELF'] .'?textsize=-'. $textsize_increment .'" ><img src="modules/textsize/images/decrease_16.gif" alt="'. $textsize_text['decrease'] .'"></a></li>'."\n";
|
| 374 |
$output .= '<li><a title="'. $prefix['title'] .': '. $textsize_text['normal'] .'" class="" href="'. $_SERVER['PHP_SELF'] .'?textsize_normal='. $textsize_normal .'" ><img src="modules/textsize/images/normal_16.gif" alt="'. $textsize_text['normal'] .'"></a></li>'."\n";
|
| 375 |
$output .= '</ul>'."\n";
|
| 376 |
$output .= textsize_current_content();
|
| 377 |
return $output;
|
| 378 |
}
|
| 379 |
|
| 380 |
/**
|
| 381 |
* Theme 3. Links not in a list, images in the XHTML source code.
|
| 382 |
*/
|
| 383 |
function theme_textsize_html3() {
|
| 384 |
$textsize_list = variable_get('textsize_list', 0);
|
| 385 |
$textsize_list_inline = variable_get('textsize_list_inline', '');
|
| 386 |
$textsize_current = variable_get('textsize_current', 0);
|
| 387 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 388 |
$textsize_increment = variable_get('textsize_increment', 10);
|
| 389 |
$textsize_text = array(
|
| 390 |
'increase' => t('Increase'),
|
| 391 |
'decrease' => t('Decrease'),
|
| 392 |
'normal' => t('Normal')
|
| 393 |
);
|
| 394 |
$current = array( 'text' => t('Current Size'));
|
| 395 |
$prefix = array( 'title' => t('Text Size'));
|
| 396 |
$textsize_link_separator = variable_get('textsize_link_separator', ' | ');
|
| 397 |
|
| 398 |
$output = '<p class="textsize'. $textsize_list_inline .'">'."\n";
|
| 399 |
$output .= '<a title="'. $prefix['title'] .': '. $textsize_text['increase'] .'" class="" href="'. $_SERVER['PHP_SELF'] .'?textsize=+'. $textsize_increment .'" ><img src="modules/textsize/images/increase_16.gif" alt="'. $textsize_text['increase'] .'"></a>';
|
| 400 |
$output .= '<span class="display_hidden">'. $textsize_link_separator .'</span>';
|
| 401 |
$output .= '<a title="'. $prefix['title'] .': '. $textsize_text['decrease'] .'" class="" href="'. $_SERVER['PHP_SELF'] .'?textsize=-'. $textsize_increment .'" ><img src="modules/textsize/images/decrease_16.gif" alt="'. $textsize_text['decrease'] .'"></a>';
|
| 402 |
$output .= '<span class="display_hidden">'. $textsize_link_separator .'</span>';
|
| 403 |
$output .= '<a title="'. $prefix['title'] .': '. $textsize_text['normal'] .'" class="" href="'. $_SERVER['PHP_SELF'] .'?textsize_normal='. $textsize_normal .'" ><img src="modules/textsize/images/normal_16.gif" alt="'. $textsize_text['normal'] .'"></a>';
|
| 404 |
$output .= '</p>'."\n";
|
| 405 |
$output .= textsize_current_content();
|
| 406 |
return $output;
|
| 407 |
}
|
| 408 |
|
| 409 |
/**
|
| 410 |
* Set the cookie
|
| 411 |
*/
|
| 412 |
function textsize_setcookie($ps1) {
|
| 413 |
$referer = $_SERVER['HTTP_REFERER'];
|
| 414 |
setcookie("textsize", $ps1, time()+31536000, "/", "");
|
| 415 |
}
|
| 416 |
|
| 417 |
/**
|
| 418 |
* Check if is set a cookie
|
| 419 |
*/
|
| 420 |
function textsize_ifcookie() {
|
| 421 |
$referer = $_SERVER['HTTP_REFERER'];
|
| 422 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 423 |
if (isset($_COOKIE['textsize'])) {
|
| 424 |
}
|
| 425 |
else {
|
| 426 |
textsize_setcookie($textsize_normal);
|
| 427 |
}
|
| 428 |
}
|
| 429 |
textsize_ifcookie();
|
| 430 |
|
| 431 |
/**
|
| 432 |
* Handle the user specific settings.
|
| 433 |
*/
|
| 434 |
function textsize_user() {
|
| 435 |
$textsize = $_COOKIE['textsize'];
|
| 436 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 437 |
$textsize_increment = variable_get('textsize_increment', 10);
|
| 438 |
$referer = $_SERVER['HTTP_REFERER'];
|
| 439 |
$set = $_GET["textsize"];
|
| 440 |
|
| 441 |
if ($_GET["textsize"]) {
|
| 442 |
$set = $textsize + $_GET["textsize"] ;
|
| 443 |
textsize_setcookie($set);
|
| 444 |
header("Location: $referer");
|
| 445 |
}
|
| 446 |
else if ($_GET["textsize_normal"]) {
|
| 447 |
$set = $textsize_normal ;
|
| 448 |
textsize_setcookie($set);
|
| 449 |
header("Location: $referer");
|
| 450 |
}
|
| 451 |
}
|
| 452 |
textsize_user();
|
| 453 |
|
| 454 |
/**
|
| 455 |
* Print HTMl code in the head
|
| 456 |
*/
|
| 457 |
function textsize_printhtml() {
|
| 458 |
$host = $_SERVER['HTTP_HOST'];
|
| 459 |
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
|
| 460 |
//global $textsize;
|
| 461 |
$textsize_normal = variable_get('textsize_normal', 100);
|
| 462 |
|
| 463 |
if (isset($_COOKIE['textsize'])) {
|
| 464 |
$textsize = $_COOKIE['textsize'];
|
| 465 |
$textsize_head = '<style type="text/css" media="screen, projection, tty, tv, print">
|
| 466 |
<!--
|
| 467 |
/* <![CDATA[ */
|
| 468 |
body {
|
| 469 |
font-size: '. $textsize .'% !important;
|
| 470 |
}
|
| 471 |
/* ]]>*/
|
| 472 |
-->
|
| 473 |
</style>';
|
| 474 |
|
| 475 |
drupal_set_html_head($textsize_head);
|
| 476 |
}
|
| 477 |
else {
|
| 478 |
$textsize = $textsize_normal;
|
| 479 |
$textsize_head = '<style type="text/css" media="screen, projection, tty, tv, print">
|
| 480 |
<!--
|
| 481 |
/* <![CDATA[ */
|
| 482 |
body {
|
| 483 |
font-size: '. $textsize .'% !important;
|
| 484 |
}
|
| 485 |
/* ]]>*/
|
| 486 |
-->
|
| 487 |
</style>';
|
| 488 |
drupal_set_html_head($textsize_head);
|
| 489 |
}
|
| 490 |
drupal_add_css(drupal_get_path('module', 'textsize') .'/textsize.css');
|
| 491 |
}
|
| 492 |
textsize_printhtml();
|