Test Failed
Push — master ( ab062a...8d9d5e )
by
unknown
19:09
created
geodirectory-functions/map-functions/map_functions.php 2 patches
Indentation   +218 added lines, -218 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,56 +50,56 @@  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
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
96
-
97
-        // only assign it if it has a value
98
-        if($post_map_json){
99
-            $map_jason[$post->ID] = $post_map_json;
100
-        }
101
-
102
-    }
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
+		$post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
96
+
97
+		// only assign it if it has a value
98
+		if($post_map_json){
99
+			$map_jason[$post->ID] = $post_map_json;
100
+		}
101
+
102
+	}
103 103
 }
104 104
 
105 105
 /**
@@ -112,67 +112,67 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function send_marker_jason_to_js()
114 114
 {
115
-    global $map_jason, $map_canvas_arr;
116
-
117
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
118
-        foreach ($map_canvas_arr as $canvas => $jason) {
119
-            if (is_array($map_jason) && !empty($map_jason)) {
120
-
121
-                // on details page only show the main marker on the map
122
-                if(geodir_is_page('detail')){
123
-                    global $post;
124
-                    if(isset($map_jason[$post->ID])){
125
-                        $map_jason = array($map_jason[$post->ID]);
126
-                    }
127
-                }
128
-                $canvas_jason = $canvas . "_jason";
129
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
130
-                unset($cat_content_info);
131
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
132
-                $totalcount = count(array_unique($map_jason));
133
-                if (!empty($cat_content_info)) {
134
-                    $json_content = substr(implode(',', $cat_content_info), 1);
135
-                    $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
136
-                    $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
137
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
138
-                } else {
139
-                    $canvas_jason = '[{"totalcount":"0"}]';
140
-                }
141
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
142
-
143
-                /**
144
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
145
-                 *
146
-                 * You can use this filter to modify map canvas json args.
147
-                 *
148
-                 * @since 1.0.0
149
-                 * @package GeoDirectory
150
-                 * @param string $canvas Map canvas array key.
151
-                 * @param array $map_canvas_jason_args Map canvas args.
152
-                 */
153
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
154
-
155
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
156
-            } else {
157
-                $canvas_jason = '[{"totalcount":"0"}]';
158
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
159
-
160
-                /**
161
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
162
-                 *
163
-                 * You can use this filter to modify map canvas json args.
164
-                 *
165
-                 * @since 1.0.0
166
-                 * @package GeoDirectory
167
-                 * @param string $canvas Map canvas array key.
168
-                 * @param array $map_canvas_jason_args Map canvas args.
169
-                 */
170
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
171
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
172
-            }
173
-        }
174
-
175
-    }
115
+	global $map_jason, $map_canvas_arr;
116
+
117
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
118
+		foreach ($map_canvas_arr as $canvas => $jason) {
119
+			if (is_array($map_jason) && !empty($map_jason)) {
120
+
121
+				// on details page only show the main marker on the map
122
+				if(geodir_is_page('detail')){
123
+					global $post;
124
+					if(isset($map_jason[$post->ID])){
125
+						$map_jason = array($map_jason[$post->ID]);
126
+					}
127
+				}
128
+				$canvas_jason = $canvas . "_jason";
129
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
130
+				unset($cat_content_info);
131
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
132
+				$totalcount = count(array_unique($map_jason));
133
+				if (!empty($cat_content_info)) {
134
+					$json_content = substr(implode(',', $cat_content_info), 1);
135
+					$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
136
+					$json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
137
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
138
+				} else {
139
+					$canvas_jason = '[{"totalcount":"0"}]';
140
+				}
141
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
142
+
143
+				/**
144
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
145
+				 *
146
+				 * You can use this filter to modify map canvas json args.
147
+				 *
148
+				 * @since 1.0.0
149
+				 * @package GeoDirectory
150
+				 * @param string $canvas Map canvas array key.
151
+				 * @param array $map_canvas_jason_args Map canvas args.
152
+				 */
153
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
154
+
155
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
156
+			} else {
157
+				$canvas_jason = '[{"totalcount":"0"}]';
158
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
159
+
160
+				/**
161
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
162
+				 *
163
+				 * You can use this filter to modify map canvas json args.
164
+				 *
165
+				 * @since 1.0.0
166
+				 * @package GeoDirectory
167
+				 * @param string $canvas Map canvas array key.
168
+				 * @param array $map_canvas_jason_args Map canvas args.
169
+				 */
170
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
171
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
172
+			}
173
+		}
174
+
175
+	}
176 176
 }
177 177
 
178 178
 /**
@@ -191,99 +191,99 @@  discard block
 block discarded – undo
191 191
  */
192 192
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
193 193
 {
194
-    global $cat_count, $geodir_cat_icons;
194
+	global $cat_count, $geodir_cat_icons;
195 195
 
196
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
197
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
196
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
197
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
198 198
 
199
-    // check if exclude categories saved before fix of categories identical names
200
-    if ($exclude_categories_new) {
201
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
202
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
203
-    }
199
+	// check if exclude categories saved before fix of categories identical names
200
+	if ($exclude_categories_new) {
201
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
202
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
203
+	}
204 204
 
205
-    $exclude_cat_str = implode(',', $exclude_categories);
205
+	$exclude_cat_str = implode(',', $exclude_categories);
206 206
 
207
-    if ($exclude_cat_str == '') {
208
-        $exclude_cat_str = '0';
209
-    }
207
+	if ($exclude_cat_str == '') {
208
+		$exclude_cat_str = '0';
209
+	}
210 210
 
211
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
211
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
212 212
 
213
-    if ($hide_empty) {
214
-        $cat_terms = geodir_filter_empty_terms($cat_terms);
215
-    }
213
+	if ($hide_empty) {
214
+		$cat_terms = geodir_filter_empty_terms($cat_terms);
215
+	}
216 216
 
217
-    $main_list_class = '';
218
-    //If there are terms, start displaying
219
-    if (count($cat_terms) > 0) {
220
-        //Displaying as a list
221
-        $p = $pading * 15;
222
-        $pading++;
217
+	$main_list_class = '';
218
+	//If there are terms, start displaying
219
+	if (count($cat_terms) > 0) {
220
+		//Displaying as a list
221
+		$p = $pading * 15;
222
+		$pading++;
223 223
 
224
-        if ($cat_parent == 0) {
225
-            $list_class = 'main_list';
226
-            $display = '';
227
-        } else {
228
-            $list_class = 'sub_list';
229
-            $display = !$child_collapse ? '' : 'display:none';
230
-        }
224
+		if ($cat_parent == 0) {
225
+			$list_class = 'main_list';
226
+			$display = '';
227
+		} else {
228
+			$list_class = 'sub_list';
229
+			$display = !$child_collapse ? '' : 'display:none';
230
+		}
231 231
 
232 232
 
233
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
233
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
234 234
 
235
-        $geodir_cat_icons = geodir_get_term_icon();
235
+		$geodir_cat_icons = geodir_get_term_icon();
236 236
 
237
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
238
-        $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
239
-        foreach ($cat_terms as $cat_term):
237
+		$geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
238
+		$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
239
+		foreach ($cat_terms as $cat_term):
240 240
 
241 241
 
242 242
 
243
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
243
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
244 244
 
245
-            if (!in_array($cat_term->term_id, $exclude_categories)):
246
-                //Secret sauce.  Function calls itself to display child elements, if any
247
-                $checked = 'checked="checked"';
245
+			if (!in_array($cat_term->term_id, $exclude_categories)):
246
+				//Secret sauce.  Function calls itself to display child elements, if any
247
+				$checked = 'checked="checked"';
248 248
 
249
-                // Untick the category by default on home map
250
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
251
-                    if (function_exists('icl_object_id')) { // if WPML
252
-                        global $sitepress;
253
-                        $default_lang = $sitepress->get_default_language();
254
-                        $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
255
-                    }else{
256
-                        $term_id = $cat_term->term_id;
257
-                    }
258
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
259
-                        $checked = '';
260
-                    }
261
-                }
249
+				// Untick the category by default on home map
250
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
251
+					if (function_exists('icl_object_id')) { // if WPML
252
+						global $sitepress;
253
+						$default_lang = $sitepress->get_default_language();
254
+						$term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
255
+					}else{
256
+						$term_id = $cat_term->term_id;
257
+					}
258
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
259
+						$checked = '';
260
+					}
261
+				}
262 262
 
263
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
264
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
265
-                $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)">';
266
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
267
-                $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>';
263
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
264
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
265
+				$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)">';
266
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
267
+				$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>';
268 268
 
269
-            endif;
269
+			endif;
270 270
 
271 271
 
272
-            // get sub category by recursion
273
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
272
+			// get sub category by recursion
273
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
274 274
 
275
-            $out .= '</li>';
275
+			$out .= '</li>';
276 276
 
277
-        endforeach;
277
+		endforeach;
278 278
 
279
-        $out .= '</ul>';
279
+		$out .= '</ul>';
280 280
 
281
-        return $out;
282
-    } else {
283
-        if ($cat_parent == 0)
284
-            return _e('No category', 'geodirectory');
285
-    }
286
-    return;
281
+		return $out;
282
+	} else {
283
+		if ($cat_parent == 0)
284
+			return _e('No category', 'geodirectory');
285
+	}
286
+	return;
287 287
 }
288 288
 
289 289
 /**
@@ -295,19 +295,19 @@  discard block
 block discarded – undo
295 295
  * @return string The map API provider name.
296 296
  */
297 297
 function geodir_map_name() {
298
-    $geodir_map_name = get_option('geodir_load_map', 'google');
298
+	$geodir_map_name = get_option('geodir_load_map', 'google');
299 299
     
300
-    if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
301
-        $geodir_map_name = 'auto';
302
-    }
303
-
304
-    /**
305
-     * Filter the map JS API provider name.
306
-     *
307
-     * @since 1.6.1
308
-     * @param string $geodir_map_name The map API provider name.
309
-     */
310
-    return apply_filters('geodir_map_name', $geodir_map_name);
300
+	if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
301
+		$geodir_map_name = 'auto';
302
+	}
303
+
304
+	/**
305
+	 * Filter the map JS API provider name.
306
+	 *
307
+	 * @since 1.6.1
308
+	 * @param string $geodir_map_name The map API provider name.
309
+	 */
310
+	return apply_filters('geodir_map_name', $geodir_map_name);
311 311
 }
312 312
 
313 313
 /**
@@ -323,48 +323,48 @@  discard block
 block discarded – undo
323 323
  * @return array The icon size.
324 324
  */
325 325
 function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
326
-    global $gd_marker_sizes;
326
+	global $gd_marker_sizes;
327 327
     
328
-    if (empty($gd_marker_sizes)) {
329
-        $gd_marker_sizes = array();
330
-    }
328
+	if (empty($gd_marker_sizes)) {
329
+		$gd_marker_sizes = array();
330
+	}
331 331
       
332
-    if (!empty($gd_marker_sizes[$icon])) {
333
-        return $gd_marker_sizes[$icon];
334
-    }
332
+	if (!empty($gd_marker_sizes[$icon])) {
333
+		return $gd_marker_sizes[$icon];
334
+	}
335 335
     
336
-    if (empty($icon)) {
337
-        $gd_marker_sizes[$icon] = $default_size;
336
+	if (empty($icon)) {
337
+		$gd_marker_sizes[$icon] = $default_size;
338 338
         
339
-        return $default_size;
340
-    }
339
+		return $default_size;
340
+	}
341 341
     
342
-    $icon_url = $icon;
342
+	$icon_url = $icon;
343 343
     
344
-    $uploads = wp_upload_dir(); // Array of key => value pairs
344
+	$uploads = wp_upload_dir(); // Array of key => value pairs
345 345
       
346
-    if (!path_is_absolute($icon)) {
347
-        $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
348
-    }
346
+	if (!path_is_absolute($icon)) {
347
+		$icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
348
+	}
349 349
     
350
-    if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
351
-        $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
352
-    }
350
+	if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
351
+		$icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
352
+	}
353 353
     
354
-    $sizes = array();
355
-    if (is_file($icon) && file_exists($icon)) {
356
-        $size = getimagesize(trim($icon));
354
+	$sizes = array();
355
+	if (is_file($icon) && file_exists($icon)) {
356
+		$size = getimagesize(trim($icon));
357 357
         
358
-        if (!empty($size[0]) && !empty($size[1])) {
359
-            $sizes = array('w' => $size[0], 'h' => $size[1]);
360
-        }
361
-    }
358
+		if (!empty($size[0]) && !empty($size[1])) {
359
+			$sizes = array('w' => $size[0], 'h' => $size[1]);
360
+		}
361
+	}
362 362
     
363
-    $sizes = !empty($sizes) ? $sizes : $default_size;
363
+	$sizes = !empty($sizes) ? $sizes : $default_size;
364 364
     
365
-    $gd_marker_sizes[$icon_url] = $sizes;
365
+	$gd_marker_sizes[$icon_url] = $sizes;
366 366
     
367
-    return $sizes;
367
+	return $sizes;
368 368
 }
369 369
 
370 370
 add_action('wp_footer', 'geodir_map_load_script', 10);
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
  * @package GeoDirectory
377 377
  */
378 378
 function geodir_map_load_script() {
379
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
380
-        $plugin_url = geodir_plugin_url();
379
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
380
+		$plugin_url = geodir_plugin_url();
381 381
 ?>
382 382
 <script type="text/javascript">
383 383
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -391,5 +391,5 @@  discard block
 block discarded – undo
391 391
 }
392 392
 </script>
393 393
 <?php
394
-    }
394
+	}
395 395
 }
396 396
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 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,10 +92,10 @@  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
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
95
+        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
96 96
 
97 97
         // only assign it if it has a value
98
-        if($post_map_json){
98
+        if ($post_map_json) {
99 99
             $map_jason[$post->ID] = $post_map_json;
100 100
         }
101 101
 
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
             if (is_array($map_jason) && !empty($map_jason)) {
120 120
 
121 121
                 // on details page only show the main marker on the map
122
-                if(geodir_is_page('detail')){
122
+                if (geodir_is_page('detail')) {
123 123
                     global $post;
124
-                    if(isset($map_jason[$post->ID])){
124
+                    if (isset($map_jason[$post->ID])) {
125 125
                         $map_jason = array($map_jason[$post->ID]);
126 126
                     }
127 127
                 }
128
-                $canvas_jason = $canvas . "_jason";
128
+                $canvas_jason = $canvas."_jason";
129 129
                 $map_canvas_arr[$canvas] = array_unique($map_jason);
130 130
                 unset($cat_content_info);
131 131
                 $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
                     $json_content = substr(implode(',', $cat_content_info), 1);
135 135
                     $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
136 136
                     $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
137
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
137
+                    $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
138 138
                 } else {
139 139
                     $canvas_jason = '[{"totalcount":"0"}]';
140 140
                 }
141
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
141
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
142 142
 
143 143
                 /**
144 144
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
                  * @param string $canvas Map canvas array key.
151 151
                  * @param array $map_canvas_jason_args Map canvas args.
152 152
                  */
153
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
153
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
154 154
 
155
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
155
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
156 156
             } else {
157 157
                 $canvas_jason = '[{"totalcount":"0"}]';
158
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
158
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
159 159
 
160 160
                 /**
161 161
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
                  * @param string $canvas Map canvas array key.
168 168
                  * @param array $map_canvas_jason_args Map canvas args.
169 169
                  */
170
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
171
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
170
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
171
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
172 172
             }
173 173
         }
174 174
 
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
         }
231 231
 
232 232
 
233
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
233
+        $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">';
234 234
 
235 235
         $geodir_cat_icons = geodir_get_term_icon();
236 236
 
237
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
237
+        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
238 238
         $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt;
239 239
         foreach ($cat_terms as $cat_term):
240 240
 
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
                         global $sitepress;
253 253
                         $default_lang = $sitepress->get_default_language();
254 254
                         $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
255
-                    }else{
255
+                    } else {
256 256
                         $term_id = $cat_term->term_id;
257 257
                     }
258
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
258
+                    if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$term_id, $geodir_home_map_untick)) {
259 259
                         $checked = '';
260 260
                     }
261 261
                 }
262 262
 
263
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
264
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
265
-                $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)">';
266
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
267
-                $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>';
263
+                $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"';
264
+                $term_check .= ' name="'.$map_canvas_name.'_cat[]" ';
265
+                $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)">';
266
+                $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>';
267
+                $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>';
268 268
 
269 269
             endif;
270 270
 
@@ -376,18 +376,18 @@  discard block
 block discarded – undo
376 376
  * @package GeoDirectory
377 377
  */
378 378
 function geodir_map_load_script() {
379
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
379
+    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
380 380
         $plugin_url = geodir_plugin_url();
381 381
 ?>
382 382
 <script type="text/javascript">
383 383
 if (!(window.google && typeof google.maps !== 'undefined')) {
384
-    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;?>");
384
+    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; ?>");
385 385
     document.getElementsByTagName("head")[0].appendChild(css);
386
-    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;?>");
386
+    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; ?>");
387 387
     document.getElementsByTagName("head")[0].appendChild(css);
388
-    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>');
389
-    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>');
390
-    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>');
388
+    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>');
389
+    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>');
390
+    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>');
391 391
 }
392 392
 </script>
393 393
 <?php
Please login to merge, or discard this patch.