Test Failed
Pull Request — master (#456)
by Kiran
14:51
created
geodirectory-widgets/listing_map_widget.php 3 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function init_listing_map_script()
20 20
 {
21
-    global $list_map_json;
21
+	global $list_map_json;
22 22
 
23
-    $list_map_json = array();
23
+	$list_map_json = array();
24 24
 
25 25
 }
26 26
 
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function create_list_jsondata($post)
37 37
 {
38
-    global $wpdb, $list_map_json, $add_post_in_marker_array;
39
-
40
-    if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
-        /**
42
-         * Filter the json data for search listing map.
43
-         *
44
-         * @since 1.5.7
45
-         * @param string $post->marker_json JSON representation of the post marker info.
46
-         * @param object $post The post object.
47
-         */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
-    }
38
+	global $wpdb, $list_map_json, $add_post_in_marker_array;
39
+
40
+	if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
+		/**
42
+		 * Filter the json data for search listing map.
43
+		 *
44
+		 * @since 1.5.7
45
+		 * @param string $post->marker_json JSON representation of the post marker info.
46
+		 * @param object $post The post object.
47
+		 */
48
+		$list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,29 +59,29 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function show_listing_widget_map()
61 61
 {
62
-    global $list_map_json;
62
+	global $list_map_json;
63 63
 
64
-    if (!empty($list_map_json)) {
65
-        $list_map_json = array_unique($list_map_json);
66
-        $cat_content_info[] = implode(',', $list_map_json);
67
-    }
64
+	if (!empty($list_map_json)) {
65
+		$list_map_json = array_unique($list_map_json);
66
+		$cat_content_info[] = implode(',', $list_map_json);
67
+	}
68 68
 
69
-    $totalcount = count(array_unique($list_map_json));
69
+	$totalcount = count(array_unique($list_map_json));
70 70
 
71 71
 
72
-    if (!empty($cat_content_info)) {
73
-        $json_content = substr(implode(',', $cat_content_info), 1);
74
-        $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
-        $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
77
-    } else {
78
-        $list_json = '[{"totalcount":"0"}]';
79
-    }
72
+	if (!empty($cat_content_info)) {
73
+		$json_content = substr(implode(',', $cat_content_info), 1);
74
+		$json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
+		$json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
+		$list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
77
+	} else {
78
+		$list_json = '[{"totalcount":"0"}]';
79
+	}
80 80
 
81
-    $listing_map_args = array('list_json' => $list_json);
81
+	$listing_map_args = array('list_json' => $list_json);
82 82
 
83
-    // Pass the json data in listing map script
84
-    wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
83
+	// Pass the json data in listing map script
84
+	wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
85 85
 
86 86
 }
87 87
 
@@ -93,110 +93,110 @@  discard block
 block discarded – undo
93 93
 class geodir_map_listingpage extends WP_Widget
94 94
 {
95 95
 
96
-    /**
96
+	/**
97 97
 	 * Register the listing page map widget.
98 98
 	 *
99 99
 	 * @since 1.0.0
100
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
100
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
101 101
 	 */
102
-    public function __construct() {
103
-        $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
104
-        parent::__construct(
105
-            'geodir_map_v3_listing_map', // Base ID
106
-            __('GD > GMap - Listing page', 'geodirectory'), // Name
107
-            $widget_ops// Args
108
-        );
102
+	public function __construct() {
103
+		$widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
104
+		parent::__construct(
105
+			'geodir_map_v3_listing_map', // Base ID
106
+			__('GD > GMap - Listing page', 'geodirectory'), // Name
107
+			$widget_ops// Args
108
+		);
109 109
 
110
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
110
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
111 111
 
112
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
112
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
113 113
 
114
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
115
-    }
114
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
115
+	}
116 116
 
117 117
 	/**
118 118
 	 * Front-end display content for listing page map widget.
119 119
 	 *
120 120
 	 * @since 1.0.0
121
-     * @since 1.5.1 Declare function public.
121
+	 * @since 1.5.1 Declare function public.
122
+	 *
123
+	 * @global object $post The current post object.
122 124
 	 *
123
-     * @global object $post The current post object.
124
-     *
125 125
 	 * @param array $args     Widget arguments.
126 126
 	 * @param array $instance Saved values from database.
127 127
 	 */
128
-    public function widget($args, $instance)
129
-    {
130
-
131
-        if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
132
-            || geodir_is_page('detail')
133
-        ) :
134
-
135
-            extract($args, EXTR_SKIP);
136
-            /** This action is documented in geodirectory_shortcodes.php */
137
-            $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
138
-            /** This action is documented in geodirectory_shortcodes.php */
139
-            $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
140
-            /** This action is documented in geodirectory_shortcodes.php */
141
-            $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
142
-            /** This action is documented in geodirectory_shortcodes.php */
143
-            $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
144
-            /** This action is documented in geodirectory_shortcodes.php */
145
-            $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
146
-            /**
147
-             * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
148
-             *
149
-             * @since 1.0.0
150
-             * @param bool $sticky True if should be sticky, false if not
151
-             */
152
-            $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
153
-            /** This action is documented in geodirectory_shortcodes.php */
154
-            $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
155
-            $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
128
+	public function widget($args, $instance)
129
+	{
130
+
131
+		if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
132
+			|| geodir_is_page('detail')
133
+		) :
134
+
135
+			extract($args, EXTR_SKIP);
136
+			/** This action is documented in geodirectory_shortcodes.php */
137
+			$width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
138
+			/** This action is documented in geodirectory_shortcodes.php */
139
+			$height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
140
+			/** This action is documented in geodirectory_shortcodes.php */
141
+			$maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
142
+			/** This action is documented in geodirectory_shortcodes.php */
143
+			$zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
144
+			/** This action is documented in geodirectory_shortcodes.php */
145
+			$autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
146
+			/**
147
+			 * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
148
+			 *
149
+			 * @since 1.0.0
150
+			 * @param bool $sticky True if should be sticky, false if not
151
+			 */
152
+			$sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
153
+			/** This action is documented in geodirectory_shortcodes.php */
154
+			$scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
155
+			$showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
156 156
 			
157 157
 			/**
158
-             * Filter the listing map should to be displayed or not.
159
-             *
160
-             * @since 1.4.6
158
+			 * Filter the listing map should to be displayed or not.
161 159
 			 *
162
-             * @param bool $display true if map should be displayed, false if not.
163
-             */
160
+			 * @since 1.4.6
161
+			 *
162
+			 * @param bool $display true if map should be displayed, false if not.
163
+			 */
164 164
 			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
165 165
 			if ( !$show_map ) {
166 166
 				return;
167 167
 			}
168 168
 
169
-            $map_args = array();
170
-            $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
171
-            $map_args['width'] = $width;
172
-            $map_args['height'] = $height;
173
-
174
-            $map_args['scrollwheel'] = $scrollwheel;
175
-            $map_args['showall'] = $showall;
176
-            $map_args['child_collapse'] = '0';
177
-            $map_args['sticky'] = $sticky;
178
-            $map_args['enable_cat_filters'] = false;
179
-            $map_args['enable_text_search'] = false;
180
-            $map_args['enable_post_type_filters'] = false;
181
-            $map_args['enable_location_filters'] = false;
182
-            $map_args['enable_jason_on_load'] = true;
169
+			$map_args = array();
170
+			$map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
171
+			$map_args['width'] = $width;
172
+			$map_args['height'] = $height;
173
+
174
+			$map_args['scrollwheel'] = $scrollwheel;
175
+			$map_args['showall'] = $showall;
176
+			$map_args['child_collapse'] = '0';
177
+			$map_args['sticky'] = $sticky;
178
+			$map_args['enable_cat_filters'] = false;
179
+			$map_args['enable_text_search'] = false;
180
+			$map_args['enable_post_type_filters'] = false;
181
+			$map_args['enable_location_filters'] = false;
182
+			$map_args['enable_jason_on_load'] = true;
183 183
 			
184
-            if (is_single()) {
184
+			if (is_single()) {
185 185
 
186
-                global $post;
187
-                $map_default_lat = $address_latitude = $post->post_latitude;
188
-                $map_default_lng = $address_longitude = $post->post_longitude;
189
-                $mapview = $post->post_mapview;
190
-                $mapzoom = $post->post_mapzoom;
191
-                $map_args['map_class_name'] = 'geodir-map-listing-page-single';
186
+				global $post;
187
+				$map_default_lat = $address_latitude = $post->post_latitude;
188
+				$map_default_lng = $address_longitude = $post->post_longitude;
189
+				$mapview = $post->post_mapview;
190
+				$mapzoom = $post->post_mapzoom;
191
+				$map_args['map_class_name'] = 'geodir-map-listing-page-single';
192 192
 
193
-            } else {
194
-                $default_location = geodir_get_default_location();
193
+			} else {
194
+				$default_location = geodir_get_default_location();
195 195
 
196
-                $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
197
-                $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
198
-                $map_args['map_class_name'] = 'geodir-map-listing-page';
199
-                $mapview = $maptype;
196
+				$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
197
+				$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
198
+				$map_args['map_class_name'] = 'geodir-map-listing-page';
199
+				$mapview = $maptype;
200 200
 
201 201
 				if ( geodir_is_page( 'search' ) ) {
202 202
 					$map_default_lat = '';
@@ -213,83 +213,83 @@  discard block
 block discarded – undo
213 213
 						}
214 214
 					}
215 215
 				}
216
-            }
217
-
218
-            if (empty($mapzoom)) $mapzoom = $zoom;
219
-
220
-            // Set default map options
221
-            $map_args['ajax_url'] = geodir_get_ajax_url();
222
-            $map_args['latitude'] = $map_default_lat;
223
-            $map_args['longitude'] = $map_default_lng;
224
-            $map_args['zoom'] = $zoom;
225
-            //$map_args['scrollwheel'] = true;
226
-            $map_args['scrollwheel'] = $scrollwheel;
227
-            $map_args['showall'] = $showall;
228
-            $map_args['streetViewControl'] = true;
229
-            $map_args['maptype'] = $maptype;
230
-            $map_args['showPreview'] = '0';
231
-            $map_args['maxZoom'] = 21;
232
-            $map_args['autozoom'] = $autozoom;
233
-            $map_args['bubble_size'] = 'small';
216
+			}
217
+
218
+			if (empty($mapzoom)) $mapzoom = $zoom;
219
+
220
+			// Set default map options
221
+			$map_args['ajax_url'] = geodir_get_ajax_url();
222
+			$map_args['latitude'] = $map_default_lat;
223
+			$map_args['longitude'] = $map_default_lng;
224
+			$map_args['zoom'] = $zoom;
225
+			//$map_args['scrollwheel'] = true;
226
+			$map_args['scrollwheel'] = $scrollwheel;
227
+			$map_args['showall'] = $showall;
228
+			$map_args['streetViewControl'] = true;
229
+			$map_args['maptype'] = $maptype;
230
+			$map_args['showPreview'] = '0';
231
+			$map_args['maxZoom'] = 21;
232
+			$map_args['autozoom'] = $autozoom;
233
+			$map_args['bubble_size'] = 'small';
234 234
             
235
-            $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
235
+			$map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
236 236
 
237
-            echo $before_widget;
238
-            geodir_draw_map($map_args);
239
-            echo $after_widget;
237
+			echo $before_widget;
238
+			geodir_draw_map($map_args);
239
+			echo $after_widget;
240 240
 
241
-        endif;
242
-    }
241
+		endif;
242
+	}
243 243
 
244 244
 	/**
245 245
 	 * Sanitize listing page map widget form values as they are saved.
246 246
 	 *
247 247
 	 * @since 1.0.0
248
-     * @since 1.5.1 Declare function public.
248
+	 * @since 1.5.1 Declare function public.
249 249
 	 *
250 250
 	 * @param array $new_instance Values just sent to be saved.
251 251
 	 * @param array $old_instance Previously saved values from database.
252 252
 	 *
253 253
 	 * @return array Updated safe values to be saved.
254 254
 	 */
255
-    public function update($new_instance, $old_instance) {
256
-        //save the widget
257
-        $instance = $old_instance;
258
-        $instance['width'] = strip_tags($new_instance['width']);
259
-        $instance['heigh'] = ($new_instance['heigh']);
260
-        $instance['maptype'] = ($new_instance['maptype']);
261
-        $instance['zoom'] = ($new_instance['zoom']);
262
-        $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
263
-        $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
264
-        $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
265
-        $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
266
-        $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
267
-
268
-        return $instance;
269
-    }
255
+	public function update($new_instance, $old_instance) {
256
+		//save the widget
257
+		$instance = $old_instance;
258
+		$instance['width'] = strip_tags($new_instance['width']);
259
+		$instance['heigh'] = ($new_instance['heigh']);
260
+		$instance['maptype'] = ($new_instance['maptype']);
261
+		$instance['zoom'] = ($new_instance['zoom']);
262
+		$instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
263
+		$instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
264
+		$instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
265
+		$instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
266
+		$instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
267
+
268
+		return $instance;
269
+	}
270 270
 
271 271
 	/**
272 272
 	 * Back-end listing page map widget settings form.
273 273
 	 *
274 274
 	 * @since 1.0.0
275
-     * @since 1.5.1 Declare function public.
275
+	 * @since 1.5.1 Declare function public.
276 276
 	 *
277 277
 	 * @param array $instance Previously saved values from database.
278 278
 	 */
279
-    public function form($instance) {
280
-        // widget form in backend
281
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
279
+	public function form($instance) {
280
+		// widget form in backend
281
+		$instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
282 282
         
283
-        $width = strip_tags($instance['width']);
284
-        $heigh = strip_tags($instance['heigh']);
285
-        $maptype = strip_tags($instance['maptype']);
286
-        $zoom = strip_tags($instance['zoom']);
287
-        $autozoom = strip_tags($instance['autozoom']);
288
-        $sticky = strip_tags($instance['sticky']);
289
-        $scrollwheel = strip_tags($instance['scrollwheel']);
290
-        $showall = strip_tags($instance['showall']);
291
-        $marker_cluster = (int)$instance['marker_cluster'];
292
-        ?>
283
+		$width = strip_tags($instance['width']);
284
+		$heigh = strip_tags($instance['heigh']);
285
+		$maptype = strip_tags($instance['maptype']);
286
+		$zoom = strip_tags($instance['zoom']);
287
+		$autozoom = strip_tags($instance['autozoom']);
288
+		$sticky = strip_tags($instance['sticky']);
289
+		$scrollwheel = strip_tags($instance['scrollwheel']);
290
+		$showall = strip_tags($instance['showall']);
291
+		$marker_cluster = (int)$instance['marker_cluster'];
292
+		?>
293 293
         <p>
294 294
             <label
295 295
                 for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?>
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
                         name="<?php echo $this->get_field_name('maptype'); ?>">
319 319
 
320 320
                     <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
321
-                        echo 'selected="selected"';
322
-                    } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
321
+						echo 'selected="selected"';
322
+					} ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
323 323
                     <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
324
-                        echo 'selected="selected"';
325
-                    } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
324
+						echo 'selected="selected"';
325
+					} ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
326 326
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
327
-                        echo 'selected="selected"';
328
-                    } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
327
+						echo 'selected="selected"';
328
+					} ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
329 329
 					<option <?php selected($maptype, 'TERRAIN');?> 
330 330
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
331 331
                 </select>
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
         </p>
334 334
 
335 335
         <?php
336
-        $map_zoom_level = geodir_map_zoom_level();
337
-        ?>
336
+		$map_zoom_level = geodir_map_zoom_level();
337
+		?>
338 338
 
339 339
         <p>
340 340
             <label
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
                 <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
345 345
                         name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
346 346
 
347
-                    foreach ($map_zoom_level as $level) {
348
-                        $selected = '';
349
-                        if ($level == $zoom)
350
-                            $selected = 'selected="selected"';
347
+					foreach ($map_zoom_level as $level) {
348
+						$selected = '';
349
+						if ($level == $zoom)
350
+							$selected = 'selected="selected"';
351 351
 
352
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
352
+						echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
353 353
 
354
-                    } ?>
354
+					} ?>
355 355
 
356 356
                 </select>
357 357
 
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
                 for="<?php echo $this->get_field_id('autozoom'); ?>">
364 364
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
365 365
                        name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
366
-                    echo 'checked="checked"';
367
-                } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
366
+					echo 'checked="checked"';
367
+				} ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
368 368
         </p>
369 369
 
370 370
         <p>
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
                 for="<?php echo $this->get_field_id('sticky'); ?>">
373 373
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>"
374 374
                        name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) {
375
-                    echo 'checked="checked"';
376
-                } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
375
+					echo 'checked="checked"';
376
+				} ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
377 377
             </label>
378 378
         </p>
379 379
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     </p> -->
400 400
 
401 401
     <?php
402
-    }
402
+	}
403 403
 } // class geodir_map_listingpage
404 404
 
405 405
 register_widget('geodir_map_listingpage');
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
          * @param string $post->marker_json JSON representation of the post marker info.
46 46
          * @param object $post The post object.
47 47
          */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
48
+        $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post);
49 49
     }
50 50
 
51 51
 }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $json_content = substr(implode(',', $cat_content_info), 1);
74 74
         $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75 75
         $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
76
+        $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
77 77
     } else {
78 78
         $list_json = '[{"totalcount":"0"}]';
79 79
     }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 			 *
