function textsize_print_html in Text Size 5
Same name and namespace in other branches
- 6 textsize.module \textsize_print_html()
- 7 textsize.module \textsize_print_html()
Print HTMl code in the head.
Return value
CSS HTML code in the head.
1 call to textsize_print_html()
- textsize_init in ./
textsize.module - Implement hook_init().
File
- ./
textsize.module, line 213 - Display a text size changer on the page for a better web accessibility.
Code
function textsize_print_html() {
$textsize = textsize_get_current($value = 'int');
$textsize_link_type = variable_get('textsize_link_type', 'variable');
$textsize_element = variable_get('textsize_element', 'body');
$textsize_element_class = filter_xss(variable_get('textsize_element_class', ''));
$textsize_important = " !important";
if (variable_get('textsize_important', 1) == 0) {
$textsize_important = NULL;
}
$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 >= 0 && $ts_ma >= 2) {
$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;
}
}
$textsize_head = '<style type="text/css" media="screen, projection, tty, tv, print">
<!--
/* <![CDATA[ */
' . $textsize_element . $textsize_element_class . ' {
font-size: ' . $textsize . '%' . $textsize_important . ';
}
/* ]]>*/
-->
</style>';
if ($textsize_important == " !important") {
$textsize_head = '<style type="text/css" media="screen, projection, tty, tv, print">
<!--
/* <![CDATA[ */
' . $textsize_element . $textsize_element_class . ' {
font-size: ' . $textsize . '% ' . $textsize_important . ';
}' . "\n";
if ($textsize_link_type == 'fix') {
for ($value = $ts_no - $ts_in; $value <= $ts_no + $ts_in; $value = $value + $ts_in) {
$textsize_head .= $textsize_element . '.textsize-' . $value . ' { font-size: ' . $value . '%' . $textsize_important . '; }' . "\n";
}
}
elseif ($textsize_link_type == 'variable') {
for ($value = $ts_st; $value <= $ts_en; $value = $value + $ts_in) {
$textsize_head .= $textsize_element . '.textsize-' . $value . ' { font-size: ' . $value . '%' . $textsize_important . '; }' . "\n";
}
}
$textsize_head .= '/* ]]>*/
-->
</style>';
}
drupal_set_html_head($textsize_head);
}