Test Failed
Pull Request — master (#341)
by Kiran
32:58
created
geodirectory-functions/map-functions/map_template_tags.php 1 patch
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -67,77 +67,77 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 /**
Please login to merge, or discard this patch.