* @license PHPv3 * @version $Id$ */ /** * Display help and module information * @param string $section which section of the site we're displaying help * @return help text for section */ function visitors_ip_help($section = '') { $output = ''; switch ($section) { case "admin/help#visitors_ip": $output = '

'. t("Shows the visitor their IP and IP version."). '

'; break; } return $output; } // end function visitors_ip_help() /** * Generate HTML for the block * * @param string $op the operation from the URL * @param string $delta offset * @returns block HTML */ function visitors_ip_block($op = 'list', $delta = 0) { $block = array(); // listing of blocks, such as on the admin/block page switch ($op) { case 'list': $block[0]["info"] = t('Visitor\'s IP'); break; case 'view': drupal_add_css(drupal_get_path('module', 'visitors_ip').'/visitors_ip.css'); $protocol = (false !== strpos($_SERVER['REMOTE_ADDR'], ':') ? 'IPv6' : 'IPv4'); $block_content = '' . $protocol . ' ' . '' . $_SERVER['REMOTE_ADDR'] . ''; $block['subject'] = t('Visitor\'s IP'); $block['content'] = $block_content; break; } // end switch block return $block; } // end function visitors_ip_block() // vim:fenc=utf-8:ft=php:ai:si:ts=2:sw=2:et: