From 3cdf54fb3e3f37919438d35295c06cb6211c4e83 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Sat, 28 Jun 2008 12:37:52 +0000 Subject: [PATCH] - Patch #275092 by kbahey, greggles and Arancaytar: emit X-Generator and meta-generator tags. --- modules/system/system.module | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/modules/system/system.module b/modules/system/system.module index 4fa9992e5daf..a8aa32e056f4 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -146,6 +146,12 @@ function system_theme() { 'system_powered_by' => array( 'arguments' => array('image_path' => NULL), ), + 'meta_generator_html' => array( + 'arguments' => array('version' => NULL), + ), + 'meta_generator_header' => array( + 'arguments' => array('version' => NULL), + ), 'system_compact_link' => array(), )); } @@ -682,6 +688,15 @@ function system_init() { drupal_add_css(drupal_get_path('module', 'system') . '/defaults.css', 'module'); drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module'); drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css', 'module'); + + // Get the major version + list($version,) = explode('.', VERSION); + + // Emit the META tag in the HTML HEAD section + theme('meta_generator_html', $version); + + // Emit the HTTP Header too + theme('meta_generator_header', $version); } /** @@ -2071,3 +2086,22 @@ function theme_system_compact_link() { return $output; } + + +/** + * Send Drupal and the major version number in the META GENERATOR HTML. + * + * @ingroup themeable + */ +function theme_meta_generator_html($version = VERSION) { + drupal_set_html_head('<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />'); +} + +/** + * Send Drupal and the major version number in the HTTP headers. + * + * @ingroup themeable + */ +function theme_meta_generator_header($version = VERSION) { + drupal_set_header('X-Generator: Drupal ' . $version . ' (http://drupal.org)'); +} -- GitLab