Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_block_info().
- */
- function excuse_block_info() {
- //$blocks = array();
- $blocks['info'] = array(
- 'info' => t('Excuses'),
- 'cache' => DRUPAL_NO_CACHE,
- 'status' => 1,
- );
- return $blocks;
- }
- /**
- * Implements hook_block_view().
- */
- function excuse_block_view($delta = '') {
- $block = array();
- switch ($delta) {
- case 'info':
- $block['subject'] = t('Excuses');
- $block['content'] = t($_excuse_block_content());
- break;
- }
- return $block;
- }
- /**
- * Implements hook_block_content().
- */
- function _excuse_block_content() {
- $excusefile = "./excuses.txt"
- if (!$excuses = @file($excusefile))
- return "couldn't read excuse file '$excusefile'";
- mt_srand((double)microtime()*1000000);
- return $excuses[mt_rand(0, count($excuses)-1)];
- }
Advertisement
Add Comment
Please, Sign In to add comment