Skip to content
Snippets Groups Projects
Commit 84241c7e authored by Brandon Bergren's avatar Brandon Bergren
Browse files

Backporting whitespace changes for diff minimization reasons.

parent b85d83ef
No related branches found
No related tags found
No related merge requests found
...@@ -90,7 +90,7 @@ function gmap_gmap($op, &$map) { ...@@ -90,7 +90,7 @@ function gmap_gmap($op, &$map) {
), ),
); );
case 'pre_theme_map': case 'pre_theme_map':
$path = drupal_get_path('module', 'gmap') .'/js/'; $path = drupal_get_path('module', 'gmap') . '/js/';
// Activate markers if needed. // Activate markers if needed.
if ((isset($map['behavior']['dynmarkers']) && $map['behavior']['dynmarkers']) || !empty($map['markers'])) { if ((isset($map['behavior']['dynmarkers']) && $map['behavior']['dynmarkers']) || !empty($map['markers'])) {
static $header_set = FALSE; static $header_set = FALSE;
...@@ -117,8 +117,8 @@ function gmap_gmap($op, &$map) { ...@@ -117,8 +117,8 @@ function gmap_gmap($op, &$map) {
} }
} }
drupal_add_js($path .'icon.js'); drupal_add_js($path . 'icon.js');
drupal_add_js($path .'marker.js'); drupal_add_js($path . 'marker.js');
$mm = variable_get('gmap_mm_type', 'gmap'); $mm = variable_get('gmap_mm_type', 'gmap');
// If you really really want to override the marker manager, implement // If you really really want to override the marker manager, implement
...@@ -127,20 +127,20 @@ function gmap_gmap($op, &$map) { ...@@ -127,20 +127,20 @@ function gmap_gmap($op, &$map) {
_gmap_markermanager_override($mm); _gmap_markermanager_override($mm);
} }
drupal_add_js($path . $mm .'_marker.js'); drupal_add_js($path . $mm . '_marker.js');
} }
if (isset($map['behavior']['locpick']) && $map['behavior']['locpick']) { if (isset($map['behavior']['locpick']) && $map['behavior']['locpick']) {
drupal_add_js($path .'locpick.js'); drupal_add_js($path . 'locpick.js');
} }
if (!empty($map['markers']) || !empty($map['lines'])) { if (!empty($map['markers']) || !empty($map['lines'])) {
drupal_add_js($path .'markerloader_static.js'); drupal_add_js($path . 'markerloader_static.js');
} }
if (!empty($map['shapes'])) { if (!empty($map['shapes'])) {
drupal_add_js($path .'shapeloader_static.js'); drupal_add_js($path . 'shapeloader_static.js');
drupal_add_js($path .'gmap_shapes.js'); drupal_add_js($path . 'gmap_shapes.js');
} }
if (isset($map['feed']) && is_array($map['feed'])) { if (isset($map['feed']) && is_array($map['feed'])) {
drupal_add_js($path .'markerloader_georss.js'); drupal_add_js($path . 'markerloader_georss.js');
} }
break; break;
case 'macro_multiple': case 'macro_multiple':
...@@ -259,8 +259,8 @@ function _gmap_doheader() { ...@@ -259,8 +259,8 @@ function _gmap_doheader() {
return; return;
} }
$gmap_path = drupal_get_path('module', 'gmap'); $gmap_path = drupal_get_path('module', 'gmap');
drupal_add_css($gmap_path .'/gmap.css'); drupal_add_css($gmap_path . '/gmap.css');
drupal_add_js($gmap_path .'/js/gmap.js'); drupal_add_js($gmap_path . '/js/gmap.js');
$mm = variable_get('gmap_mm_type', 'gmap'); $mm = variable_get('gmap_mm_type', 'gmap');
$mms = variable_get('gmap_markermanager', array()); $mms = variable_get('gmap_markermanager', array());
if (empty($mms[$mm])) { if (empty($mms[$mm])) {
...@@ -273,16 +273,16 @@ function _gmap_doheader() { ...@@ -273,16 +273,16 @@ function _gmap_doheader() {
} }
if ($mm == 'clusterer' || $mm == 'clustermarker') { if ($mm == 'clusterer' || $mm == 'clustermarker') {
// Needed for access to clusterer marker. // Needed for access to clusterer marker.
drupal_add_js($gmap_path .'/js/icon.js'); drupal_add_js($gmap_path . '/js/icon.js');
} }
if (isset($mms[$mm]['filename'])) { if (isset($mms[$mm]['filename'])) {
drupal_add_js($gmap_path .'/thirdparty/'. $mms[$mm]['filename']); drupal_add_js($gmap_path . '/thirdparty/' . $mms[$mm]['filename']);
} }
drupal_add_js($gmap_path .'/js/marker.js'); drupal_add_js($gmap_path . '/js/marker.js');
drupal_add_js($gmap_path .'/js/'. $mm .'_marker.js'); drupal_add_js($gmap_path . '/js/' . $mm . '_marker.js');
drupal_add_js(array('gmap_markermanager' => $mms[$mm]), 'setting'); drupal_add_js(array('gmap_markermanager' => $mms[$mm]), 'setting');
// @@@ // @@@
drupal_add_js($gmap_path .'/js/poly.js'); drupal_add_js($gmap_path . '/js/poly.js');
global $language; global $language;
$query = array( $query = array(
...@@ -308,7 +308,7 @@ drupal_add_js($gmap_path .'/js/poly.js'); ...@@ -308,7 +308,7 @@ drupal_add_js($gmap_path .'/js/poly.js');
* A GMap array. * A GMap array.
*/ */
function gmap_parse_macro($instring, $ver = 2) { function gmap_parse_macro($instring, $ver = 2) {
require_once drupal_get_path('module', 'gmap') .'/gmap_parse_macro.inc'; require_once drupal_get_path('module', 'gmap') . '/gmap_parse_macro.inc';
return _gmap_parse_macro($instring, $ver); return _gmap_parse_macro($instring, $ver);
} }
...@@ -346,7 +346,7 @@ function gmap_set_location($map, &$form, $fields) { ...@@ -346,7 +346,7 @@ function gmap_set_location($map, &$form, $fields) {
if (!is_array($map)) { if (!is_array($map)) {
$map = array_merge(gmap_defaults(), gmap_parse_macro($map)); $map = array_merge(gmap_defaults(), gmap_parse_macro($map));
} }
$id = 'loc'. $ctr; $id = 'loc' . $ctr;
$map['id'] = $id; $map['id'] = $id;
// This is a locpick map. // This is a locpick map.
...@@ -463,7 +463,7 @@ function gmap_filter($op, $delta = 0, $format = -1, $text = '') { ...@@ -463,7 +463,7 @@ function gmap_filter($op, $delta = 0, $format = -1, $text = '') {
*/ */
function gmap_filter_tips($delta, $format, $long = FALSE) { function gmap_filter_tips($delta, $format, $long = FALSE) {
if (user_access('create gmap macro')) { // only display macro if user can create one if (user_access('create gmap macro')) { // only display macro if user can create one
return t('Insert Google Map macro.') .'<a href="'. url('map/macro') .'" target="_blank" >'. t('Create a macro') .'</a>'; return t('Insert Google Map macro.') . '<a href="' . url('map/macro') . '" target="_blank" >' . t('Create a macro') . '</a>';
} }
else { else {
return t('Insert Google Map macro.'); return t('Insert Google Map macro.');
...@@ -497,8 +497,8 @@ function gmap_regenerate_markers() { ...@@ -497,8 +497,8 @@ function gmap_regenerate_markers() {
file_check_directory($jspath, FILE_CREATE_DIRECTORY); file_check_directory($jspath, FILE_CREATE_DIRECTORY);
$contents .= "// GMap marker image data.\n"; $contents .= "// GMap marker image data.\n";
$contents .= "Drupal.gmap.iconpath = ". drupal_to_js(base_path() . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') .'/markers')) .";\n"; $contents .= "Drupal.gmap.iconpath = " . drupal_to_js(base_path() . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') . '/markers')) . ";\n";
$contents .= "Drupal.gmap.icondata = ". drupal_to_js(gmap_get_icondata(TRUE)) .";\n"; $contents .= "Drupal.gmap.icondata = " . drupal_to_js(gmap_get_icondata(TRUE)) . ";\n";
file_save_data($contents, "$jspath/gmap_markers.js", FILE_EXISTS_REPLACE); file_save_data($contents, "$jspath/gmap_markers.js", FILE_EXISTS_REPLACE);
...@@ -775,9 +775,9 @@ function process_gmap_markerchooser($element) { ...@@ -775,9 +775,9 @@ function process_gmap_markerchooser($element) {
*/ */
function theme_gmap_overlay_edit($element) { function theme_gmap_overlay_edit($element) {
$path = drupal_get_path('module', 'gmap'); $path = drupal_get_path('module', 'gmap');
drupal_add_js($path .'/js/gmap.js'); drupal_add_js($path . '/js/gmap.js');
drupal_add_js($path .'/js/gmap_shapes.js'); drupal_add_js($path . '/js/gmap_shapes.js');
drupal_add_js($path .'/js/overlay_edit.js'); drupal_add_js($path . '/js/overlay_edit.js');
return theme('select', $element); return theme('select', $element);
} }
...@@ -806,20 +806,20 @@ function gmap_map_cleanup(&$map) { ...@@ -806,20 +806,20 @@ function gmap_map_cleanup(&$map) {
} }
function theme_gmap_macrotext($element) { function theme_gmap_macrotext($element) {
drupal_add_js(drupal_get_path('module', 'gmap') .'/js/macro.js'); drupal_add_js(drupal_get_path('module', 'gmap') . '/js/macro.js');
// @@@ // @@@
drupal_add_js(drupal_get_path('module', 'gmap') .'/js/macrobuilder.js'); drupal_add_js(drupal_get_path('module', 'gmap') . '/js/macrobuilder.js');
return theme('textarea', $element); return theme('textarea', $element);
} }
function theme_gmap_address($element) { function theme_gmap_address($element) {
drupal_add_js(drupal_get_path('module', 'gmap') .'/js/address.js'); drupal_add_js(drupal_get_path('module', 'gmap') . '/js/address.js');
$element['#autocomplete_path'] = ''; $element['#autocomplete_path'] = '';
return theme('textfield', $element); return theme('textfield', $element);
} }
function theme_gmap_align($element) { function theme_gmap_align($element) {
drupal_add_js(drupal_get_path('module', 'gmap') .'/js/align.js'); drupal_add_js(drupal_get_path('module', 'gmap') . '/js/align.js');
$element['#multiple'] = FALSE; $element['#multiple'] = FALSE;
return theme('select', $element); return theme('select', $element);
} }
...@@ -902,19 +902,19 @@ function theme_gmap($element) { ...@@ -902,19 +902,19 @@ function theme_gmap($element) {
} }
$style = array(); $style = array();
$style[] = 'width: '. $map['width']; $style[] = 'width: ' . $map['width'];
$style[] = 'height: '. $map['height']; $style[] = 'height: ' . $map['height'];
$element['#attributes']['class'] = trim($element['#attributes']['class'] .' gmap gmap-map gmap-'. $mapid .'-gmap'); $element['#attributes']['class'] = trim($element['#attributes']['class'] . ' gmap gmap-map gmap-' . $mapid . '-gmap');
// Some markup parsers (IE) don't handle empty inners well. Use the space to let users know javascript is required. // Some markup parsers (IE) don't handle empty inners well. Use the space to let users know javascript is required.
// @@@ Bevan sez: Google static maps could be useful here. // @@@ Bevan sez: Google static maps could be useful here.
// @@@ Bdragon sez: Yeah, would be nice, but hard to guarantee functionality. Not everyone uses the static markerloader. // @@@ Bdragon sez: Yeah, would be nice, but hard to guarantee functionality. Not everyone uses the static markerloader.
$o = '<div style="'. implode('; ', $style) .';" id="'. $element['#id'] .'"'. drupal_attributes($element['#attributes']) .'>'. t('Javascript is required to view this map.') .'</div>'; $o = '<div style="' . implode('; ', $style) . ';" id="' . $element['#id'] . '"' . drupal_attributes($element['#attributes']) . '>' . t('Javascript is required to view this map.') . '</div>';
// $map can be manipulated by reference. // $map can be manipulated by reference.
foreach (module_implements('gmap') as $module) { foreach (module_implements('gmap') as $module) {
call_user_func_array($module .'_gmap', array('pre_theme_map', &$map)); call_user_func_array($module . '_gmap', array('pre_theme_map', &$map));
} }
if (isset($mapids[$element['#map']])) { if (isset($mapids[$element['#map']])) {
...@@ -962,7 +962,7 @@ function gmap_widget_setup(&$element, $type, $map=NULL) { ...@@ -962,7 +962,7 @@ function gmap_widget_setup(&$element, $type, $map=NULL) {
$element['#attributes']['class'] = trim(implode(' ', array( $element['#attributes']['class'] = trim(implode(' ', array(
$element['#attributes']['class'], $element['#attributes']['class'],
'gmap-control', 'gmap-control',
'gmap-'. $type, 'gmap-' . $type,
))); )));
$element['#id'] = gmap_get_id($map, $type); $element['#id'] = gmap_get_id($map, $type);
$element['#map'] = $map; $element['#map'] = $map;
...@@ -982,7 +982,7 @@ function gmap_get_id($map, $type) { ...@@ -982,7 +982,7 @@ function gmap_get_id($map, $type) {
$serial[$map][$type] = -1; $serial[$map][$type] = -1;
} }
$serial[$map][$type]++; $serial[$map][$type]++;
return 'gmap-'. $map .'-'. $type . $serial[$map][$type]; return 'gmap-' . $map . '-' . $type . $serial[$map][$type];
} }
/** /**
...@@ -991,7 +991,7 @@ function gmap_get_id($map, $type) { ...@@ -991,7 +991,7 @@ function gmap_get_id($map, $type) {
function gmap_get_auto_mapid() { function gmap_get_auto_mapid() {
static $auto = 0; static $auto = 0;
$auto++; $auto++;
return 'auto'. $auto .'map'; return 'auto' . $auto . 'map';
} }
/** /**
...@@ -1014,7 +1014,7 @@ function gmap_get_marker_titles($reset = FALSE) { ...@@ -1014,7 +1014,7 @@ function gmap_get_marker_titles($reset = FALSE) {
} }
} }
require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc'); require_once(drupal_get_path('module', 'gmap') . '/gmap_markerinfo.inc');
$titles = _gmap_get_marker_titles(); $titles = _gmap_get_marker_titles();
cache_set('gmap_marker_titles', $titles, 'cache'); cache_set('gmap_marker_titles', $titles, 'cache');
return $titles; return $titles;
...@@ -1035,7 +1035,7 @@ function gmap_get_icondata($reset = FALSE) { ...@@ -1035,7 +1035,7 @@ function gmap_get_icondata($reset = FALSE) {
} }
if ($reset || !$icons) { if ($reset || !$icons) {
require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc'); require_once(drupal_get_path('module', 'gmap') . '/gmap_markerinfo.inc');
$icons = _gmap_get_icondata(); $icons = _gmap_get_icondata();
} }
cache_set('gmap_icondata', $icons, 'cache'); cache_set('gmap_icondata', $icons, 'cache');
...@@ -1077,7 +1077,7 @@ function gmap_decimal($num) { ...@@ -1077,7 +1077,7 @@ function gmap_decimal($num) {
*/ */
function gmap_geocode($address, $tld = 'com') { function gmap_geocode($address, $tld = 'com') {
$key = gmap_get_key(); $key = gmap_get_key();
$data = drupal_http_request('http://maps.google.'. $tld .'/maps/geo?q='. drupal_urlencode($address) .'&output=csv&key='. $key); $data = drupal_http_request('http://maps.google.' . $tld . '/maps/geo?q=' . drupal_urlencode($address) . '&output=csv&key=' . $key);
if ($data->code == 200) { if ($data->code == 200) {
$r = explode(',', $data->data); $r = explode(',', $data->data);
return array( return array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment