@@ -67,77 +67,77 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function geodir_draw_map($map_args = array()) |
69 | 69 | { |
70 | - global $map_canvas_arr; |
|
71 | - $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | - $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | - |
|
74 | - $default_location = geodir_get_default_location(); |
|
75 | - |
|
76 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | - $map_default_zoom = 12; |
|
79 | - // map options default values |
|
80 | - $width = 950; |
|
81 | - $height = 450; |
|
82 | - $child_collapse = '0'; |
|
83 | - $sticky = ''; |
|
84 | - $enable_cat_filters = false; |
|
85 | - $enable_text_search = false; |
|
86 | - $enable_post_type_filters = false; |
|
87 | - $enable_location_filters = false; |
|
88 | - $enable_jason_on_load = false; |
|
89 | - $enable_map_direction = false; |
|
90 | - $enable_marker_cluster = false; |
|
91 | - $enable_map_resize_button = false; |
|
92 | - $maptype = 'ROADMAP'; |
|
93 | - |
|
94 | - $geodir_map_options = array( |
|
95 | - 'width' => $width, |
|
96 | - 'height' => $height, |
|
97 | - 'child_collapse' => $child_collapse, |
|
98 | - 'sticky' => $sticky, |
|
99 | - 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | - 'enable_cat_filters' => $enable_cat_filters, |
|
101 | - 'enable_text_search' => $enable_text_search, |
|
102 | - 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | - 'enable_location_filters' => $enable_location_filters, |
|
104 | - 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | - 'enable_map_direction' => $enable_map_direction, |
|
106 | - 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | - 'ajax_url' => geodir_get_ajax_url(), |
|
108 | - 'map_canvas_name' => $map_canvas_name, |
|
109 | - 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | - 'latitude' => $map_default_lat, |
|
111 | - 'longitude' => $map_default_lng, |
|
112 | - 'zoom' => $map_default_zoom, |
|
113 | - 'scrollwheel' => true, |
|
114 | - 'streetViewControl' => true, |
|
115 | - 'maptype' => $maptype, |
|
116 | - 'showPreview' => '0', |
|
117 | - 'maxZoom' => 21, |
|
118 | - 'autozoom' => true, |
|
119 | - 'bubble_size' => 'small', |
|
120 | - 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | - 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | - ); |
|
123 | - |
|
124 | - if (!empty($map_args)) { |
|
125 | - foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | - $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | - } else { |
|
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | - } |
|
134 | - |
|
135 | - if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | - } else { |
|
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
70 | + global $map_canvas_arr; |
|
71 | + $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | + $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | + |
|
74 | + $default_location = geodir_get_default_location(); |
|
75 | + |
|
76 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | + $map_default_zoom = 12; |
|
79 | + // map options default values |
|
80 | + $width = 950; |
|
81 | + $height = 450; |
|
82 | + $child_collapse = '0'; |
|
83 | + $sticky = ''; |
|
84 | + $enable_cat_filters = false; |
|
85 | + $enable_text_search = false; |
|
86 | + $enable_post_type_filters = false; |
|
87 | + $enable_location_filters = false; |
|
88 | + $enable_jason_on_load = false; |
|
89 | + $enable_map_direction = false; |
|
90 | + $enable_marker_cluster = false; |
|
91 | + $enable_map_resize_button = false; |
|
92 | + $maptype = 'ROADMAP'; |
|
93 | + |
|
94 | + $geodir_map_options = array( |
|
95 | + 'width' => $width, |
|
96 | + 'height' => $height, |
|
97 | + 'child_collapse' => $child_collapse, |
|
98 | + 'sticky' => $sticky, |
|
99 | + 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | + 'enable_cat_filters' => $enable_cat_filters, |
|
101 | + 'enable_text_search' => $enable_text_search, |
|
102 | + 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | + 'enable_location_filters' => $enable_location_filters, |
|
104 | + 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | + 'enable_map_direction' => $enable_map_direction, |
|
106 | + 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | + 'ajax_url' => geodir_get_ajax_url(), |
|
108 | + 'map_canvas_name' => $map_canvas_name, |
|
109 | + 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | + 'latitude' => $map_default_lat, |
|
111 | + 'longitude' => $map_default_lng, |
|
112 | + 'zoom' => $map_default_zoom, |
|
113 | + 'scrollwheel' => true, |
|
114 | + 'streetViewControl' => true, |
|
115 | + 'maptype' => $maptype, |
|
116 | + 'showPreview' => '0', |
|
117 | + 'maxZoom' => 21, |
|
118 | + 'autozoom' => true, |
|
119 | + 'bubble_size' => 'small', |
|
120 | + 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | + 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | + ); |
|
123 | + |
|
124 | + if (!empty($map_args)) { |
|
125 | + foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | + $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | + } else { |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | + } |
|
134 | + |
|
135 | + if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | + } else { |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | 141 | * Filter the options to use in google map. |
142 | 142 | * |
143 | 143 | * @since 1.0.0 |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
148 | 148 | |
149 | - $map_canvas_arr[$map_canvas_name] = array(); |
|
149 | + $map_canvas_arr[$map_canvas_name] = array(); |
|
150 | 150 | |
151 | - /** |
|
151 | + /** |
|
152 | 152 | * Filter the post types to display data on map. |
153 | 153 | * |
154 | 154 | * @since 1.0.0 |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | - // Set default map options |
|
169 | + if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | + // Set default map options |
|
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
173 | 173 | |
174 | - wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
174 | + wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
175 | 175 | |
176 | - if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | - $map_width = '100%'; |
|
178 | - } else { |
|
179 | - $map_width = $geodir_map_options['width']; |
|
180 | - } |
|
176 | + if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | + $map_width = '100%'; |
|
178 | + } else { |
|
179 | + $map_width = $geodir_map_options['width']; |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
182 | + /** |
|
183 | 183 | * Filter the width of map. |
184 | 184 | * |
185 | 185 | * @since 1.0.0 |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param int $map_width Width of map box, eg: gd_place. |
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | - ?> |
|
190 | + ?> |
|
191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
222 | 222 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
223 | 223 | <?php } else { |
224 | - ?> |
|
224 | + ?> |
|
225 | 225 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
226 | 226 | <?php } |
227 | 227 | |
228 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
229 | - $show_entire_cat_panel = "none"; |
|
230 | - else |
|
231 | - $show_entire_cat_panel = "''"; |
|
232 | - ?> |
|
228 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
229 | + $show_entire_cat_panel = "none"; |
|
230 | + else |
|
231 | + $show_entire_cat_panel = "''"; |
|
232 | + ?> |
|
233 | 233 | |
234 | 234 | <?php if ($geodir_map_options['enable_map_direction']) { ?> |
235 | 235 | <div class="gd-input-group gd-get-directions"> |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')"> |
293 | 293 | <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option> |
294 | 294 | <option <?php if (get_option('geodir_search_dist_1') == 'km') { |
295 | - echo 'selected="selected"'; |
|
296 | - } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
295 | + echo 'selected="selected"'; |
|
296 | + } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
297 | 297 | </select> |
298 | 298 | </div> |
299 | 299 | |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | if (empty($geodir_default_map_search_pt)) |
306 | 306 | $geodir_default_map_search_pt = 'gd_place'; |
307 | 307 | |
308 | - global $gd_session; |
|
309 | - $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype'); |
|
308 | + global $gd_session; |
|
309 | + $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype'); |
|
310 | 310 | |
311 | - if ($homemap_catlist_ptype) { |
|
312 | - $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
313 | - } |
|
311 | + if ($homemap_catlist_ptype) { |
|
312 | + $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
313 | + } |
|
314 | 314 | |
315 | 315 | /** |
316 | 316 | * Filter the post type to retrieve data for map |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | ?> |
324 | 324 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
325 | 325 | <?php |
326 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
327 | - $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
326 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
327 | + $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
328 | 328 | $map_cat_class = ''; |
329 | 329 | if ($geodir_map_options['enable_post_type_filters']) { |
330 | 330 | $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
331 | 331 | } |
332 | - ?> |
|
332 | + ?> |
|
333 | 333 | <div |
334 | 334 | class="map-category-listing<?php echo $map_cat_class;?>"> |
335 | 335 | <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?> |
348 | 348 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
349 | 349 | <?php } else {$child_collapse = "0"; |
350 | - ?> |
|
350 | + ?> |
|
351 | 351 | <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
352 | 352 | <?php } ?> |
353 | 353 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
@@ -369,17 +369,17 @@ discard block |
||
369 | 369 | <!-- map-category-listings--> |
370 | 370 | |
371 | 371 | <?php |
372 | - if ($geodir_map_options['enable_location_filters']) { |
|
372 | + if ($geodir_map_options['enable_location_filters']) { |
|
373 | 373 | $country = get_query_var('gd_country'); |
374 | 374 | $region = get_query_var('gd_region'); |
375 | 375 | $city = get_query_var('gd_city'); |
376 | 376 | |
377 | - //fix for location/me page |
|
378 | - $country = $country != 'me' ? $country : ''; |
|
377 | + //fix for location/me page |
|
378 | + $country = $country != 'me' ? $country : ''; |
|
379 | 379 | $region = $region != 'me' ? $region : ''; |
380 | 380 | $city = $country != 'me' ? $city : ''; |
381 | - $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
382 | - ?> |
|
381 | + $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
382 | + ?> |
|
383 | 383 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
384 | 384 | <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
385 | 385 | value="<?php echo $country;?>"/> |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
391 | 391 | value="<?php echo $gd_neighbourhood;?>"/> |
392 | 392 | <?php } else { //end of location filter |
393 | - ?> |
|
393 | + ?> |
|
394 | 394 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
395 | 395 | <?php }?> |
396 | 396 | |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | |
402 | 402 | |
403 | 403 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
404 | - $post_types = geodir_get_posttypes('object'); |
|
405 | - if (count((array)($post_types)) > 1) { |
|
406 | - ?> |
|
404 | + $post_types = geodir_get_posttypes('object'); |
|
405 | + if (count((array)($post_types)) > 1) { |
|
406 | + ?> |
|
407 | 407 | <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
408 | 408 | style="max-width:<?php echo $map_width;?>!important;"> |
409 | 409 | |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | <div class="geodir-map-posttype-list"><?php } ?> |
412 | 412 | <ul class="clearfix place-list"> |
413 | 413 | <?php |
414 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
414 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
415 | 415 | |
416 | - foreach ($post_types as $post_type => $args) { |
|
417 | - if (!in_array($post_type, $exclude_post_types)) { |
|
418 | - $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
416 | + foreach ($post_types as $post_type => $args) { |
|
417 | + if (!in_array($post_type, $exclude_post_types)) { |
|
418 | + $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
419 | 419 | echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>'; |
420 | - } |
|
421 | - } |
|
422 | - ?> |
|
420 | + } |
|
421 | + } |
|
422 | + ?> |
|
423 | 423 | </ul> |
424 | 424 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
425 | 425 | </div><?php } ?> |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | |
434 | 434 | </div> <!-- map-places-listings--> |
435 | 435 | <?php } |
436 | - } // end of post type filter if |
|
437 | - ?> |
|
436 | + } // end of post type filter if |
|
437 | + ?> |
|
438 | 438 | |
439 | 439 | </div> |
440 | 440 | </div> <!--end of stick trigger container--> |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | </script> |
450 | 450 | <?php |
451 | 451 | |
452 | - if (strpos($geodir_map_options['height'], 'vh')) { |
|
453 | - ?> |
|
452 | + if (strpos($geodir_map_options['height'], 'vh')) { |
|
453 | + ?> |
|
454 | 454 | <script> |
455 | 455 | (function () { |
456 | 456 | var screenH = jQuery(window).height(); |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | |
473 | 473 | <?php |
474 | 474 | |
475 | - } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
476 | - ?> |
|
475 | + } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
476 | + ?> |
|
477 | 477 | <script> |
478 | 478 | (function () { |
479 | 479 | var screenH = jQuery(window).height(); |
@@ -488,20 +488,20 @@ discard block |
||
488 | 488 | }()); |
489 | 489 | </script> |
490 | 490 | <?php |
491 | - } |
|
491 | + } |
|
492 | 492 | |
493 | - /** |
|
494 | - * Action that runs after all the map code has been output; |
|
495 | - * |
|
496 | - * @since 1.5.3 |
|
497 | - * |
|
498 | - * @param array $geodir_map_options Array of map settings. |
|
499 | - * @param string $map_canvas_name The canvas name and ID for the map. |
|
500 | - */ |
|
501 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
493 | + /** |
|
494 | + * Action that runs after all the map code has been output; |
|
495 | + * |
|
496 | + * @since 1.5.3 |
|
497 | + * |
|
498 | + * @param array $geodir_map_options Array of map settings. |
|
499 | + * @param string $map_canvas_name The canvas name and ID for the map. |
|
500 | + */ |
|
501 | + do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
502 | 502 | |
503 | 503 | |
504 | - endif; // Exclude posttypes if end |
|
504 | + endif; // Exclude posttypes if end |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /** |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | |
130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
131 | 131 | } else { |
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
136 | 136 | } else { |
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | 170 | // Set default map options |
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true); |
|
173 | 173 | |
174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
175 | 175 | |
@@ -188,41 +188,41 @@ discard block |
||
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | 190 | ?> |
191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
197 | 197 | |
198 | 198 | <div class="map_background"> |
199 | 199 | <div class="top_banner_section_in clearfix"> |
200 | - <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
200 | + <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
204 | 204 | <!-- new map start --> |
205 | 205 | <div class="iprelative"> |
206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
210 | 210 | <!--<div id="home_map_counter"></div> --> |
211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
213 | - <div id="<?php echo $map_canvas_name;?>_map_notloaded" |
|
213 | + <div id="<?php echo $map_canvas_name; ?>_map_notloaded" |
|
214 | 214 | class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div> |
215 | 215 | </div> |
216 | 216 | <!-- new map end --> |
217 | 217 | </div> |
218 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
218 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
219 | 219 | </div> |
220 | 220 | </div> |
221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
222 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
222 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
223 | 223 | <?php } else { |
224 | 224 | ?> |
225 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
225 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
226 | 226 | <?php } |
227 | 227 | |
228 | 228 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | <div class="gd-input-group-addon gd-directions-right gd-mylocation-go"><input type="button" value="<?php _e('Get Directions', 'geodirectory'); ?>" class="<?php echo $map_canvas_name; ?>_getdirection" id="directions" onclick="calcRoute('<?php echo $map_canvas_name; ?>')" /></div> |
243 | 243 | </div> |
244 | 244 | <script> |
245 | - <?php if(geodir_is_page('detail')){?> |
|
245 | + <?php if (geodir_is_page('detail')) {?> |
|
246 | 246 | jQuery(function () { |
247 | 247 | gd_initialize_ac(); |
248 | 248 | }); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // Create the autocomplete object, restricting the search |
254 | 254 | // to geographical location types. |
255 | 255 | autocomplete = new google.maps.places.Autocomplete( |
256 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')), |
|
256 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')), |
|
257 | 257 | {types: ['geocode']}); |
258 | 258 | // When the user selects an address from the dropdown, |
259 | 259 | // populate the address fields in the form. |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | if (window.gdMaps == 'osm') { |
269 | 269 | window.setTimeout(function() { |
270 | - calcRoute('<?php echo $map_canvas_name;?>'); |
|
270 | + calcRoute('<?php echo $map_canvas_name; ?>'); |
|
271 | 271 | }, 1000); |
272 | 272 | } |
273 | 273 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
323 | 323 | ?> |
324 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
324 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
325 | 325 | <?php |
326 | 326 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
327 | 327 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | } |
332 | 332 | ?> |
333 | 333 | <div |
334 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
334 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
335 | 335 | <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
336 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
337 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
338 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?> |
|
339 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
336 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
337 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
338 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?> |
|
339 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
340 | 340 | <input |
341 | 341 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}" |
342 | 342 | type="text" |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
349 | 349 | <?php } else {$child_collapse = "0"; |
350 | 350 | ?> |
351 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
351 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
352 | 352 | <?php } ?> |
353 | 353 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
354 | 354 | <div class="geodir_toggle"> |
355 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
355 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
356 | 356 | <script>jQuery( document ).ready(function() { |
357 | 357 | geodir_show_sub_cat_collapse_button(); |
358 | 358 | });</script> |
@@ -380,21 +380,21 @@ discard block |
||
380 | 380 | $city = $country != 'me' ? $city : ''; |
381 | 381 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
382 | 382 | ?> |
383 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
384 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
385 | - value="<?php echo $country;?>"/> |
|
386 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
387 | - value="<?php echo $region;?>"/> |
|
388 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
389 | - value="<?php echo $city;?>"/> |
|
390 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
391 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
383 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
384 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
385 | + value="<?php echo $country; ?>"/> |
|
386 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
387 | + value="<?php echo $region; ?>"/> |
|
388 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
389 | + value="<?php echo $city; ?>"/> |
|
390 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
391 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
392 | 392 | <?php } else { //end of location filter |
393 | 393 | ?> |
394 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
394 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
395 | 395 | <?php }?> |
396 | 396 | |
397 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
397 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
398 | 398 | |
399 | 399 | <input type="hidden" name="limitstart" value=""/> |
400 | 400 | |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | |
403 | 403 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
404 | 404 | $post_types = geodir_get_posttypes('object'); |
405 | - if (count((array)($post_types)) > 1) { |
|
405 | + if (count((array) ($post_types)) > 1) { |
|
406 | 406 | ?> |
407 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
408 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
407 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
408 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
409 | 409 | |
410 | 410 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
411 | 411 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | foreach ($post_types as $post_type => $args) { |
417 | 417 | if (!in_array($post_type, $exclude_post_types)) { |
418 | 418 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
419 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>'; |
|
419 | + echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__($args->labels->name, 'geodirectory').'</a></li>'; |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | ?> |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | <script type="text/javascript"> |
442 | 442 | |
443 | 443 | jQuery(document).ready(function () { |
444 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice |
|
445 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false); |
|
446 | - map_sticky('<?php echo $map_canvas_name;?>'); |
|
444 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice |
|
445 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false); |
|
446 | + map_sticky('<?php echo $map_canvas_name; ?>'); |
|
447 | 447 | }); |
448 | 448 | |
449 | 449 | </script> |
@@ -454,18 +454,18 @@ discard block |
||
454 | 454 | <script> |
455 | 455 | (function () { |
456 | 456 | var screenH = jQuery(window).height(); |
457 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>"; |
|
457 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>"; |
|
458 | 458 | |
459 | 459 | var ptypeH = ''; |
460 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
461 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
460 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
461 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
462 | 462 | } |
463 | 463 | |
464 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
465 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
466 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px'); |
|
467 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
468 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
464 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
465 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
466 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px'); |
|
467 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
468 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
469 | 469 | |
470 | 470 | }()); |
471 | 471 | </script> |
@@ -477,13 +477,13 @@ discard block |
||
477 | 477 | <script> |
478 | 478 | (function () { |
479 | 479 | var screenH = jQuery(window).height(); |
480 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>"; |
|
480 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>"; |
|
481 | 481 | var ptypeH = ''; |
482 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
483 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
482 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
483 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
484 | 484 | } |
485 | 485 | |
486 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
486 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
487 | 487 | |
488 | 488 | }()); |
489 | 489 | </script> |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | * @param array $geodir_map_options Array of map settings. |
499 | 499 | * @param string $map_canvas_name The canvas name and ID for the map. |
500 | 500 | */ |
501 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
501 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name); |
|
502 | 502 | |
503 | 503 | |
504 | 504 | endif; // Exclude posttypes if end |