Created
August 22, 2011 19:42
-
-
Save sivaji/1163320 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implement hook_block_view(). | |
*/ | |
function textsize_block_view($delta = '') { | |
$textsize_cookie_expires = textsize_cookie_expires($mode = 'php'); | |
$textsize_cookie_domain = variable_get('textsize_cookie_domain', base_path()); | |
$block_title = textsize_block_title($title = 'title'); | |
$textsize_normal = variable_get('textsize_normal', 76); | |
$textsize_increment = variable_get('textsize_increment', 6); | |
$textsize_current_text = variable_get('textsize_display_current_textsize', 'display'); | |
$textsize_block_title = variable_get('textsize_block_title', 'text_size'); | |
$textsize_block_type = variable_get('textsize_block_type', 'text'); | |
$block_content = theme('textsize_text'); | |
switch ($textsize_block_type) { | |
case 'text': | |
$block_content = theme('textsize_text'); | |
break; | |
case 'image': | |
$block_content = theme('textsize_image'); | |
break; | |
case 'select': | |
$block_content = drupal_get_form('textsize_form'); | |
break; | |
default: | |
$block_content = theme('textsize_text'); | |
} | |
$block['content'] = $block_content; | |
if (!isset($_SESSION['textsize'])) { | |
$_SESSION['textsize'] = $textsize_normal; | |
} | |
if (!isset($_COOKIE['textsize'])) { | |
setcookie("textsize", $textsize_normal, time()+$textsize_cookie_expires, $textsize_cookie_domain, ""); | |
} | |
if (user_access('access textsize content')) { | |
$block['subject'] = $block_title; | |
$block['content'] = $block_content; | |
return $block; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment