Test Failed
Push — master ( 64deb5...8339b1 )
by Stiofan
09:03
created
geodirectory-functions/map-functions/map_functions.php 2 patches
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function  geodir_init_map_jason()
17 17
 {
18
-    global $map_jason;
19
-    $map_jason = array();
18
+	global $map_jason;
19
+	$map_jason = array();
20 20
 }
21 21
 
22 22
 /**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function geodir_init_map_canvas_array()
30 30
 {
31
-    global $map_canvas_arr;
32
-    $map_canvas_arr = array();
31
+	global $map_canvas_arr;
32
+	$map_canvas_arr = array();
33 33
 }
34 34
 
35 35
 
@@ -50,50 +50,50 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function create_marker_jason_of_posts($post)
52 52
 {
53
-    global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
53
+	global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
54 54
 
55
-    if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
55
+	if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+		if(isset($map_jason[$post->ID])){return null;}
58 58
 
59
-        $srcharr = array("'", "/", "-", '"', '\\');
60
-        $replarr = array("′", "⁄", "–", "“", '');
59
+		$srcharr = array("'", "/", "-", '"', '\\');
60
+		$replarr = array("′", "⁄", "–", "“", '');
61 61
 
62 62
 
63
-        $geodir_cat_icons = geodir_get_term_icon();
64
-        $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
63
+		$geodir_cat_icons = geodir_get_term_icon();
64
+		$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
65 65
 
66
-        $post_title = $post->post_title;
67
-        $title = str_replace($srcharr, $replarr, $post_title);
66
+		$post_title = $post->post_title;
67
+		$title = str_replace($srcharr, $replarr, $post_title);
68 68
 
69
-        if (is_ssl()) {
70
-            $icon = str_replace("http:","https:",$icon );
71
-        }
69
+		if (is_ssl()) {
70
+			$icon = str_replace("http:","https:",$icon );
71
+		}
72 72
         
73
-        if ($icon != '') {
74
-            $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
73
+		if ($icon != '') {
74
+			$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
75 75
             
76
-            if (isset($gd_marker_sizes[$icon])) {
77
-                $icon_size = $gd_marker_sizes[$icon];
78
-            } else {
79
-                $icon_size = geodir_get_marker_size($icon);
80
-                $gd_marker_sizes[$icon] = $icon_size;
81
-            }               
82
-        } else {
83
-            $icon_size = array('w' => 36, 'h' => 45);
84
-        }
85
-
86
-        $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
87
-
88
-        /**
89
-         * Filter the json data when creating output for post json marker..
90
-         *
91
-         * @since 1.5.7
92
-         * @param string $post_json JSON representation of the post marker info.
93
-         * @param object $post The post object.
94
-         */
95
-        $map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
96
-    }
76
+			if (isset($gd_marker_sizes[$icon])) {
77
+				$icon_size = $gd_marker_sizes[$icon];
78
+			} else {
79
+				$icon_size = geodir_get_marker_size($icon);
80
+				$gd_marker_sizes[$icon] = $icon_size;
81
+			}               
82
+		} else {
83
+			$icon_size = array('w' => 36, 'h' => 45);
84
+		}
85
+
86
+		$post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
87
+
88
+		/**
89
+		 * Filter the json data when creating output for post json marker..
90
+		 *
91
+		 * @since 1.5.7
92
+		 * @param string $post_json JSON representation of the post marker info.
93
+		 * @param object $post The post object.
94
+		 */
95
+		$map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
96
+	}
97 97
 }
98 98
 
99 99
 /**
@@ -106,66 +106,66 @@  discard block
 block discarded – undo
106 106
  */
107 107
 function send_marker_jason_to_js()
108 108
 {
109
-    global $map_jason, $map_canvas_arr;
110
-
111
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
112
-        foreach ($map_canvas_arr as $canvas => $jason) {
113
-            if (is_array($map_jason) && !empty($map_jason)) {
114
-
115
-                // on details page only show the main marker on the map
116
-                if(geodir_is_page('detail')){
117
-                    global $post;
118
-                    if(isset($map_jason[$post->ID])){
119
-                        $map_jason = array($map_jason[$post->ID]);
120
-                    }
121
-                }
122
-                $canvas_jason = $canvas . "_jason";
123
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
124
-                unset($cat_content_info);
125
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
126
-                $totalcount = count(array_unique($map_jason));
127
-                if (!empty($cat_content_info)) {
128
-                    $json_content = substr(implode(',', $cat_content_info), 1);
129
-                    $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
130
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
131
-                } else {
132
-                    $canvas_jason = '[{"totalcount":"0"}]';
133
-                }
134
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
135
-
136
-                /**
137
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
138
-                 *
139
-                 * You can use this filter to modify map canvas json args.
140
-                 *
141
-                 * @since 1.0.0
142
-                 * @package GeoDirectory
143
-                 * @param string $canvas Map canvas array key.
144
-                 * @param array $map_canvas_jason_args Map canvas args.
145
-                 */
146
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
147
-
148
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
149
-            } else {
150
-                $canvas_jason = '[{"totalcount":"0"}]';
151
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
152
-
153
-                /**
154
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
155
-                 *
156
-                 * You can use this filter to modify map canvas json args.
157
-                 *
158
-                 * @since 1.0.0
159
-                 * @package GeoDirectory
160
-                 * @param string $canvas Map canvas array key.
161
-                 * @param array $map_canvas_jason_args Map canvas args.
162
-                 */
163
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
164
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
165
-            }
166
-        }
167
-
168
-    }
109
+	global $map_jason, $map_canvas_arr;
110
+
111
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
112
+		foreach ($map_canvas_arr as $canvas => $jason) {
113
+			if (is_array($map_jason) && !empty($map_jason)) {
114
+
115
+				// on details page only show the main marker on the map
116
+				if(geodir_is_page('detail')){
117
+					global $post;
118
+					if(isset($map_jason[$post->ID])){
119
+						$map_jason = array($map_jason[$post->ID]);
120
+					}
121
+				}
122
+				$canvas_jason = $canvas . "_jason";
123
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
124
+				unset($cat_content_info);
125
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
126
+				$totalcount = count(array_unique($map_jason));
127
+				if (!empty($cat_content_info)) {
128
+					$json_content = substr(implode(',', $cat_content_info), 1);
129
+					$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
130
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
131
+				} else {
132
+					$canvas_jason = '[{"totalcount":"0"}]';
133
+				}
134
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
135
+
136
+				/**
137
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
138
+				 *
139
+				 * You can use this filter to modify map canvas json args.
140
+				 *
141
+				 * @since 1.0.0
142
+				 * @package GeoDirectory
143
+				 * @param string $canvas Map canvas array key.
144
+				 * @param array $map_canvas_jason_args Map canvas args.
145
+				 */
146
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
147
+
148
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
149
+			} else {
150
+				$canvas_jason = '[{"totalcount":"0"}]';
151
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
152
+
153
+				/**
154
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
155
+				 *
156
+				 * You can use this filter to modify map canvas json args.
157
+				 *
158
+				 * @since 1.0.0
159
+				 * @package GeoDirectory
160
+				 * @param string $canvas Map canvas array key.
161
+				 * @param array $map_canvas_jason_args Map canvas args.
162
+				 */
163
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
164
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
165
+			}
166
+		}
167
+
168
+	}
169 169
 }
170 170
 
171 171
 /**
@@ -184,92 +184,92 @@  discard block
 block discarded – undo
184 184
  */
185 185
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
186 186
 {
187
-    global $cat_count, $geodir_cat_icons;
187
+	global $cat_count, $geodir_cat_icons;
188 188
 
189
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
190
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
189
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
190
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
191 191
 
192
-    // check if exclude categories saved before fix of categories identical names
193
-    if ($exclude_categories_new) {
194
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
195
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
196
-    }
192
+	// check if exclude categories saved before fix of categories identical names
193
+	if ($exclude_categories_new) {
194
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
195
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
196
+	}
197 197
 
198
-    $exclude_cat_str = implode(',', $exclude_categories);
198
+	$exclude_cat_str = implode(',', $exclude_categories);
199 199
 
200
-    if ($exclude_cat_str == '') {
201
-        $exclude_cat_str = '0';
202
-    }
200
+	if ($exclude_cat_str == '') {
201
+		$exclude_cat_str = '0';
202
+	}
203 203
 
204
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
204
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
205 205
 
206
-    if ($hide_empty) {
207
-        $cat_terms = geodir_filter_empty_terms($cat_terms);
208
-    }
206
+	if ($hide_empty) {
207
+		$cat_terms = geodir_filter_empty_terms($cat_terms);
208
+	}
209 209
 
210
-    $main_list_class = '';
211
-    //If there are terms, start displaying
212
-    if (count($cat_terms) > 0) {
213
-        //Displaying as a list
214
-        $p = $pading * 15;
215
-        $pading++;
210
+	$main_list_class = '';
211
+	//If there are terms, start displaying
212
+	if (count($cat_terms) > 0) {
213
+		//Displaying as a list
214
+		$p = $pading * 15;
215
+		$pading++;
216 216
 
217
-        if ($cat_parent == 0) {
218
-            $list_class = 'main_list';
219
-            $display = '';
220
-        } else {
221
-            $list_class = 'sub_list';
222
-            $display = !$child_collapse ? '' : 'display:none';
223
-        }
217
+		if ($cat_parent == 0) {
218
+			$list_class = 'main_list';
219
+			$display = '';
220
+		} else {
221
+			$list_class = 'sub_list';
222
+			$display = !$child_collapse ? '' : 'display:none';
223
+		}
224 224
 
225 225
 
226
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
226
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
227 227
 
228
-        $geodir_cat_icons = geodir_get_term_icon();
228
+		$geodir_cat_icons = geodir_get_term_icon();
229 229
 
230
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
231
-        $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
232
-        foreach ($cat_terms as $cat_term):
230
+		$geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
231
+		$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
232
+		foreach ($cat_terms as $cat_term):
233 233
 
234 234
 
235 235
 
236
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
236
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
237 237
 
238
-            if (!in_array($cat_term->term_id, $exclude_categories)):
239
-                //Secret sauce.  Function calls itself to display child elements, if any
240
-                $checked = 'checked="checked"';
238
+			if (!in_array($cat_term->term_id, $exclude_categories)):
239
+				//Secret sauce.  Function calls itself to display child elements, if any
240
+				$checked = 'checked="checked"';
241 241
 
242
-                // Untick the category by default on home map
243
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
244
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
245
-                        $checked = '';
246
-                    }
247
-                }
242
+				// Untick the category by default on home map
243
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
244
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
245
+						$checked = '';
246
+					}
247
+				}
248 248
 
249
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
250
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
251
-                $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
252
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
253
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
249
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
250
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
251
+				$term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
252
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
253
+				$out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
254 254
 
255
-            endif;
255
+			endif;
256 256
 
257 257
 
258
-            // get sub category by recursion
259
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
258
+			// get sub category by recursion
259
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
260 260
 
261
-            $out .= '</li>';
261
+			$out .= '</li>';
262 262
 
263
-        endforeach;
263
+		endforeach;
264 264
 
265
-        $out .= '</ul>';
265
+		$out .= '</ul>';
266 266
 
267
-        return $out;
268
-    } else {
269
-        if ($cat_parent == 0)
270
-            return _e('No category', 'geodirectory');
271
-    }
272
-    return;
267
+		return $out;
268
+	} else {
269
+		if ($cat_parent == 0)
270
+			return _e('No category', 'geodirectory');
271
+	}
272
+	return;
273 273
 }
274 274
 
275 275
 /**
@@ -281,19 +281,19 @@  discard block
 block discarded – undo
281 281
  * @return string The map API provider name.
282 282
  */
283 283
 function geodir_map_name() {
284
-    $geodir_map_name = get_option('geodir_load_map', 'google');
284
+	$geodir_map_name = get_option('geodir_load_map', 'google');
285 285
     
286
-    if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
287
-        $geodir_map_name = 'auto';
288
-    }
289
-
290
-    /**
291
-     * Filter the map JS API provider name.
292
-     *
293
-     * @since 1.6.1
294
-     * @param string $geodir_map_name The map API provider name.
295
-     */
296
-    return apply_filters('geodir_map_name', $geodir_map_name);
286
+	if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
287
+		$geodir_map_name = 'auto';
288
+	}
289
+
290
+	/**
291
+	 * Filter the map JS API provider name.
292
+	 *
293
+	 * @since 1.6.1
294
+	 * @param string $geodir_map_name The map API provider name.
295
+	 */
296
+	return apply_filters('geodir_map_name', $geodir_map_name);
297 297
 }
298 298
 
299 299
 /**
@@ -309,48 +309,48 @@  discard block
 block discarded – undo
309 309
  * @return array The icon size.
310 310
  */
311 311
 function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
312
-    global $gd_marker_sizes;
312
+	global $gd_marker_sizes;
313 313
     
314
-    if (empty($gd_marker_sizes)) {
315
-        $gd_marker_sizes = array();
316
-    }
314
+	if (empty($gd_marker_sizes)) {
315
+		$gd_marker_sizes = array();
316
+	}
317 317
       
318
-    if (!empty($gd_marker_sizes[$icon])) {
319
-        return $gd_marker_sizes[$icon];
320
-    }
318
+	if (!empty($gd_marker_sizes[$icon])) {
319
+		return $gd_marker_sizes[$icon];
320
+	}
321 321
     
322
-    if (empty($icon)) {
323
-        $gd_marker_sizes[$icon] = $default_size;
322
+	if (empty($icon)) {
323
+		$gd_marker_sizes[$icon] = $default_size;
324 324
         
325
-        return $default_size;
326
-    }
325
+		return $default_size;
326
+	}
327 327
     
328
-    $icon_url = $icon;
328
+	$icon_url = $icon;
329 329
     
330
-    $uploads = wp_upload_dir(); // Array of key => value pairs
330
+	$uploads = wp_upload_dir(); // Array of key => value pairs
331 331
       
332
-    if (!path_is_absolute($icon)) {
333
-        $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
334
-    }
332
+	if (!path_is_absolute($icon)) {
333
+		$icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
334
+	}
335 335
     
336
-    if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
337
-        $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
338
-    }
336
+	if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
337
+		$icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
338
+	}
339 339
     
340
-    $sizes = array();
341
-    if (is_file($icon) && file_exists($icon)) {
342
-        $size = getimagesize(trim($icon));
340
+	$sizes = array();
341
+	if (is_file($icon) && file_exists($icon)) {
342
+		$size = getimagesize(trim($icon));
343 343
         
344
-        if (!empty($size[0]) && !empty($size[1])) {
345
-            $sizes = array('w' => $size[0], 'h' => $size[1]);
346
-        }
347
-    }
344
+		if (!empty($size[0]) && !empty($size[1])) {
345
+			$sizes = array('w' => $size[0], 'h' => $size[1]);
346
+		}
347
+	}
348 348
     
349
-    $sizes = !empty($sizes) ? $sizes : $default_size;
349
+	$sizes = !empty($sizes) ? $sizes : $default_size;
350 350
     
351
-    $gd_marker_sizes[$icon_url] = $sizes;
351
+	$gd_marker_sizes[$icon_url] = $sizes;
352 352
     
353
-    return $sizes;
353
+	return $sizes;
354 354
 }
355 355
 
356 356
 add_action('wp_footer', 'geodir_map_load_script', 10);
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
  * @package GeoDirectory
363 363
  */
364 364
 function geodir_map_load_script() {
365
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
366
-        $plugin_url = geodir_plugin_url();
365
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
366
+		$plugin_url = geodir_plugin_url();
367 367
 ?>
368 368
 <script type="text/javascript">
369 369
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -377,5 +377,5 @@  discard block
 block discarded – undo
377 377
 }
378 378
 </script>
379 379
 <?php
380
-    }
380
+	}
381 381
 }
382 382
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+        if (isset($map_jason[$post->ID])) {return null; }
58 58
 
59 59
         $srcharr = array("'", "/", "-", '"', '\\');
60 60
         $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $title = str_replace($srcharr, $replarr, $post_title);
68 68
 
69 69
         if (is_ssl()) {
70
-            $icon = str_replace("http:","https:",$icon );
70
+            $icon = str_replace("http:", "https:", $icon);
71 71
         }
72 72
         
73 73
         if ($icon != '') {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             $icon_size = array('w' => 36, 'h' => 45);
84 84
         }
85 85
 
86
-        $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
86
+        $post_json = '{"id":"'.$post->ID.'","t": "'.$title.'","lt": "'.$post->post_latitude.'","ln": "'.$post->post_longitude.'","mk_id":"'.$post->ID.'_'.$post->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"}';
87 87
 
88 88
         /**
89 89
          * Filter the json data when creating output for post json marker..
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
          * @param string $post_json JSON representation of the post marker info.
93 93
          * @param object $post The post object.
94 94
          */
95
-        $map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
95
+        $map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
96 96
     }
97 97
 }
98 98
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
             if (is_array($map_jason) && !empty($map_jason)) {
114 114
 
115 115
                 // on details page only show the main marker on the map
116
-                if(geodir_is_page('detail')){
116
+                if (geodir_is_page('detail')) {
117 117
                     global $post;
118
-                    if(isset($map_jason[$post->ID])){
118
+                    if (isset($map_jason[$post->ID])) {
119 119
                         $map_jason = array($map_jason[$post->ID]);
120 120
                     }
121 121
                 }
122
-                $canvas_jason = $canvas . "_jason";
122
+                $canvas_jason = $canvas."_jason";
123 123
                 $map_canvas_arr[$canvas] = array_unique($map_jason);
124 124
                 unset($cat_content_info);
125 125
                 $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
                 if (!empty($cat_content_info)) {
128 128
                     $json_content = substr(implode(',', $cat_content_info), 1);
129 129
                     $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
130
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
130
+                    $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
131 131
                 } else {
132 132
                     $canvas_jason = '[{"totalcount":"0"}]';
133 133
                 }
134
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
134
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
135 135
 
136 136
                 /**
137 137
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
                  * @param string $canvas Map canvas array key.
144 144
                  * @param array $map_canvas_jason_args Map canvas args.
145 145
                  */
146
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
146
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
147 147
 
148
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
148
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
149 149
             } else {
150 150
                 $canvas_jason = '[{"totalcount":"0"}]';
151
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
151
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
152 152
 
153 153
                 /**
154 154
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
                  * @param string $canvas Map canvas array key.
161 161
                  * @param array $map_canvas_jason_args Map canvas args.
162 162
                  */
163
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
164
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
163
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
164
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
165 165
             }
166 166
         }
167 167
 
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
         }
224 224
 
225 225
 
226
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
226
+        $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">';
227 227
 
228 228
         $geodir_cat_icons = geodir_get_term_icon();
229 229
 
230
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
230
+        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
231 231
         $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
232 232
         foreach ($cat_terms as $cat_term):
233 233
 
@@ -241,16 +241,16 @@  discard block
 block discarded – undo
241 241
 
242 242
                 // Untick the category by default on home map
243 243
                 if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
244
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
244
+                    if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$cat_term->term_id, $geodir_home_map_untick)) {
245 245
                         $checked = '';
246 246
                     }
247 247
                 }
248 248
 
249
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
250
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
251
-                $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
252
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
253
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
249
+                $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"';
250
+                $term_check .= ' name="'.$map_canvas_name.'_cat[]" ';
251
+                $term_check .= '  title="'.esc_attr(ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">';
252
+                $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>';
253
+                $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>';
254 254
 
255 255
             endif;
256 256
 
@@ -362,18 +362,18 @@  discard block
 block discarded – undo
362 362
  * @package GeoDirectory
363 363
  */
364 364
 function geodir_map_load_script() {
365
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
365
+    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
366 366
         $plugin_url = geodir_plugin_url();
367 367
 ?>
368 368
 <script type="text/javascript">
369 369
 if (!(window.google && typeof google.maps !== 'undefined')) {
370
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
370
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
371 371
     document.getElementsByTagName("head")[0].appendChild(css);
372
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
372
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
373 373
     document.getElementsByTagName("head")[0].appendChild(css);
374
-    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
375
-    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
376
-    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
374
+    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
375
+    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
376
+    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
377 377
 }
378 378
 </script>
379 379
 <?php
Please login to merge, or discard this patch.