162 162
              * @param bool $display true if map should be displayed, false if not.
163 163
              */
164
-			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
165
-			if ( !$show_map ) {
164
+			$show_map = apply_filters('geodir_show_map_listing', $display = true);
165
+			if (!$show_map) {
166 166
 				return;
167 167
 			}
168 168
 
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
                 $map_args['map_class_name'] = 'geodir-map-listing-page';
199 199
                 $mapview = $maptype;
200 200
 
201
-				if ( geodir_is_page( 'search' ) ) {
201
+				if (geodir_is_page('search')) {
202 202
 					$map_default_lat = '';
203 203
 					$map_default_lng = '';
204
-					if ( isset( $_REQUEST['sgeo_lat'] ) && isset( $_REQUEST['sgeo_lon'] ) ) {
205
-						$map_default_lat = (float)sanitize_text_field( $_REQUEST['sgeo_lat'] );
206
-						$map_default_lng = (float)sanitize_text_field( $_REQUEST['sgeo_lon'] );
204
+					if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon'])) {
205
+						$map_default_lat = (float) sanitize_text_field($_REQUEST['sgeo_lat']);
206
+						$map_default_lng = (float) sanitize_text_field($_REQUEST['sgeo_lon']);
207 207
 					}
208
-					if ( empty( $map_default_lat ) && empty( $map_default_lng ) && ! empty( $_REQUEST['set_location_type'] ) && ! empty( $_REQUEST['set_location_val'] ) && function_exists( 'geodir_get_location_by_id' ) ) {
209
-						$location = geodir_get_location_by_id( '', (int)$_REQUEST['set_location_val'] );
210
-						if ( ! empty( $location ) ) {
208
+					if (empty($map_default_lat) && empty($map_default_lng) && !empty($_REQUEST['set_location_type']) && !empty($_REQUEST['set_location_val']) && function_exists('geodir_get_location_by_id')) {
209
+						$location = geodir_get_location_by_id('', (int) $_REQUEST['set_location_val']);
210
+						if (!empty($location)) {
211 211
 							$map_default_lat = $location->city_latitude;
212 212
 							$map_default_lng = $location->city_longitude;
213 213
 						}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
     public function form($instance) {
280 280
         // widget form in backend
281
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
281
+        $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
282 282
         
283 283
         $width = strip_tags($instance['width']);
284 284
         $heigh = strip_tags($instance['heigh']);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $sticky = strip_tags($instance['sticky']);
289 289
         $scrollwheel = strip_tags($instance['scrollwheel']);
290 290
         $showall = strip_tags($instance['showall']);
291
-        $marker_cluster = (int)$instance['marker_cluster'];
291
+        $marker_cluster = (int) $instance['marker_cluster'];
292 292
         ?>
293 293
         <p>
294 294
             <label
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
327 327
                         echo 'selected="selected"';
328 328
                     } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
329
-					<option <?php selected($maptype, 'TERRAIN');?> 
329
+					<option <?php selected($maptype, 'TERRAIN'); ?> 
330 330
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
331 331
                 </select>
332 332
             </label>
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                         if ($level == $zoom)
350 350
                             $selected = 'selected="selected"';
351 351
 
352
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
352
+                        echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>';
353 353
 
354 354
                     } ?>
355 355
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                 for="<?php echo $this->get_field_id('scrollwheel'); ?>">
383 383
                 <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
384 384
                        name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
385
-                       <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
385
+                       <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
386 386
             </label>
387 387
         </p>
388 388
         <?php if (defined('GDCLUSTER_VERSION')) { ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -215,7 +215,9 @@  discard block
 block discarded – undo
215 215
 				}
216 216
             }
217 217
 
218
-            if (empty($mapzoom)) $mapzoom = $zoom;
218
+            if (empty($mapzoom)) {
219
+            	$mapzoom = $zoom;
220
+            }
219 221
 
220 222
             // Set default map options
221 223
             $map_args['ajax_url'] = geodir_get_ajax_url();
@@ -346,8 +348,9 @@  discard block
 block discarded – undo
346 348
 
347 349
                     foreach ($map_zoom_level as $level) {
348 350
                         $selected = '';
349
-                        if ($level == $zoom)
350
-                            $selected = 'selected="selected"';
351
+                        if ($level == $zoom) {
352
+                                                    $selected = 'selected="selected"';
353
+                        }
351 354
 
352 355
                         echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
353 356
 
Please login to merge, or discard this patch.