| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: gmapez.module,v 1.1.4.1 2008/08/05 08:18:53 berend Exp $ |
| 3 |
|
|
| 4 |
/* |
/* |
| 5 |
* Implementation of hook_perm |
* Implementation of hook_perm |
| 12 |
/* |
/* |
| 13 |
* Implementation of hook_menu |
* Implementation of hook_menu |
| 14 |
*/ |
*/ |
| 15 |
function gmapez_menu ($may_cache) { |
function gmapez_menu () { |
| 16 |
$items = array(); |
$items['admin/settings/gmapez'] = array( |
| 17 |
if ($may_cache) { |
'title' => t('GMapEZ'), |
| 18 |
$items[] = array('path' => 'admin/settings/gmapez', |
'description' => t('Configure the GMapEZ module.'), |
| 19 |
'title' => t('GMapEZ'), |
'page callback' => 'drupal_get_form', |
| 20 |
'description' => t('Configure the GMapEZ module.'), |
'page arguments' => array('gmapez_admin_settings'), |
| 21 |
'callback' => 'drupal_get_form', |
'access arguments' => array('administer gmapez')); |
|
'callback arguments' => 'gmapez_admin_settings', |
|
|
'access' => user_access('administer gmapez')); |
|
|
} |
|
|
else { |
|
|
if (arg(0) != 'admin' && variable_get('gmapez_always', 1)) { |
|
|
gmapez_add_script(); |
|
|
} |
|
|
} |
|
| 22 |
return $items; |
return $items; |
| 23 |
} |
} |
| 24 |
|
|
| 25 |
|
|
| 26 |
/* |
/* |
| 27 |
|
* Add script to every page, except admin pages. |
| 28 |
|
*/ |
| 29 |
|
function gmapez_init () { |
| 30 |
|
if (arg(0) != 'admin' && variable_get('gmapez_always', 1)) { |
| 31 |
|
gmapez_add_script(); |
| 32 |
|
} |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
|
| 36 |
|
/* |
| 37 |
* Add the gmapez script |
* Add the gmapez script |
| 38 |
*/ |
*/ |
| 39 |
function gmapez_add_script () { |
function gmapez_add_script () { |
| 41 |
if (! $initialized) { |
if (! $initialized) { |
| 42 |
$key = variable_get('gmapez_gmapkey', 'ABQIAAAAVBWrZTQWTeQ_EA-QxCBdXBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ8GMDInMeMDuMjCUi2ppmV64EOcw'); |
$key = variable_get('gmapez_gmapkey', 'ABQIAAAAVBWrZTQWTeQ_EA-QxCBdXBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ8GMDInMeMDuMjCUi2ppmV64EOcw'); |
| 43 |
drupal_set_html_head('<meta name="gmapkey" content="'. $key .'" />'); |
drupal_set_html_head('<meta name="gmapkey" content="'. $key .'" />'); |
| 44 |
drupal_add_js (drupal_get_path('module', 'gmapez') . '/gmapez-2.4-improved.js'); |
drupal_add_js (drupal_get_path('module', 'gmapez') . '/gmapez-2.5-improved.js'); |
| 45 |
$initialized = 1; |
$initialized = 1; |
| 46 |
} |
} |
| 47 |
} |
} |