Test Failed
Pull Request — master (#293)
by Kiran
07:55
created
geodirectory-functions/taxonomy_functions.php 3 patches
Indentation   +1218 added lines, -1218 removed lines patch added patch discarded remove patch
@@ -33,265 +33,265 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(ucfirst($args->labels->name),'geodirectory') . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul> ';
149
-            /**
150
-             * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
-             *
152
-             * @since 1.5.9
153
-             */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
155
-            $items .= '</li>';
156
-        }
157
-    }
158
-
159
-    if (get_option('geodir_show_addlisting_nav')) {
160
-
161
-        $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
164
-
165
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
-        $post_types = geodir_get_posttypes('object');
167
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
-
170
-        if (!empty($post_types)) {
171
-            foreach ($post_types as $post_type => $args) {
172
-                if (!empty($geodir_allow_posttype_frontend)) {
173
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
-                        if (!empty($show_add_listing_post_types_main_nav)) {
175
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
-                                if (geodir_get_addlisting_link($post_type)) {
177
-
178
-                                    $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
181
-                                    /**
182
-                                     * Filter the menu li class.
183
-                                     *
184
-                                     * @since 1.0.0
185
-                                     * @param string $menu_class The menu HTML class.
186
-                                     */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
-                                    /**
189
-                                     * Filter the menu a class.
190
-                                     *
191
-                                     * @since 1.0.0
192
-                                     */
193
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
194
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
148
+			$items .= '	</ul> ';
149
+			/**
150
+			 * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
+			 *
152
+			 * @since 1.5.9
153
+			 */
154
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
155
+			$items .= '</li>';
156
+		}
157
+	}
158
+
159
+	if (get_option('geodir_show_addlisting_nav')) {
160
+
161
+		$menu_class = '';
162
+		if (geodir_is_page('add-listing'))
163
+			$menu_class = 'current-menu-item';
164
+
165
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
+		$post_types = geodir_get_posttypes('object');
167
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
+
170
+		if (!empty($post_types)) {
171
+			foreach ($post_types as $post_type => $args) {
172
+				if (!empty($geodir_allow_posttype_frontend)) {
173
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
+						if (!empty($show_add_listing_post_types_main_nav)) {
175
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
+								if (geodir_get_addlisting_link($post_type)) {
177
+
178
+									$menu_class = '';
179
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
+										$menu_class = 'current-menu-item';
181
+									/**
182
+									 * Filter the menu li class.
183
+									 *
184
+									 * @since 1.0.0
185
+									 * @param string $menu_class The menu HTML class.
186
+									 */
187
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
+									/**
189
+									 * Filter the menu a class.
190
+									 *
191
+									 * @since 1.0.0
192
+									 */
193
+									$a_class = apply_filters('geodir_menu_a_class', '');
194
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
195
+									$items .= '<li class="' . $li_class . '">
196 196
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197 197
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
198 198
 											</a>
199 199
 										</li>';
200
-                                }
201
-                            }
202
-                        }
203
-                    }
204
-                }
205
-            }
206
-        }
207
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
-    }
209
-
210
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
-    if ($is_add_listing_sub_meny_exists) {
213
-
214
-        if (get_option('geodir_show_addlisting_nav')) {
215
-            /**
216
-             * Filter the menu li class.
217
-             *
218
-             * @since 1.0.0
219
-             * @param string $menu_class The menu HTML class.
220
-             */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
-            /**
223
-             * Filter the sub menu li class.
224
-             *
225
-             * @since 1.0.0
226
-             * @param string $menu_class The menu HTML class.
227
-             */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
-            /**
230
-             * Filter the sub menu ul class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
-            /**
236
-             * Filter the menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $a_class = apply_filters('geodir_menu_a_class', '');
241
-            /**
242
-             * Filter the sub menu a class.
243
-             *
244
-             * @since 1.0.0
245
-             */
246
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
200
+								}
201
+							}
202
+						}
203
+					}
204
+				}
205
+			}
206
+		}
207
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
+	}
209
+
210
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
+	if ($is_add_listing_sub_meny_exists) {
213
+
214
+		if (get_option('geodir_show_addlisting_nav')) {
215
+			/**
216
+			 * Filter the menu li class.
217
+			 *
218
+			 * @since 1.0.0
219
+			 * @param string $menu_class The menu HTML class.
220
+			 */
221
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
+			/**
223
+			 * Filter the sub menu li class.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @param string $menu_class The menu HTML class.
227
+			 */
228
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
+			/**
230
+			 * Filter the sub menu ul class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
+			/**
236
+			 * Filter the menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$a_class = apply_filters('geodir_menu_a_class', '');
241
+			/**
242
+			 * Filter the sub menu a class.
243
+			 *
244
+			 * @since 1.0.0
245
+			 */
246
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
+			$items .= '<li  class="' . $li_class . '">
248 248
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249 249
 					<ul class="' . $sub_ul_class . '">';
250 250
 
251
-            $post_types = geodir_get_posttypes('object');
252
-
253
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
-
255
-            if (!empty($post_types)) {
256
-                foreach ($post_types as $post_type => $args) {
257
-                    if (!empty($geodir_allow_posttype_frontend)) {
258
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
-                            if (!empty($show_add_listing_post_types)) {
260
-                                if (in_array($post_type, $show_add_listing_post_types)) {
261
-                                    if (geodir_get_addlisting_link($post_type)) {
262
-
263
-                                        $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
266
-                                        /**
267
-                                         * Filter the menu li class.
268
-                                         *
269
-                                         * @since 1.0.0
270
-                                         * @param string $menu_class The menu HTML class.
271
-                                         */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
251
+			$post_types = geodir_get_posttypes('object');
252
+
253
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
+
255
+			if (!empty($post_types)) {
256
+				foreach ($post_types as $post_type => $args) {
257
+					if (!empty($geodir_allow_posttype_frontend)) {
258
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
+							if (!empty($show_add_listing_post_types)) {
260
+								if (in_array($post_type, $show_add_listing_post_types)) {
261
+									if (geodir_get_addlisting_link($post_type)) {
262
+
263
+										$menu_class = '';
264
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
+											$menu_class = 'current-menu-item';
266
+										/**
267
+										 * Filter the menu li class.
268
+										 *
269
+										 * @since 1.0.0
270
+										 * @param string $menu_class The menu HTML class.
271
+										 */
272
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
274
+										$items .= '<li class="' . $li_class . '">
275 275
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276 276
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
277 277
 														</a>
278 278
 													</li>';
279
-                                    }
280
-                                }
281
-                            }
282
-                        }
283
-                    }
284
-                }
285
-            }
279
+									}
280
+								}
281
+							}
282
+						}
283
+					}
284
+				}
285
+			}
286 286
 
287
-            $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
289
-            $items .= '</li>';
287
+			$items .= '	</ul> ';
288
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
289
+			$items .= '</li>';
290 290
 
291
-        }
292
-    }
293
-    // apply filter to add more navigations // -Filter-Location-Manager
294
-    return $items;
291
+		}
292
+	}
293
+	// apply filter to add more navigations // -Filter-Location-Manager
294
+	return $items;
295 295
 }
296 296
 
297 297
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_pagemenu_items($menu, $args)
311 311
 {
312
-    $locations = get_nav_menu_locations();
313
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
314
-    $geodir_theme_location_nav = array();
315
-    if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
-        $geodir_theme_location_nav[] = $args['theme_location'];
318
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
-    }
320
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
312
+	$locations = get_nav_menu_locations();
313
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
314
+	$geodir_theme_location_nav = array();
315
+	if (empty($locations) && empty($geodir_theme_location)) {
316
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
+		$geodir_theme_location_nav[] = $args['theme_location'];
318
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
+	}
320
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
324 324
 
325
-    return $menu;
325
+	return $menu;
326 326
 
327 327
 }
328 328
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 function geodir_menu_items($items, $args)
343 343
 {
344 344
 
345
-    $location = $args->theme_location;
345
+	$location = $args->theme_location;
346 346
 
347
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
347
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
348 348
 
349
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
349
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
352
-        return $items;
351
+		$items = $items . geodir_add_nav_menu_items();
352
+		return $items;
353 353
 
354
-    } else {
355
-        return $items;
356
-    }
354
+	} else {
355
+		return $items;
356
+	}
357 357
 }
358 358
 
359 359
 /**
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_get_category_all_array()
370 370
 {
371
-    global $wpdb;
372
-    $return_array = array();
373
-
374
-    $taxonomies = geodir_get_taxonomies();
375
-    $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
377
-
378
-    $pn_categories = $wpdb->get_results(
379
-        $wpdb->prepare(
380
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
382
-        )
383
-    );
384
-
385
-    foreach ($pn_categories as $pn_categories_obj) {
386
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
-            "title" => $pn_categories_obj->name,);
388
-    }
389
-    return $return_array;
371
+	global $wpdb;
372
+	$return_array = array();
373
+
374
+	$taxonomies = geodir_get_taxonomies();
375
+	$taxonomies = implode("','", $taxonomies);
376
+	$taxonomies = "'" . $taxonomies . "'";
377
+
378
+	$pn_categories = $wpdb->get_results(
379
+		$wpdb->prepare(
380
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
+			array($wpdb->terms . term_id)
382
+		)
383
+	);
384
+
385
+	foreach ($pn_categories as $pn_categories_obj) {
386
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
+			"title" => $pn_categories_obj->name,);
388
+	}
389
+	return $return_array;
390 390
 }
391 391
 
392 392
 
@@ -401,41 +401,41 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_get_current_posttype()
403 403
 {
404
-    global $wp_query, $geodir_post_type;
404
+	global $wp_query, $geodir_post_type;
405 405
 
406
-    $geodir_post_type = get_query_var('post_type');
406
+	$geodir_post_type = get_query_var('post_type');
407 407
 
408
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
-    }
408
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
+		elseif (isset($_REQUEST['listing_type']))
412
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
+	}
414 414
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417 417
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
418
+	if (is_tax())
419
+		$geodir_post_type = geodir_get_taxonomy_posttype();
420 420
 
421 421
 
422
-    $all_postypes = geodir_get_posttypes();
423
-    $all_postypes = stripslashes_deep($all_postypes);
422
+	$all_postypes = geodir_get_posttypes();
423
+	$all_postypes = stripslashes_deep($all_postypes);
424 424
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
425
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
+		$geodir_post_type = '';
427 427
 
428
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430
-    }
428
+	if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430
+	}
431 431
 
432 432
 
433
-    /**
434
-     * Filter the default CPT return.
435
-     *
436
-     * @since 1.6.9
437
-     */
438
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
433
+	/**
434
+	 * Filter the default CPT return.
435
+	 *
436
+	 * @since 1.6.9
437
+	 */
438
+	return apply_filters('geodir_get_current_posttype',$geodir_post_type);
439 439
 }
440 440
 
441 441
 /**
@@ -449,21 +449,21 @@  discard block
 block discarded – undo
449 449
  */
450 450
 function geodir_get_default_posttype()
451 451
 {
452
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
452
+	$post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
453 453
 
454
-    foreach ( $post_types as $post_type => $info ) {
455
-        global $wpdb;
456
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
457
-        if ( $has_posts ) {
458
-            $stype = $post_type; break;
459
-        }
460
-    }
454
+	foreach ( $post_types as $post_type => $info ) {
455
+		global $wpdb;
456
+		$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
457
+		if ( $has_posts ) {
458
+			$stype = $post_type; break;
459
+		}
460
+	}
461 461
 
462
-    if(!$stype){
463
-        $stype = 'gd_place';
464
-    }
462
+	if(!$stype){
463
+		$stype = 'gd_place';
464
+	}
465 465
 
466
-    return $stype;
466
+	return $stype;
467 467
 }
468 468
 
469 469
 /**
@@ -477,21 +477,21 @@  discard block
 block discarded – undo
477 477
  */
478 478
 function geodir_get_posttypes($output = 'names')
479 479
 {
480
-    $post_types = array();
481
-    $post_types = get_option('geodir_post_types');
482
-    $post_types = stripslashes_deep($post_types);
483
-    if (!empty($post_types)) {
484
-        switch ($output):
485
-            case 'object':
486
-            case 'Object':
487
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
488
-                break;
489
-            case 'array':
490
-            case 'Array':
491
-                $post_types = (array)$post_types;
492
-                break;
480
+	$post_types = array();
481
+	$post_types = get_option('geodir_post_types');
482
+	$post_types = stripslashes_deep($post_types);
483
+	if (!empty($post_types)) {
484
+		switch ($output):
485
+			case 'object':
486
+			case 'Object':
487
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
488
+				break;
489
+			case 'array':
490
+			case 'Array':
491
+				$post_types = (array)$post_types;
492
+				break;
493 493
 			case 'options':
494
-                $post_types = (array)$post_types;
494
+				$post_types = (array)$post_types;
495 495
 				
496 496
 				$options = array();
497 497
 				if (!empty($post_types)) {
@@ -500,17 +500,17 @@  discard block
 block discarded – undo
500 500
 					}
501 501
 				}
502 502
 				$post_types = $options;
503
-                break;
504
-            default:
505
-                $post_types = array_keys($post_types);
506
-                break;
507
-        endswitch;
508
-    }
509
-
510
-    if (!empty($post_types))
511
-        return $post_types;
512
-    else
513
-        return array();
503
+				break;
504
+			default:
505
+				$post_types = array_keys($post_types);
506
+				break;
507
+		endswitch;
508
+	}
509
+
510
+	if (!empty($post_types))
511
+		return $post_types;
512
+	else
513
+		return array();
514 514
 }
515 515
 
516 516
 /**
@@ -523,108 +523,108 @@  discard block
 block discarded – undo
523 523
  */
524 524
 function geodir_get_posttype_info($post_type = '')
525 525
 {
526
-    $post_types = array();
527
-    $post_types = get_option('geodir_post_types');
528
-    $post_types = stripslashes_deep($post_types);
529
-    if (!empty($post_types) && $post_type != '') {
530
-        return $post_types[$post_type];
531
-    } else
532
-        return false;
526
+	$post_types = array();
527
+	$post_types = get_option('geodir_post_types');
528
+	$post_types = stripslashes_deep($post_types);
529
+	if (!empty($post_types) && $post_type != '') {
530
+		return $post_types[$post_type];
531
+	} else
532
+		return false;
533 533
 }
534 534
 
535 535
 if (!function_exists('geodir_get_taxonomies')) {
536
-    /**
537
-     * Get all custom taxonomies.
538
-     *
539
-     * @since 1.0.0
540
-     * @package GeoDirectory
541
-     * @param string $post_type The post type.
542
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
543
-     * @return array|bool Taxonomies on success. false on failure.
544
-     */
545
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
546
-    {
536
+	/**
537
+	 * Get all custom taxonomies.
538
+	 *
539
+	 * @since 1.0.0
540
+	 * @package GeoDirectory
541
+	 * @param string $post_type The post type.
542
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
543
+	 * @return array|bool Taxonomies on success. false on failure.
544
+	 */
545
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
546
+	{
547 547
 
548
-        $taxonomies = array();
549
-        $gd_taxonomies = array();
548
+		$taxonomies = array();
549
+		$gd_taxonomies = array();
550 550
 
551
-        if ($taxonomies = get_option('geodir_taxonomies')) {
551
+		if ($taxonomies = get_option('geodir_taxonomies')) {
552 552
 
553 553
 
554
-            $gd_taxonomies = array_keys($taxonomies);
554
+			$gd_taxonomies = array_keys($taxonomies);
555 555
 
556 556
 
557
-            if ($post_type != '')
558
-                $gd_taxonomies = array();
557
+			if ($post_type != '')
558
+				$gd_taxonomies = array();
559 559
 
560
-            $i = 0;
561
-            foreach ($taxonomies as $taxonomy => $args) {
560
+			$i = 0;
561
+			foreach ($taxonomies as $taxonomy => $args) {
562 562
 
563
-                if ($post_type != '' && $args['object_type'] == $post_type)
564
-                    $gd_taxonomies[] = $taxonomy;
563
+				if ($post_type != '' && $args['object_type'] == $post_type)
564
+					$gd_taxonomies[] = $taxonomy;
565 565
 
566
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
567
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
568
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
569
-                }
566
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
567
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
568
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
569
+				}
570 570
 
571
-            }
571
+			}
572
+
573
+			$gd_taxonomies = array_values($gd_taxonomies);
574
+		}
572 575
 
573
-            $gd_taxonomies = array_values($gd_taxonomies);
574
-        }
575
-
576
-        /**
577
-         * Filter the taxonomies.
578
-         *
579
-         * @since 1.0.0
580
-         * @param array $gd_taxonomies The taxonomy array.
581
-         */
582
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
583
-
584
-        if (!empty($taxonomies)) {
585
-            return $taxonomies;
586
-        } else {
587
-            return false;
588
-        }
589
-    }
576
+		/**
577
+		 * Filter the taxonomies.
578
+		 *
579
+		 * @since 1.0.0
580
+		 * @param array $gd_taxonomies The taxonomy array.
581
+		 */
582
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
583
+
584
+		if (!empty($taxonomies)) {
585
+			return $taxonomies;
586
+		} else {
587
+			return false;
588
+		}
589
+	}
590 590
 }
591 591
 
592 592
 if (!function_exists(' geodir_get_categories_dl')) {
593
-    /**
594
-     * Get categories dropdown HTML.
595
-     *
596
-     * @since 1.0.0
597
-     * @package GeoDirectory
598
-     * @param string $post_type The post type.
599
-     * @param string $selected The selected value.
600
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
601
-     * @param bool $echo Prints the HTML when set to true. Default: true.
602
-     * @return void|string Dropdown HTML.
603
-     */
604
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
605
-    {
606
-
607
-        $html = '';
608
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
609
-
610
-        $categories = get_terms($taxonomies);
611
-
612
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
613
-
614
-        foreach ($categories as $category_obj) {
615
-            $select_opt = '';
616
-            if ($selected == $category_obj->term_id) {
617
-                $select_opt = 'selected="selected"';
618
-            }
619
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
620
-                . ucfirst($category_obj->name) . '</option>';
621
-        }
622
-
623
-        if ($echo)
624
-            echo $html;
625
-        else
626
-            return $html;
627
-    }
593
+	/**
594
+	 * Get categories dropdown HTML.
595
+	 *
596
+	 * @since 1.0.0
597
+	 * @package GeoDirectory
598
+	 * @param string $post_type The post type.
599
+	 * @param string $selected The selected value.
600
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
601
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
602
+	 * @return void|string Dropdown HTML.
603
+	 */
604
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
605
+	{
606
+
607
+		$html = '';
608
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
609
+
610
+		$categories = get_terms($taxonomies);
611
+
612
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
613
+
614
+		foreach ($categories as $category_obj) {
615
+			$select_opt = '';
616
+			if ($selected == $category_obj->term_id) {
617
+				$select_opt = 'selected="selected"';
618
+			}
619
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
620
+				. ucfirst($category_obj->name) . '</option>';
621
+		}
622
+
623
+		if ($echo)
624
+			echo $html;
625
+		else
626
+			return $html;
627
+	}
628 628
 }
629 629
 
630 630
 
@@ -639,28 +639,28 @@  discard block
 block discarded – undo
639 639
 function geodir_get_listing_slug($object_type = '')
640 640
 {
641 641
 
642
-    $listing_slug = '';
642
+	$listing_slug = '';
643 643
 
644
-    $post_types = get_option('geodir_post_types');
645
-    $taxonomies = get_option('geodir_taxonomies');
644
+	$post_types = get_option('geodir_post_types');
645
+	$taxonomies = get_option('geodir_taxonomies');
646 646
 
647 647
 
648
-    if ($object_type != '') {
649
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
648
+	if ($object_type != '') {
649
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
650 650
 
651
-            $object_info = $post_types[$object_type];
652
-            $listing_slug = $object_info['listing_slug'];
653
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
654
-            $object_info = $taxonomies[$object_type];
655
-            $listing_slug = $object_info['listing_slug'];
656
-        }
651
+			$object_info = $post_types[$object_type];
652
+			$listing_slug = $object_info['listing_slug'];
653
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
654
+			$object_info = $taxonomies[$object_type];
655
+			$listing_slug = $object_info['listing_slug'];
656
+		}
657 657
 
658
-    }
658
+	}
659 659
 
660
-    if (!empty($listing_slug))
661
-        return $listing_slug;
662
-    else
663
-        return false;
660
+	if (!empty($listing_slug))
661
+		return $listing_slug;
662
+	else
663
+		return false;
664 664
 }
665 665
 
666 666
 
@@ -675,212 +675,212 @@  discard block
 block discarded – undo
675 675
  */
676 676
 function geodir_get_taxonomy_posttype($taxonomy = '')
677 677
 {
678
-    global $wp_query;
679
-
680
-    $post_type = array();
681
-    $taxonomies = array();
682
-
683
-    if (!empty($taxonomy)) {
684
-        $taxonomies[] = $taxonomy;
685
-    } elseif (isset($wp_query->tax_query->queries)) {
686
-        $tax_arr = $wp_query->tax_query->queries;
687
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
688
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
689
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
690
-    }
691
-
692
-    if (!empty($taxonomies)) {
693
-        foreach (geodir_get_posttypes() as $pt) {
694
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
695
-            if (array_intersect($taxonomies, $object_taxonomies))
696
-                $post_type[] = $pt;
697
-        }
698
-    }
699
-
700
-    if (!empty($post_type))
701
-        return $post_type[0];
702
-    else
703
-        return false;
678
+	global $wp_query;
679
+
680
+	$post_type = array();
681
+	$taxonomies = array();
682
+
683
+	if (!empty($taxonomy)) {
684
+		$taxonomies[] = $taxonomy;
685
+	} elseif (isset($wp_query->tax_query->queries)) {
686
+		$tax_arr = $wp_query->tax_query->queries;
687
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
688
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
689
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
690
+	}
691
+
692
+	if (!empty($taxonomies)) {
693
+		foreach (geodir_get_posttypes() as $pt) {
694
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
695
+			if (array_intersect($taxonomies, $object_taxonomies))
696
+				$post_type[] = $pt;
697
+		}
698
+	}
699
+
700
+	if (!empty($post_type))
701
+		return $post_type[0];
702
+	else
703
+		return false;
704 704
 }
705 705
 
706 706
 if (!function_exists('geodir_custom_taxonomy_walker')) {
707
-    /**
708
-     * Custom taxonomy walker function.
709
-     *
710
-     * @since 1.0.0
711
-     * @package GeoDirectory
712
-     * @param string $cat_taxonomy The taxonomy name.
713
-     * @param int $cat_parent The parent term ID.
714
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
715
-     * @param int $pading CSS padding in pixels.
716
-     * @return string|void taxonomy HTML.
717
-     */
718
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
719
-    {
720
-        global $cat_display, $post_cat, $exclude_cats;
721
-
722
-        $search_terms = trim($post_cat, ",");
723
-
724
-        $search_terms = explode(",", $search_terms);
725
-
726
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
727
-
728
-        $display = '';
729
-        $onchange = '';
730
-        $term_check = '';
731
-        $main_list_class = '';
732
-        $out = '';
733
-        //If there are terms, start displaying
734
-        if (count($cat_terms) > 0) {
735
-            //Displaying as a list
736
-            $p = $pading * 20;
737
-            $pading++;
738
-
739
-
740
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
741
-                if ($cat_parent == 0) {
742
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
743
-                    $main_list_class = 'class="main_list_selecter"';
744
-                } else {
745
-                    //$display = 'display:none';
746
-                    $list_class = 'sub_list gd-sub-cats-list';
747
-                }
748
-            }
707
+	/**
708
+	 * Custom taxonomy walker function.
709
+	 *
710
+	 * @since 1.0.0
711
+	 * @package GeoDirectory
712
+	 * @param string $cat_taxonomy The taxonomy name.
713
+	 * @param int $cat_parent The parent term ID.
714
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
715
+	 * @param int $pading CSS padding in pixels.
716
+	 * @return string|void taxonomy HTML.
717
+	 */
718
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
719
+	{
720
+		global $cat_display, $post_cat, $exclude_cats;
721
+
722
+		$search_terms = trim($post_cat, ",");
723
+
724
+		$search_terms = explode(",", $search_terms);
725
+
726
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
727
+
728
+		$display = '';
729
+		$onchange = '';
730
+		$term_check = '';
731
+		$main_list_class = '';
732
+		$out = '';
733
+		//If there are terms, start displaying
734
+		if (count($cat_terms) > 0) {
735
+			//Displaying as a list
736
+			$p = $pading * 20;
737
+			$pading++;
738
+
739
+
740
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
741
+				if ($cat_parent == 0) {
742
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
743
+					$main_list_class = 'class="main_list_selecter"';
744
+				} else {
745
+					//$display = 'display:none';
746
+					$list_class = 'sub_list gd-sub-cats-list';
747
+				}
748
+			}
749 749
 
750
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
751
-                $p = 0;
752
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
753
-            }
750
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
751
+				$p = 0;
752
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
753
+			}
754 754
 
755
-            foreach ($cat_terms as $cat_term) {
755
+			foreach ($cat_terms as $cat_term) {
756 756
 
757
-                $checked = '';
757
+				$checked = '';
758 758
 
759
-                if (in_array($cat_term->term_id, $search_terms)) {
760
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
761
-                        $checked = 'selected="selected"';
762
-                    else
763
-                        $checked = 'checked="checked"';
764
-                }
759
+				if (in_array($cat_term->term_id, $search_terms)) {
760
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
761
+						$checked = 'selected="selected"';
762
+					else
763
+						$checked = 'checked="checked"';
764
+				}
765 765
 
766
-                if ($cat_display == 'radio')
767
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
768
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
766
+				if ($cat_display == 'radio')
767
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
768
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
770 770
 
771
-                else {
772
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
773
-                }
771
+				else {
772
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
773
+				}
774 774
 
775
-                // Call recurson to print sub cats
776
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
775
+				// Call recurson to print sub cats
776
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
777 777
 
778
-            }
778
+			}
779 779
 
780
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
781
-                $out .= '</div>';
780
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
781
+				$out .= '</div>';
782 782
 
783
-            return $out;
784
-        }
785
-        return;
786
-    }
783
+			return $out;
784
+		}
785
+		return;
786
+	}
787 787
 }
788 788
 
789 789
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
790
-    /**
791
-     * Custom taxonomy walker function.
792
-     *
793
-     * @since 1.0.0
794
-     * @package GeoDirectory
795
-     * @global object $post WordPress Post object.
796
-     * @global object $gd_session GeoDirectory Session object.
797
-     * @param string $cat_taxonomy The taxonomy name.
798
-     * @param string $cat_limit Number of categories to display.
799
-     */
800
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
801
-    {
802
-        $post_category = '';
803
-        $post_category_str = '';
804
-        global $exclude_cats, $gd_session;
805
-
806
-        $cat_exclude = '';
807
-        if (is_array($exclude_cats) && !empty($exclude_cats))
808
-            $cat_exclude = serialize($exclude_cats);
809
-
810
-        if (isset($_REQUEST['backandedit'])) {
811
-            $post = (object)$gd_session->get('listing');
812
-
813
-            if (!is_array($post->post_category[$cat_taxonomy]))
814
-                $post_category = $post->post_category[$cat_taxonomy];
815
-
816
-            $post_categories = $post->post_category_str;
817
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
818
-                $post_category_str = $post_categories[$cat_taxonomy];
819
-
820
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
821
-            global $post;
822
-
823
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
824
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
825
-                $post_category = $post->{$cat_taxonomy};
826
-            }
790
+	/**
791
+	 * Custom taxonomy walker function.
792
+	 *
793
+	 * @since 1.0.0
794
+	 * @package GeoDirectory
795
+	 * @global object $post WordPress Post object.
796
+	 * @global object $gd_session GeoDirectory Session object.
797
+	 * @param string $cat_taxonomy The taxonomy name.
798
+	 * @param string $cat_limit Number of categories to display.
799
+	 */
800
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
801
+	{
802
+		$post_category = '';
803
+		$post_category_str = '';
804
+		global $exclude_cats, $gd_session;
805
+
806
+		$cat_exclude = '';
807
+		if (is_array($exclude_cats) && !empty($exclude_cats))
808
+			$cat_exclude = serialize($exclude_cats);
809
+
810
+		if (isset($_REQUEST['backandedit'])) {
811
+			$post = (object)$gd_session->get('listing');
812
+
813
+			if (!is_array($post->post_category[$cat_taxonomy]))
814
+				$post_category = $post->post_category[$cat_taxonomy];
815
+
816
+			$post_categories = $post->post_category_str;
817
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
818
+				$post_category_str = $post_categories[$cat_taxonomy];
819
+
820
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
821
+			global $post;
822
+
823
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
824
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
825
+				$post_category = $post->{$cat_taxonomy};
826
+			}
827 827
 
828
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
828
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
829 829
 
830
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
831
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
832
-                    if (is_numeric($cat_part)) {
833
-                        $cat_part_arr[] = $cat_part;
834
-                    }
835
-                }
836
-                if (is_array($cat_part_arr)) {
837
-                    $post_category = implode(',', $cat_part_arr);
838
-                }
839
-            }
830
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
831
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
832
+					if (is_numeric($cat_part)) {
833
+						$cat_part_arr[] = $cat_part;
834
+					}
835
+				}
836
+				if (is_array($cat_part_arr)) {
837
+					$post_category = implode(',', $cat_part_arr);
838
+				}
839
+			}
840 840
 
841
-            if (!empty($post_category)) {
842
-                $cat1 = array_filter(explode(',', $post_category));
843
-                $post_category = ',' . implode(',', $cat1) . ',';
841
+			if (!empty($post_category)) {
842
+				$cat1 = array_filter(explode(',', $post_category));
843
+				$post_category = ',' . implode(',', $cat1) . ',';
844 844
 
845
-            }
845
+			}
846 846
 
847
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
847
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
848 848
 
849
-                $post_category_upd = explode(',', $post_category);
850
-                $post_category_change = '';
851
-                foreach ($post_category_upd as $cat) {
849
+				$post_category_upd = explode(',', $post_category);
850
+				$post_category_change = '';
851
+				foreach ($post_category_upd as $cat) {
852 852
 
853
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
854
-                        $post_category_change .= ',' . $cat;
855
-                    }
856
-                }
857
-                $post_category = $post_category_change;
858
-            }
853
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
854
+						$post_category_change .= ',' . $cat;
855
+					}
856
+				}
857
+				$post_category = $post_category_change;
858
+			}
859 859
 
860 860
 
861
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
862
-                $post_category_str = $post_categories[$cat_taxonomy];
863
-            }
864
-        }
861
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
862
+				$post_category_str = $post_categories[$cat_taxonomy];
863
+			}
864
+		}
865 865
 
866
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
866
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
867 867
 
868
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
868
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
869 869
 
870
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
870
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
871 871
 
872 872
 
873
-        ?>
873
+		?>
874 874
         <div class="cat_sublist">
875 875
             <?php
876 876
 
877
-            $post_id = isset($post->ID) ? $post->ID : '';
877
+			$post_id = isset($post->ID) ? $post->ID : '';
878 878
 
879
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
879
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
880 880
 
881
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
882
-            }
883
-            ?>
881
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
882
+			}
883
+			?>
884 884
         </div>
885 885
         <script type="text/javascript">
886 886
 
@@ -1003,22 +1003,22 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
         </script>
1005 1005
         <?php
1006
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1007
-            $post_cat_str = $post_categories[$cat_taxonomy];
1008
-            $post_cat_array = explode("#", $post_cat_str);
1009
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1010
-                $style = "display:none;";
1011
-        }
1012
-        ?>
1006
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1007
+			$post_cat_str = $post_categories[$cat_taxonomy];
1008
+			$post_cat_array = explode("#", $post_cat_str);
1009
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1010
+				$style = "display:none;";
1011
+		}
1012
+		?>
1013 1013
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1014
-            echo $style;
1015
-        }?> ">
1014
+			echo $style;
1015
+		}?> ">
1016 1016
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1017
-            ?>
1017
+			?>
1018 1018
         </div>
1019 1019
     <?php
1020 1020
 
1021
-    }
1021
+	}
1022 1022
 }
1023 1023
 
1024 1024
 /**
@@ -1035,23 +1035,23 @@  discard block
 block discarded – undo
1035 1035
  */
1036 1036
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1037 1037
 {
1038
-    global $exclude_cats;
1038
+	global $exclude_cats;
1039 1039
 
1040
-    if ($exclude != '') {
1041
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1040
+	if ($exclude != '') {
1041
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1042 1042
 
1043
-        if(is_array( $exclude_cats)){
1044
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1045
-        }else{
1046
-            $exclude_cats = intval($exclude_cats);
1047
-        }
1043
+		if(is_array( $exclude_cats)){
1044
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1045
+		}else{
1046
+			$exclude_cats = intval($exclude_cats);
1047
+		}
1048 1048
 
1049
-    }
1049
+	}
1050 1050
 
1051
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1052
-        (!is_array($exclude_cats) || empty($exclude_cats))
1053
-    ) {
1054
-        ?>
1051
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1052
+		(!is_array($exclude_cats) || empty($exclude_cats))
1053
+	) {
1054
+		?>
1055 1055
 
1056 1056
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1057 1057
 
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
             <br/>
1082 1082
             <?php
1083
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1084
-            if (!empty($cat_terms)) { ?>
1083
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1084
+			if (!empty($cat_terms)) { ?>
1085 1085
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1086 1086
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1087 1087
             <?php } ?>
@@ -1103,53 +1103,53 @@  discard block
 block discarded – undo
1103 1103
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1104 1104
 {
1105 1105
 
1106
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1107
-        $post_cat_str = $post_categories[$request_taxonomy];
1108
-        $post_cat_array = explode("#", $post_cat_str);
1109
-        if (is_array($post_cat_array)) {
1110
-            $post_cat_array = array_unique( $post_cat_array );
1106
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1107
+		$post_cat_str = $post_categories[$request_taxonomy];
1108
+		$post_cat_array = explode("#", $post_cat_str);
1109
+		if (is_array($post_cat_array)) {
1110
+			$post_cat_array = array_unique( $post_cat_array );
1111 1111
 
1112 1112
 			foreach ($post_cat_array as $post_cat_html) {
1113 1113
 
1114
-                $post_cat_info = explode(":", $post_cat_html);
1115
-                $post_maincat_str = $post_cat_info[0];
1114
+				$post_cat_info = explode(":", $post_cat_html);
1115
+				$post_maincat_str = $post_cat_info[0];
1116 1116
 
1117
-                if (!empty($post_maincat_str)) {
1118
-                    $post_maincat_info = explode(",", $post_maincat_str);
1119
-                    $post_maincat_id = $post_maincat_info[0];
1120
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1121
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1122
-                }
1123
-                $post_sub_catid = '';
1124
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1125
-                    $post_sub_catid = (int)$post_cat_info[1];
1126
-                }
1117
+				if (!empty($post_maincat_str)) {
1118
+					$post_maincat_info = explode(",", $post_maincat_str);
1119
+					$post_maincat_id = $post_maincat_info[0];
1120
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1121
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1122
+				}
1123
+				$post_sub_catid = '';
1124
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1125
+					$post_sub_catid = (int)$post_cat_info[1];
1126
+				}
1127 1127
 
1128
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1128
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1129 1129
 
1130
-            }
1131
-        } else {
1130
+			}
1131
+		} else {
1132 1132
 
1133
-            $post_cat_info = explode(":", $post_cat_str);
1134
-            $post_maincat_str = $post_cat_info[0];
1133
+			$post_cat_info = explode(":", $post_cat_str);
1134
+			$post_maincat_str = $post_cat_info[0];
1135 1135
 
1136
-            $post_sub_catid = '';
1136
+			$post_sub_catid = '';
1137 1137
 
1138
-            if (!empty($post_maincat_str)) {
1139
-                $post_maincat_info = explode(",", $post_maincat_str);
1140
-                $post_maincat_id = $post_maincat_info[0];
1141
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1142
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1143
-            }
1138
+			if (!empty($post_maincat_str)) {
1139
+				$post_maincat_info = explode(",", $post_maincat_str);
1140
+				$post_maincat_id = $post_maincat_info[0];
1141
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1142
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1143
+			}
1144 1144
 
1145
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1146
-                $post_sub_catid = (int)$post_cat_info[1];
1147
-            }
1145
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1146
+				$post_sub_catid = (int)$post_cat_info[1];
1147
+			}
1148 1148
 
1149
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1149
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1150 1150
 
1151
-        }
1152
-    }
1151
+		}
1152
+	}
1153 1153
 }
1154 1154
 
1155 1155
 /**
@@ -1163,35 +1163,35 @@  discard block
 block discarded – undo
1163 1163
  */
1164 1164
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1165 1165
 {
1166
-    global $exclude_cats;
1166
+	global $exclude_cats;
1167 1167
 
1168
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1168
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1169 1169
 
1170
-    if (!empty($cat_terms)) {
1171
-        $onchange = '';
1172
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1170
+	if (!empty($cat_terms)) {
1171
+		$onchange = '';
1172
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1173 1173
 
1174
-        $option_selected = '';
1175
-        if (!$selected)
1176
-            $option_slected = ' selected="selected" ';
1174
+		$option_selected = '';
1175
+		if (!$selected)
1176
+			$option_slected = ' selected="selected" ';
1177 1177
 
1178
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1178
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1179 1179
 
1180
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1180
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1181 1181
 
1182
-        foreach ($cat_terms as $cat_term) {
1183
-            $option_selected = '';
1184
-            if ($selected == $cat_term->term_id)
1185
-                $option_selected = ' selected="selected" ';
1182
+		foreach ($cat_terms as $cat_term) {
1183
+			$option_selected = '';
1184
+			if ($selected == $cat_term->term_id)
1185
+				$option_selected = ' selected="selected" ';
1186 1186
 
1187
-            // Count child terms
1188
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1189
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1187
+			// Count child terms
1188
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1189
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1190 1190
 
1191
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1192
-        }
1193
-        echo '</select>';
1194
-    }
1191
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1192
+		}
1193
+		echo '</select>';
1194
+	}
1195 1195
 }
1196 1196
 
1197 1197
 /**
@@ -1207,28 +1207,28 @@  discard block
 block discarded – undo
1207 1207
  */
1208 1208
 function geodir_custom_update_messages($messages)
1209 1209
 {
1210
-    global $post, $post_ID;
1211
-
1212
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1213
-
1214
-    foreach ($post_types as $post_type => $post_object) {
1215
-
1216
-        $messages[$post_type] = array(
1217
-            0 => '', // Unused. Messages start at index 1.
1218
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1219
-            2 => __('Custom field updated.', 'geodirectory'),
1220
-            3 => __('Custom field deleted.', 'geodirectory'),
1221
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1222
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1223
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1224
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1225
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1226
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1227
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1228
-        );
1229
-    }
1230
-
1231
-    return $messages;
1210
+	global $post, $post_ID;
1211
+
1212
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1213
+
1214
+	foreach ($post_types as $post_type => $post_object) {
1215
+
1216
+		$messages[$post_type] = array(
1217
+			0 => '', // Unused. Messages start at index 1.
1218
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1219
+			2 => __('Custom field updated.', 'geodirectory'),
1220
+			3 => __('Custom field deleted.', 'geodirectory'),
1221
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1222
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1223
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1224
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1225
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1226
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1227
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1228
+		);
1229
+	}
1230
+
1231
+	return $messages;
1232 1232
 }
1233 1233
 
1234 1234
 
@@ -1243,183 +1243,183 @@  discard block
 block discarded – undo
1243 1243
 function geodir_register_defaults()
1244 1244
 {
1245 1245
 
1246
-    global $wpdb;
1247
-
1248
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1249
-
1250
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1251
-        $listing_slug = 'places';
1252
-
1253
-    /**
1254
-     * Taxonomies
1255
-     **/
1256
-    //if ( ! taxonomy_exists('gd_place_tags') )
1257
-    {
1258
-
1259
-        $gd_placetags = array();
1260
-        $gd_placetags['object_type'] = 'gd_place';
1261
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1262
-        $gd_placetags['args'] = array(
1263
-            'public' => true,
1264
-            'hierarchical' => false,
1265
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1266
-            'query_var' => true,
1267
-
1268
-            'labels' => array(
1269
-                'name' => __('Place Tags', 'geodirectory'),
1270
-                'singular_name' => __('Place Tag', 'geodirectory'),
1271
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1272
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1273
-                'all_items' => __('All Place Tags', 'geodirectory'),
1274
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1275
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1276
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1277
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1278
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1279
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1280
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1281
-            ),
1282
-        );
1283
-
1284
-
1285
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1286
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1287
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1288
-
1289
-
1290
-        // Update post types and delete tmp options
1291
-        flush_rewrite_rules();
1292
-
1293
-    }
1294
-
1295
-    //if ( ! taxonomy_exists('gd_placecategory') )
1296
-    {
1297
-
1298
-        $gd_placecategory = array();
1299
-        $gd_placecategory['object_type'] = 'gd_place';
1300
-        $gd_placecategory['listing_slug'] = $listing_slug;
1301
-        $gd_placecategory['args'] = array(
1302
-            'public' => true,
1303
-            'hierarchical' => true,
1304
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1305
-            'query_var' => true,
1306
-            'labels' => array(
1307
-                'name' => __('Place Categories', 'geodirectory'),
1308
-                'singular_name' => __('Place Category', 'geodirectory'),
1309
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1310
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1311
-                'all_items' => __('All Place Categories', 'geodirectory'),
1312
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1313
-                'update_item' => __('Update Place Category', 'geodirectory'),
1314
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1315
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1316
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1317
-            ),
1318
-        );
1319
-
1320
-
1321
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1322
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1323
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1324
-
1325
-
1326
-        flush_rewrite_rules();
1327
-    }
1328
-
1329
-    /**
1330
-     * Post Types
1331
-     **/
1332
-
1333
-    //if ( ! post_type_exists('gd_place') )
1334
-    {
1335
-
1336
-        $labels = array(
1337
-            'name' => __('Places', 'geodirectory'),
1338
-            'singular_name' => __('Place', 'geodirectory'),
1339
-            'add_new' => __('Add New', 'geodirectory'),
1340
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1341
-            'edit_item' => __('Edit Place', 'geodirectory'),
1342
-            'new_item' => __('New Place', 'geodirectory'),
1343
-            'view_item' => __('View Place', 'geodirectory'),
1344
-            'search_items' => __('Search Places', 'geodirectory'),
1345
-            'not_found' => __('No Place Found', 'geodirectory'),
1346
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1347
-
1348
-        $place_default = array(
1349
-            'labels' => $labels,
1350
-            'can_export' => true,
1351
-            'capability_type' => 'post',
1352
-            'description' => 'Place post type.',
1353
-            'has_archive' => $listing_slug,
1354
-            'hierarchical' => false,
1355
-            'map_meta_cap' => true,
1356
-            'menu_icon' => $menu_icon,
1357
-            'public' => true,
1358
-            'query_var' => true,
1359
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1360
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1361
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1362
-
1363
-        //Update custom post types
1364
-        $geodir_post_types = get_option('geodir_post_types');
1365
-        $geodir_post_types['gd_place'] = $place_default;
1366
-        update_option('geodir_post_types', $geodir_post_types);
1367
-
1368
-        // Update post types and delete tmp options
1369
-        flush_rewrite_rules();
1370
-    }
1371
-
1372
-
1373
-    geodir_register_taxonomies();
1374
-    geodir_register_post_types();
1375
-
1376
-    //die;
1246
+	global $wpdb;
1247
+
1248
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1249
+
1250
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1251
+		$listing_slug = 'places';
1252
+
1253
+	/**
1254
+	 * Taxonomies
1255
+	 **/
1256
+	//if ( ! taxonomy_exists('gd_place_tags') )
1257
+	{
1258
+
1259
+		$gd_placetags = array();
1260
+		$gd_placetags['object_type'] = 'gd_place';
1261
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1262
+		$gd_placetags['args'] = array(
1263
+			'public' => true,
1264
+			'hierarchical' => false,
1265
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1266
+			'query_var' => true,
1267
+
1268
+			'labels' => array(
1269
+				'name' => __('Place Tags', 'geodirectory'),
1270
+				'singular_name' => __('Place Tag', 'geodirectory'),
1271
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1272
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1273
+				'all_items' => __('All Place Tags', 'geodirectory'),
1274
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1275
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1276
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1277
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1278
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1279
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1280
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1281
+			),
1282
+		);
1283
+
1284
+
1285
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1286
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1287
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1288
+
1289
+
1290
+		// Update post types and delete tmp options
1291
+		flush_rewrite_rules();
1292
+
1293
+	}
1294
+
1295
+	//if ( ! taxonomy_exists('gd_placecategory') )
1296
+	{
1297
+
1298
+		$gd_placecategory = array();
1299
+		$gd_placecategory['object_type'] = 'gd_place';
1300
+		$gd_placecategory['listing_slug'] = $listing_slug;
1301
+		$gd_placecategory['args'] = array(
1302
+			'public' => true,
1303
+			'hierarchical' => true,
1304
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1305
+			'query_var' => true,
1306
+			'labels' => array(
1307
+				'name' => __('Place Categories', 'geodirectory'),
1308
+				'singular_name' => __('Place Category', 'geodirectory'),
1309
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1310
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1311
+				'all_items' => __('All Place Categories', 'geodirectory'),
1312
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1313
+				'update_item' => __('Update Place Category', 'geodirectory'),
1314
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1315
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1316
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1317
+			),
1318
+		);
1319
+
1320
+
1321
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1322
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1323
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1324
+
1325
+
1326
+		flush_rewrite_rules();
1327
+	}
1328
+
1329
+	/**
1330
+	 * Post Types
1331
+	 **/
1332
+
1333
+	//if ( ! post_type_exists('gd_place') )
1334
+	{
1335
+
1336
+		$labels = array(
1337
+			'name' => __('Places', 'geodirectory'),
1338
+			'singular_name' => __('Place', 'geodirectory'),
1339
+			'add_new' => __('Add New', 'geodirectory'),
1340
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1341
+			'edit_item' => __('Edit Place', 'geodirectory'),
1342
+			'new_item' => __('New Place', 'geodirectory'),
1343
+			'view_item' => __('View Place', 'geodirectory'),
1344
+			'search_items' => __('Search Places', 'geodirectory'),
1345
+			'not_found' => __('No Place Found', 'geodirectory'),
1346
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1347
+
1348
+		$place_default = array(
1349
+			'labels' => $labels,
1350
+			'can_export' => true,
1351
+			'capability_type' => 'post',
1352
+			'description' => 'Place post type.',
1353
+			'has_archive' => $listing_slug,
1354
+			'hierarchical' => false,
1355
+			'map_meta_cap' => true,
1356
+			'menu_icon' => $menu_icon,
1357
+			'public' => true,
1358
+			'query_var' => true,
1359
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1360
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1361
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1362
+
1363
+		//Update custom post types
1364
+		$geodir_post_types = get_option('geodir_post_types');
1365
+		$geodir_post_types['gd_place'] = $place_default;
1366
+		update_option('geodir_post_types', $geodir_post_types);
1367
+
1368
+		// Update post types and delete tmp options
1369
+		flush_rewrite_rules();
1370
+	}
1371
+
1372
+
1373
+	geodir_register_taxonomies();
1374
+	geodir_register_post_types();
1375
+
1376
+	//die;
1377 1377
 
1378 1378
 }
1379 1379
 
1380 1380
 $gd_wpml_get_languages = "";
1381 1381
 function gd_wpml_get_lang_from_url($url){
1382 1382
 
1383
-    global $gd_wpml_get_languages;
1384
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1383
+	global $gd_wpml_get_languages;
1384
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1385 1385
 
1386 1386
 
1387
-    //
1388
-    $url = str_replace(array("http://","https://"),"",$url);
1387
+	//
1388
+	$url = str_replace(array("http://","https://"),"",$url);
1389 1389
 
1390
-    // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1391
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1390
+	// site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1391
+	$site_url = str_replace(array("http://","https://"),"",site_url());
1392 1392
 
1393
-    $url = str_replace($site_url,"",$url);
1393
+	$url = str_replace($site_url,"",$url);
1394 1394
 
1395 1395
 
1396
-    $segments = explode('/', trim($url, '/'));
1396
+	$segments = explode('/', trim($url, '/'));
1397 1397
 
1398
-    //print_r( $segments);
1399
-    if($gd_wpml_get_languages){
1400
-        $langs = $gd_wpml_get_languages;
1401
-    }else{
1402
-        global $sitepress;
1403
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1404
-    }
1398
+	//print_r( $segments);
1399
+	if($gd_wpml_get_languages){
1400
+		$langs = $gd_wpml_get_languages;
1401
+	}else{
1402
+		global $sitepress;
1403
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1404
+	}
1405 1405
 
1406
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1407
-        return $segments[0];
1408
-    }
1406
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1407
+		return $segments[0];
1408
+	}
1409 1409
 
1410
-    return false;
1410
+	return false;
1411 1411
 
1412 1412
 
1413 1413
 }
1414 1414
 
1415 1415
 function gd_wpml_slug_translation_turned_on($post_type) {
1416 1416
 
1417
-    global $sitepress;
1418
-    $settings = $sitepress->get_settings();
1419
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1420
-    && $settings['posts_slug_translation']['types'][$post_type]
1421
-    && isset($settings['posts_slug_translation']['on'])
1422
-    && $settings['posts_slug_translation']['on'];
1417
+	global $sitepress;
1418
+	$settings = $sitepress->get_settings();
1419
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1420
+	&& $settings['posts_slug_translation']['types'][$post_type]
1421
+	&& isset($settings['posts_slug_translation']['on'])
1422
+	&& $settings['posts_slug_translation']['on'];
1423 1423
 }
1424 1424
 
1425 1425
 
@@ -1444,150 +1444,150 @@  discard block
 block discarded – undo
1444 1444
  */
1445 1445
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1446 1446
 {
1447
-    //echo $post_link."<br />".$sample ;
1447
+	//echo $post_link."<br />".$sample ;
1448 1448
 
1449 1449
 
1450
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1451
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1452
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1453
-        return $post_link;
1454
-    } else {
1455
-        $orig_post = $post;
1456
-        $post = $post_obj;
1457
-    }
1450
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1451
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1452
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1453
+		return $post_link;
1454
+	} else {
1455
+		$orig_post = $post;
1456
+		$post = $post_obj;
1457
+	}
1458 1458
 
1459
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1459
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1460 1460
 
1461 1461
 
1462
-        $post_types = get_option('geodir_post_types');
1463
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1462
+		$post_types = get_option('geodir_post_types');
1463
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1464 1464
 
1465
-        // Alter the CPT slug if WPML is set to do so
1466
-        if(function_exists('icl_object_id')){
1467
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1465
+		// Alter the CPT slug if WPML is set to do so
1466
+		if(function_exists('icl_object_id')){
1467
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1468 1468
 
1469
-                $org_slug = $slug;
1470
-                $slug = apply_filters( 'wpml_translate_single_string',
1471
-                    $slug,
1472
-                    'WordPress',
1473
-                    'URL slug: ' . $slug,
1474
-                    $language_code);
1469
+				$org_slug = $slug;
1470
+				$slug = apply_filters( 'wpml_translate_single_string',
1471
+					$slug,
1472
+					'WordPress',
1473
+					'URL slug: ' . $slug,
1474
+					$language_code);
1475 1475
 
1476
-                if(!$slug){$slug = $org_slug;}
1476
+				if(!$slug){$slug = $org_slug;}
1477 1477
 
1478
-            }
1479
-        }
1478
+			}
1479
+		}
1480 1480
 
1481
-        if (function_exists('geodir_location_geo_home_link')) {
1482
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1483
-        }
1481
+		if (function_exists('geodir_location_geo_home_link')) {
1482
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1483
+		}
1484 1484
         
1485
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1486
-        $site_url = trailingslashit(get_bloginfo('url'));
1485
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1486
+		$site_url = trailingslashit(get_bloginfo('url'));
1487 1487
         
1488
-        if (function_exists('geodir_location_geo_home_link')) {
1489
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1490
-        }
1491
-
1492
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1493
-        if ($fix_url) {
1494
-            $post_link = str_replace($site_url, '', $post_link);
1495
-        }
1496
-
1497
-        $post_link = trailingslashit(
1498
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1499
-        );
1500
-
1501
-        if ($fix_url) {
1502
-            $post_link = $site_url . $post_link;
1503
-        }
1504
-
1505
-        if (isset($comment_post_cache[$post->ID])) {
1506
-            $post = $comment_post_cache[$post->ID];
1507
-        }
1508
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1509
-            $post_id = $post->ID;
1510
-            if (isset($orig_post)) {
1511
-                $post = $orig_post;
1512
-            }
1513
-            return $gd_permalink_cache[$post_id];
1514
-        }
1488
+		if (function_exists('geodir_location_geo_home_link')) {
1489
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1490
+		}
1515 1491
 
1516
-        if (!isset($post->post_locations)) {
1517
-            $post_type = $post->post_type;
1518
-            $ID = $post->ID;
1519
-            $post2 = $wpdb->get_row(
1520
-                $wpdb->prepare(
1521
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1522
-                    array($post->ID)
1523
-                )
1524
-            );
1492
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1493
+		if ($fix_url) {
1494
+			$post_link = str_replace($site_url, '', $post_link);
1495
+		}
1525 1496
 
1526
-            $post = (object)array_merge((array)$post, (array)$post2);
1497
+		$post_link = trailingslashit(
1498
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1499
+		);
1527 1500
 
1528
-            $comment_post_cache[$post->ID] = $post;
1529
-        }
1501
+		if ($fix_url) {
1502
+			$post_link = $site_url . $post_link;
1503
+		}
1530 1504
 
1505
+		if (isset($comment_post_cache[$post->ID])) {
1506
+			$post = $comment_post_cache[$post->ID];
1507
+		}
1508
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1509
+			$post_id = $post->ID;
1510
+			if (isset($orig_post)) {
1511
+				$post = $orig_post;
1512
+			}
1513
+			return $gd_permalink_cache[$post_id];
1514
+		}
1531 1515
 
1516
+		if (!isset($post->post_locations)) {
1517
+			$post_type = $post->post_type;
1518
+			$ID = $post->ID;
1519
+			$post2 = $wpdb->get_row(
1520
+				$wpdb->prepare(
1521
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1522
+					array($post->ID)
1523
+				)
1524
+			);
1532 1525
 
1533
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1526
+			$post = (object)array_merge((array)$post, (array)$post2);
1534 1527
 
1535
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1536
-                $location_request = '';
1528
+			$comment_post_cache[$post->ID] = $post;
1529
+		}
1537 1530
 
1538 1531
 
1539
-                if (!empty($post->post_locations)) {
1540
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1541
-                    if (count($geodir_arr_locations) == 3) {
1542
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1543
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1544
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1545
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1546
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1547
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1548 1532
 
1549
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1550
-                            'region_slug' => $post->region_slug,
1551
-                            'city_slug' => $post->city_slug
1552
-                        );
1533
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1553 1534
 
1554
-                    } else
1555
-                        $post_location = geodir_get_location();
1535
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1536
+				$location_request = '';
1556 1537
 
1557 1538
 
1558
-                } else {
1539
+				if (!empty($post->post_locations)) {
1540
+					$geodir_arr_locations = explode(',', $post->post_locations);
1541
+					if (count($geodir_arr_locations) == 3) {
1542
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1543
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1544
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1545
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1546
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1547
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1559 1548
 
1560
-                    $post_location_sql = $wpdb->get_results(
1561
-                        $wpdb->prepare(
1562
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1563
-                            array($post->ID)
1564
-                        )
1565
-                    );
1566
-
1567
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1568
-
1569
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1570
-                        if (count($geodir_arr_locations) == 3) {
1571
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1572
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1573
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1574
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1575
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1576
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1577
-
1578
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1579
-                                'region_slug' => $post->region_slug,
1580
-                                'city_slug' => $post->city_slug
1581
-                            );
1549
+						$post_location = (object)array('country_slug' => $post->country_slug,
1550
+							'region_slug' => $post->region_slug,
1551
+							'city_slug' => $post->city_slug
1552
+						);
1582 1553
 
1583
-                        }
1584
-                    } else
1585
-                        $post_location = geodir_get_location();
1586
-                }
1554
+					} else
1555
+						$post_location = geodir_get_location();
1587 1556
 
1588 1557
 
1589
-                if (!empty($post_location)) {
1590
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1558
+				} else {
1559
+
1560
+					$post_location_sql = $wpdb->get_results(
1561
+						$wpdb->prepare(
1562
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1563
+							array($post->ID)
1564
+						)
1565
+					);
1566
+
1567
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1568
+
1569
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1570
+						if (count($geodir_arr_locations) == 3) {
1571
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1572
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1573
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1574
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1575
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1576
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1577
+
1578
+							$post_location = (object)array('country_slug' => $post->country_slug,
1579
+								'region_slug' => $post->region_slug,
1580
+								'city_slug' => $post->city_slug
1581
+							);
1582
+
1583
+						}
1584
+					} else
1585
+						$post_location = geodir_get_location();
1586
+				}
1587
+
1588
+
1589
+				if (!empty($post_location)) {
1590
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1591 1591
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1592 1592
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1593 1593
 					
@@ -1605,78 +1605,78 @@  discard block
 block discarded – undo
1605 1605
 					$location_slug[] = $city_slug;
1606 1606
 					
1607 1607
 					$location_request .= implode('/', $location_slug) . '/';
1608
-                }
1609
-            }
1608
+				}
1609
+			}
1610 1610
 
1611
-            if (get_option('geodir_add_categories_url')) {
1611
+			if (get_option('geodir_add_categories_url')) {
1612 1612
 
1613
-                $term_request = '';
1614
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1613
+				$term_request = '';
1614
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1615 1615
 
1616
-                $taxonomies = end($taxonomies);
1616
+				$taxonomies = end($taxonomies);
1617 1617
 
1618
-                if (!empty($post->default_category)) {
1619
-                    $post_terms = $post->default_category;
1620
-                } else {
1621
-                    $post_terms = '';
1618
+				if (!empty($post->default_category)) {
1619
+					$post_terms = $post->default_category;
1620
+				} else {
1621
+					$post_terms = '';
1622 1622
 
1623
-                    if (isset($post->{$taxonomies})) {
1624
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1625
-                        $post_terms = $post_terms[0];
1626
-                    }
1623
+					if (isset($post->{$taxonomies})) {
1624
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1625
+						$post_terms = $post_terms[0];
1626
+					}
1627 1627
 
1628
-                    if (!$post_terms)
1629
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1628
+					if (!$post_terms)
1629
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1630 1630
 
1631
-                    if (!$post_terms) {
1632
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1631
+					if (!$post_terms) {
1632
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1633 1633
 
1634
-                        if ($post_terms) {
1635
-                            $post_terms = explode(",", trim($post_terms, ","));
1636
-                            $post_terms = $post_terms[0];
1637
-                        }
1638
-                    }
1639
-                }
1634
+						if ($post_terms) {
1635
+							$post_terms = explode(",", trim($post_terms, ","));
1636
+							$post_terms = $post_terms[0];
1637
+						}
1638
+					}
1639
+				}
1640 1640
 
1641
-                $term = get_term_by('id', $post_terms, $taxonomies);
1641
+				$term = get_term_by('id', $post_terms, $taxonomies);
1642 1642
 
1643
-                if (!empty($term))
1644
-                    $term_request = $term->slug;
1645
-                //$term_request = $term->slug.'/';
1646
-            }
1643
+				if (!empty($term))
1644
+					$term_request = $term->slug;
1645
+				//$term_request = $term->slug.'/';
1646
+			}
1647 1647
 
1648
-            $request_term = '';
1649
-            $listingurl_separator = '';
1650
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1651
-            $detailurl_separator = '';
1652
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1653
-                $request_term = $location_request;
1654
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1655
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1656
-                $request_term .= $term_request;
1648
+			$request_term = '';
1649
+			$listingurl_separator = '';
1650
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1651
+			$detailurl_separator = '';
1652
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1653
+				$request_term = $location_request;
1654
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1655
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1656
+				$request_term .= $term_request;
1657 1657
 
1658
-            } else {
1659
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1658
+			} else {
1659
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1660 1660
 
1661
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1662
-            }
1663
-            $request_term = trim($request_term, '/');
1664
-            if (!empty($request_term))
1665
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1666
-            else
1667
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1668
-            //echo $post_link ;
1669
-        }
1670
-        // temp cache the permalink
1671
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1672
-            $gd_permalink_cache[$post->ID] = $post_link;
1673
-        }
1674
-    }
1675
-    if (isset($orig_post)) {
1676
-        $post = $orig_post;
1677
-    }
1678
-
1679
-    return $post_link;
1661
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1662
+			}
1663
+			$request_term = trim($request_term, '/');
1664
+			if (!empty($request_term))
1665
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1666
+			else
1667
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1668
+			//echo $post_link ;
1669
+		}
1670
+		// temp cache the permalink
1671
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1672
+			$gd_permalink_cache[$post->ID] = $post_link;
1673
+		}
1674
+	}
1675
+	if (isset($orig_post)) {
1676
+		$post = $orig_post;
1677
+	}
1678
+
1679
+	return $post_link;
1680 1680
 }
1681 1681
 
1682 1682
 /**
@@ -1692,99 +1692,99 @@  discard block
 block discarded – undo
1692 1692
  * @return string The term link.
1693 1693
  */
1694 1694
 function geodir_term_link($termlink, $term, $taxonomy) {
1695
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1695
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1696 1696
 
1697
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1698
-        global $geodir_add_location_url, $gd_session;
1699
-        $include_location = false;
1700
-        $request_term = array();
1701
-        $add_location_url = get_option('geodir_add_location_url');
1702
-        $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1697
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1698
+		global $geodir_add_location_url, $gd_session;
1699
+		$include_location = false;
1700
+		$request_term = array();
1701
+		$add_location_url = get_option('geodir_add_location_url');
1702
+		$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1703 1703
 
1704
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1704
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1705 1705
 
1706
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1707
-            if ($geodir_add_location_url && $add_location_url) {
1708
-                $include_location = true;
1709
-            }
1710
-        } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1711
-            $include_location = true;
1712
-        } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1713
-            $include_location = true;
1714
-        }
1715
-
1716
-        if ($include_location) {
1717
-            global $post;
1706
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1707
+			if ($geodir_add_location_url && $add_location_url) {
1708
+				$include_location = true;
1709
+			}
1710
+		} elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1711
+			$include_location = true;
1712
+		} elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1713
+			$include_location = true;
1714
+		}
1715
+
1716
+		if ($include_location) {
1717
+			global $post;
1718 1718
             
1719
-            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1719
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1720 1720
             
1721
-            if (geodir_is_page('detail') && isset($post->country_slug)) {
1722
-                $location_terms = array(
1723
-                    'gd_country' => $post->country_slug,
1724
-                    'gd_region' => $post->region_slug,
1725
-                    'gd_city' => $post->city_slug
1726
-                );
1721
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1722
+				$location_terms = array(
1723
+					'gd_country' => $post->country_slug,
1724
+					'gd_region' => $post->region_slug,
1725
+					'gd_city' => $post->city_slug
1726
+				);
1727 1727
                 
1728
-                if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1729
-                    $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1730
-                }
1731
-            } else {
1732
-                $location_terms = geodir_get_current_location_terms('query_vars');
1733
-            }
1728
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1729
+					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1730
+				}
1731
+			} else {
1732
+				$location_terms = geodir_get_current_location_terms('query_vars');
1733
+			}
1734 1734
 
1735
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1736
-            $location_terms = geodir_remove_location_terms($location_terms);
1735
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1736
+			$location_terms = geodir_remove_location_terms($location_terms);
1737 1737
 
1738
-            if (!empty($location_terms)) {
1739
-                $url_separator = '';
1738
+			if (!empty($location_terms)) {
1739
+				$url_separator = '';
1740 1740
 
1741
-                if (get_option('permalink_structure') != '') {
1742
-                    $old_listing_slug = '/' . $listing_slug . '/';
1743
-                    $request_term = implode("/", $location_terms);
1744
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1741
+				if (get_option('permalink_structure') != '') {
1742
+					$old_listing_slug = '/' . $listing_slug . '/';
1743
+					$request_term = implode("/", $location_terms);
1744
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1745 1745
 
1746
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1747
-                } else {
1748
-                    $termlink = geodir_getlink($termlink, $request_term);
1749
-                }
1750
-            }
1751
-        }
1746
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1747
+				} else {
1748
+					$termlink = geodir_getlink($termlink, $request_term);
1749
+				}
1750
+			}
1751
+		}
1752 1752
 
1753
-        // Alter the CPT slug is WPML is set to do so
1754
-        /* we can replace this with the below function
1753
+		// Alter the CPT slug is WPML is set to do so
1754
+		/* we can replace this with the below function
1755 1755
         if(function_exists('icl_object_id')){
1756 1756
             global $sitepress;
1757 1757
             $post_type = str_replace("category","",$taxonomy);
1758 1758
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1759 1759
         }*/
1760 1760
 
1761
-        // Alter the CPT slug if WPML is set to do so
1762
-        if (function_exists('icl_object_id')) {
1763
-            $post_types = get_option('geodir_post_types');
1764
-            $post_type = str_replace("category","",$taxonomy);
1765
-            $post_type = str_replace("_tags","",$post_type);
1766
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1767
-            if (gd_wpml_slug_translation_turned_on($post_type)) {
1768
-                global $sitepress;
1769
-                $default_lang = $sitepress->get_default_language();
1770
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1771
-                if (!$language_code ) {
1772
-                    $language_code  = $default_lang;
1773
-                }
1761
+		// Alter the CPT slug if WPML is set to do so
1762
+		if (function_exists('icl_object_id')) {
1763
+			$post_types = get_option('geodir_post_types');
1764
+			$post_type = str_replace("category","",$taxonomy);
1765
+			$post_type = str_replace("_tags","",$post_type);
1766
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1767
+			if (gd_wpml_slug_translation_turned_on($post_type)) {
1768
+				global $sitepress;
1769
+				$default_lang = $sitepress->get_default_language();
1770
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1771
+				if (!$language_code ) {
1772
+					$language_code  = $default_lang;
1773
+				}
1774 1774
 
1775
-                $org_slug = $slug;
1776
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1775
+				$org_slug = $slug;
1776
+				$slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1777 1777
 
1778
-                if (!$slug) {
1779
-                    $slug = $org_slug;
1780
-                }
1778
+				if (!$slug) {
1779
+					$slug = $org_slug;
1780
+				}
1781 1781
 
1782
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1783
-            }
1784
-        }
1785
-    }
1782
+				$termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1783
+			}
1784
+		}
1785
+	}
1786 1786
     
1787
-    return $termlink;
1787
+	return $termlink;
1788 1788
 }
1789 1789
 
1790 1790
 /**
@@ -1810,14 +1810,14 @@  discard block
 block discarded – undo
1810 1810
 	if (in_array($post_type, geodir_get_posttypes())) {
1811 1811
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1812 1812
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1813
-                $location_terms = array(
1814
-                    'gd_country' => $post->country_slug,
1815
-                    'gd_region' => $post->region_slug,
1816
-                    'gd_city' => $post->city_slug
1817
-                );
1818
-            } else {
1819
-                $location_terms = geodir_get_current_location_terms('query_vars');
1820
-            }
1813
+				$location_terms = array(
1814
+					'gd_country' => $post->country_slug,
1815
+					'gd_region' => $post->region_slug,
1816
+					'gd_city' => $post->city_slug
1817
+				);
1818
+			} else {
1819
+				$location_terms = geodir_get_current_location_terms('query_vars');
1820
+			}
1821 1821
 			
1822 1822
 			$location_terms = geodir_remove_location_terms($location_terms);
1823 1823
 			
@@ -1848,14 +1848,14 @@  discard block
 block discarded – undo
1848 1848
  */
1849 1849
 function get_post_type_singular_label($post_type, $echo = false)
1850 1850
 {
1851
-    $obj_post_type = get_post_type_object($post_type);
1852
-    if (!is_object($obj_post_type)) {
1853
-        return;
1854
-    }
1855
-    if ($echo)
1856
-        echo $obj_post_type->labels->singular_name;
1857
-    else
1858
-        return $obj_post_type->labels->singular_name;
1851
+	$obj_post_type = get_post_type_object($post_type);
1852
+	if (!is_object($obj_post_type)) {
1853
+		return;
1854
+	}
1855
+	if ($echo)
1856
+		echo $obj_post_type->labels->singular_name;
1857
+	else
1858
+		return $obj_post_type->labels->singular_name;
1859 1859
 
1860 1860
 }
1861 1861
 
@@ -1870,16 +1870,16 @@  discard block
 block discarded – undo
1870 1870
  */
1871 1871
 function get_post_type_plural_label($post_type, $echo = false)
1872 1872
 {
1873
-    $all_postypes = geodir_get_posttypes();
1873
+	$all_postypes = geodir_get_posttypes();
1874 1874
 
1875
-    if (!in_array($post_type, $all_postypes))
1876
-        return false;
1875
+	if (!in_array($post_type, $all_postypes))
1876
+		return false;
1877 1877
 
1878
-    $obj_post_type = get_post_type_object($post_type);
1879
-    if ($echo)
1880
-        echo $obj_post_type->labels->name;
1881
-    else
1882
-        return $obj_post_type->labels->name;
1878
+	$obj_post_type = get_post_type_object($post_type);
1879
+	if ($echo)
1880
+		echo $obj_post_type->labels->name;
1881
+	else
1882
+		return $obj_post_type->labels->name;
1883 1883
 
1884 1884
 }
1885 1885
 
@@ -1898,51 +1898,51 @@  discard block
 block discarded – undo
1898 1898
  */
1899 1899
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1900 1900
 {
1901
-    global $wpdb;
1902
-
1903
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1904
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1905
-
1906
-    if (is_int($term)) {
1907
-        if (0 == $term)
1908
-            return 0;
1909
-        $where = 't.term_id = %d';
1910
-        if (!empty($taxonomy))
1911
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912
-        else
1913
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1914
-    }
1901
+	global $wpdb;
1902
+
1903
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1904
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1905
+
1906
+	if (is_int($term)) {
1907
+		if (0 == $term)
1908
+			return 0;
1909
+		$where = 't.term_id = %d';
1910
+		if (!empty($taxonomy))
1911
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912
+		else
1913
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1914
+	}
1915 1915
 
1916
-    $term = trim(wp_unslash($term));
1916
+	$term = trim(wp_unslash($term));
1917 1917
 
1918
-    if ('' === $slug = sanitize_title($term))
1919
-        return 0;
1918
+	if ('' === $slug = sanitize_title($term))
1919
+		return 0;
1920 1920
 
1921
-    $where = 't.slug = %s';
1921
+	$where = 't.slug = %s';
1922 1922
 
1923
-    $where_fields = array($slug);
1924
-    if (!empty($taxonomy)) {
1925
-        $parent = (int)$parent;
1926
-        if ($parent > 0) {
1927
-            $where_fields[] = $parent;
1928
-            $else_where_fields[] = $parent;
1929
-            $where .= ' AND tt.parent = %d';
1923
+	$where_fields = array($slug);
1924
+	if (!empty($taxonomy)) {
1925
+		$parent = (int)$parent;
1926
+		if ($parent > 0) {
1927
+			$where_fields[] = $parent;
1928
+			$else_where_fields[] = $parent;
1929
+			$where .= ' AND tt.parent = %d';
1930 1930
 
1931
-        }
1931
+		}
1932 1932
 
1933
-        $where_fields[] = $taxonomy;
1933
+		$where_fields[] = $taxonomy;
1934 1934
 
1935 1935
 
1936
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1937
-            return $result;
1936
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1937
+			return $result;
1938 1938
 
1939
-        return false;
1940
-    }
1939
+		return false;
1940
+	}
1941 1941
 
1942
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1943
-        return $result;
1942
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1943
+		return $result;
1944 1944
 
1945
-    return false;
1945
+	return false;
1946 1946
 }
1947 1947
 
1948 1948
 /**
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 function geodir_get_term_icon_rebuild()
1955 1955
 {
1956 1956
 
1957
-    update_option('gd_term_icons', '');
1957
+	update_option('gd_term_icons', '');
1958 1958
 
1959 1959
 }
1960 1960
 
@@ -1972,60 +1972,60 @@  discard block
 block discarded – undo
1972 1972
  */
1973 1973
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1974 1974
 {
1975
-    global $wpdb;
1976
-    if (!$rebuild) {
1977
-        $terms_icons = get_option('gd_term_icons');
1978
-    } else {
1979
-        $terms_icons = '';
1980
-    }
1981
-
1982
-    if (empty($terms_icons)) {
1983
-        $default_icon_url = get_option('geodir_default_marker_icon');
1984
-        $taxonomy = geodir_get_taxonomies();
1985
-        $post_types = geodir_get_posttypes();
1986
-        $tax_arr = array();
1987
-        foreach ($post_types as $post_type) {
1988
-            $tax_arr[] = "'" . $post_type . "category'";
1989
-        }
1990
-        $tax_c = implode(',', $tax_arr);
1991
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1992
-        //$terms = get_terms( $taxonomy );
1993
-
1994
-        if($terms) {
1995
-            foreach ($terms as $term) {
1996
-                $post_type = str_replace("category", "", $term->taxonomy);
1997
-                $a_terms[$post_type][] = $term;
1975
+	global $wpdb;
1976
+	if (!$rebuild) {
1977
+		$terms_icons = get_option('gd_term_icons');
1978
+	} else {
1979
+		$terms_icons = '';
1980
+	}
1998 1981
 
1999
-            }
2000
-        }
1982
+	if (empty($terms_icons)) {
1983
+		$default_icon_url = get_option('geodir_default_marker_icon');
1984
+		$taxonomy = geodir_get_taxonomies();
1985
+		$post_types = geodir_get_posttypes();
1986
+		$tax_arr = array();
1987
+		foreach ($post_types as $post_type) {
1988
+			$tax_arr[] = "'" . $post_type . "category'";
1989
+		}
1990
+		$tax_c = implode(',', $tax_arr);
1991
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1992
+		//$terms = get_terms( $taxonomy );
2001 1993
 
2002
-        if($a_terms) {
2003
-            foreach ($a_terms as $pt => $t2) {
1994
+		if($terms) {
1995
+			foreach ($terms as $term) {
1996
+				$post_type = str_replace("category", "", $term->taxonomy);
1997
+				$a_terms[$post_type][] = $term;
2004 1998
 
2005
-                foreach ($t2 as $term) {
2006
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2007
-                    if ($term_icon) {
2008
-                        $term_icon_url = $term_icon["src"];
2009
-                    } else {
2010
-                        $term_icon_url = $default_icon_url;
2011
-                    }
2012
-                    $terms_icons[$term->term_id] = $term_icon_url;
2013
-                }
2014
-            }
2015
-        }
1999
+			}
2000
+		}
2001
+
2002
+		if($a_terms) {
2003
+			foreach ($a_terms as $pt => $t2) {
2004
+
2005
+				foreach ($t2 as $term) {
2006
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2007
+					if ($term_icon) {
2008
+						$term_icon_url = $term_icon["src"];
2009
+					} else {
2010
+						$term_icon_url = $default_icon_url;
2011
+					}
2012
+					$terms_icons[$term->term_id] = $term_icon_url;
2013
+				}
2014
+			}
2015
+		}
2016 2016
 
2017
-        update_option('gd_term_icons', $terms_icons);
2018
-    }
2017
+		update_option('gd_term_icons', $terms_icons);
2018
+	}
2019 2019
 
2020
-    if ($term_id && isset($terms_icons[$term_id])) {
2021
-        return $terms_icons[$term_id];
2022
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
2023
-        return get_option('geodir_default_marker_icon');
2024
-    }
2020
+	if ($term_id && isset($terms_icons[$term_id])) {
2021
+		return $terms_icons[$term_id];
2022
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
2023
+		return get_option('geodir_default_marker_icon');
2024
+	}
2025 2025
 
2026
-    if (is_ssl()) {
2027
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2028
-    }
2026
+	if (is_ssl()) {
2027
+		$terms_icons = str_replace("http:","https:",$terms_icons );
2028
+	}
2029 2029
 
2030
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2030
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2031 2031
 }
2032 2032
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
                              * @since 1.0.0
61 61
                              * @param string $menu_class The menu HTML class.
62 62
                              */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
63
+                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
64 64
                             /**
65 65
                              * Filter the menu a class.
66 66
                              *
67 67
                              * @since 1.0.0
68 68
                              */
69 69
                             $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
71
-									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72
-										' . __(ucfirst($args->labels->name),'geodirectory') . '
70
+                            $items .= '<li class="'.$li_class.'">
71
+									<a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'">
72
+										' . __(ucfirst($args->labels->name), 'geodirectory').'
73 73
 									</a>
74 74
 								</li>';
75 75
                         }
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
              * @since 1.0.0
89 89
              * @param string $menu_class The menu HTML class.
90 90
              */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
91
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class);
92 92
             /**
93 93
              * Filter the sub menu li class.
94 94
              *
95 95
              * @since 1.0.0
96 96
              * @param string $menu_class The menu HTML class.
97 97
              */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
98
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
99 99
             /**
100 100
              * Filter the sub menu ul class.
101 101
              *
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
              * @since 1.0.0
115 115
              */
116 116
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
118
-					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119
-					<ul class="' . $sub_ul_class . '">';
117
+            $items .= '<li class="'.$li_class.'">
118
+					<a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a>
119
+					<ul class="' . $sub_ul_class.'">';
120 120
             $post_types = geodir_get_posttypes('object');
121 121
 
122 122
             $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
                                 if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134 134
                                     $menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
137
-														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138
-															' . __(ucfirst($args->labels->name),'geodirectory') . '
136
+                                $items .= '<li class="'.$sub_li_class.'">
137
+														<a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'">
138
+															' . __(ucfirst($args->labels->name), 'geodirectory').'
139 139
 														</a>
140 140
 													</li>';
141 141
                             }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
              *
152 152
              * @since 1.5.9
153 153
              */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
154
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
155 155
             $items .= '</li>';
156 156
         }
157 157
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                                      * @since 1.0.0
185 185
                                      * @param string $menu_class The menu HTML class.
186 186
                                      */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
187
+                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
188 188
                                     /**
189 189
                                      * Filter the menu a class.
190 190
                                      *
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
                                      */
193 193
                                     $a_class = apply_filters('geodir_menu_a_class', '');
194 194
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
196
-											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
195
+                                    $items .= '<li class="'.$li_class.'">
196
+											<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'">
197
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
198 198
 											</a>
199 199
 										</li>';
200 200
                                 }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
              * @since 1.0.0
219 219
              * @param string $menu_class The menu HTML class.
220 220
              */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
221
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class);
222 222
             /**
223 223
              * Filter the sub menu li class.
224 224
              *
225 225
              * @since 1.0.0
226 226
              * @param string $menu_class The menu HTML class.
227 227
              */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
228
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
229 229
             /**
230 230
              * Filter the sub menu ul class.
231 231
              *
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
              * @since 1.0.0
245 245
              */
246 246
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
248
-					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249
-					<ul class="' . $sub_ul_class . '">';
247
+            $items .= '<li  class="'.$li_class.'">
248
+					<a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a>
249
+					<ul class="' . $sub_ul_class.'">';
250 250
 
251 251
             $post_types = geodir_get_posttypes('object');
252 252
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
                                          * @since 1.0.0
270 270
                                          * @param string $menu_class The menu HTML class.
271 271
                                          */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
272
+                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
273 273
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
275
-														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
274
+                                        $items .= '<li class="'.$li_class.'">
275
+														<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'">
276
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
277 277
 														</a>
278 278
 													</li>';
279 279
                                     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             }
286 286
 
287 287
             $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
288
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
289 289
             $items .= '</li>';
290 290
 
291 291
         }
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
     $geodir_theme_location = get_option('geodir_theme_location_nav');
314 314
     $geodir_theme_location_nav = array();
315 315
     if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
316
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
317 317
         $geodir_theme_location_nav[] = $args['theme_location'];
318 318
         update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319 319
     }
320 320
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322 322
     else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
323
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
324 324
 
325 325
     return $menu;
326 326
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
     if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
351
+        $items = $items.geodir_add_nav_menu_items();
352 352
         return $items;
353 353
 
354 354
     } else {
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
 
374 374
     $taxonomies = geodir_get_taxonomies();
375 375
     $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
376
+    $taxonomies = "'".$taxonomies."'";
377 377
 
378 378
     $pn_categories = $wpdb->get_results(
379 379
         $wpdb->prepare(
380 380
             "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
381
+            array($wpdb->terms.term_id)
382 382
         )
383 383
     );
384 384
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409 409
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
411 411
         elseif (isset($_REQUEST['listing_type']))
412 412
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413 413
     }
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
     if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426 426
         $geodir_post_type = '';
427 427
 
428
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
428
+    if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) {
429 429
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430 430
     }
431 431
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      *
436 436
      * @since 1.6.9
437 437
      */
438
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
438
+    return apply_filters('geodir_get_current_posttype', $geodir_post_type);
439 439
 }
440 440
 
441 441
 /**
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
  */
450 450
 function geodir_get_default_posttype()
451 451
 {
452
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
452
+    $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object'));
453 453
 
454
-    foreach ( $post_types as $post_type => $info ) {
454
+    foreach ($post_types as $post_type => $info) {
455 455
         global $wpdb;
456
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
457
-        if ( $has_posts ) {
456
+        $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
457
+        if ($has_posts) {
458 458
             $stype = $post_type; break;
459 459
         }
460 460
     }
461 461
 
462
-    if(!$stype){
462
+    if (!$stype) {
463 463
         $stype = 'gd_place';
464 464
     }
465 465
 
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
         switch ($output):
485 485
             case 'object':
486 486
             case 'Object':
487
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
487
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
488 488
                 break;
489 489
             case 'array':
490 490
             case 'Array':
491
-                $post_types = (array)$post_types;
491
+                $post_types = (array) $post_types;
492 492
                 break;
493 493
 			case 'options':
494
-                $post_types = (array)$post_types;
494
+                $post_types = (array) $post_types;
495 495
 				
496 496
 				$options = array();
497 497
 				if (!empty($post_types)) {
@@ -609,15 +609,15 @@  discard block
 block discarded – undo
609 609
 
610 610
         $categories = get_terms($taxonomies);
611 611
 
612
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
612
+        $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
613 613
 
614 614
         foreach ($categories as $category_obj) {
615 615
             $select_opt = '';
616 616
             if ($selected == $category_obj->term_id) {
617 617
                 $select_opt = 'selected="selected"';
618 618
             }
619
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
620
-                . ucfirst($category_obj->name) . '</option>';
619
+            $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">'
620
+                . ucfirst($category_obj->name).'</option>';
621 621
         }
622 622
 
623 623
         if ($echo)
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
     } elseif (isset($wp_query->tax_query->queries)) {
686 686
         $tax_arr = $wp_query->tax_query->queries;
687 687
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
688
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
688
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
689 689
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
690 690
     }
691 691
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 
740 740
             if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
741 741
                 if ($cat_parent == 0) {
742
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
742
+                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display;
743 743
                     $main_list_class = 'class="main_list_selecter"';
744 744
                 } else {
745 745
                     //$display = 'display:none';
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 
750 750
             if ($cat_display == 'checkbox' || $cat_display == 'radio') {
751 751
                 $p = 0;
752
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
752
+                $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">';
753 753
             }
754 754
 
755 755
             foreach ($cat_terms as $cat_term) {
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
                 }
765 765
 
766 766
                 if ($cat_display == 'radio')
767
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
767
+                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
768 768
                 elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
769
+                    $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.ucfirst($cat_term->name).'</option>';
770 770
 
771 771
                 else {
772
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
772
+                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
773 773
                 }
774 774
 
775 775
                 // Call recurson to print sub cats
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
             $cat_exclude = serialize($exclude_cats);
809 809
 
810 810
         if (isset($_REQUEST['backandedit'])) {
811
-            $post = (object)$gd_session->get('listing');
811
+            $post = (object) $gd_session->get('listing');
812 812
 
813 813
             if (!is_array($post->post_category[$cat_taxonomy]))
814 814
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 
841 841
             if (!empty($post_category)) {
842 842
                 $cat1 = array_filter(explode(',', $post_category));
843
-                $post_category = ',' . implode(',', $cat1) . ',';
843
+                $post_category = ','.implode(',', $cat1).',';
844 844
 
845 845
             }
846 846
 
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
                 foreach ($post_category_upd as $cat) {
852 852
 
853 853
                     if (!in_array($cat, $exclude_cats) && $cat != '') {
854
-                        $post_category_change .= ',' . $cat;
854
+                        $post_category_change .= ','.$cat;
855 855
                     }
856 856
                 }
857 857
                 $post_category = $post_category_change;
@@ -863,11 +863,11 @@  discard block
 block discarded – undo
863 863
             }
864 864
         }
865 865
 
866
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
866
+        echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']"  />';
867 867
 
868
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
868
+        echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']"  />';
869 869
 
870
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
870
+        echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']"  />';
871 871
 
872 872
 
873 873
         ?>
@@ -886,14 +886,14 @@  discard block
 block discarded – undo
886 886
 
887 887
             function show_subcatlist(main_cat, catObj) {
888 888
                 if (main_cat != '') {
889
-					var url = '<?php echo geodir_get_ajax_url();?>';
890
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
891
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
889
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
890
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
891
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
892 892
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
893
-					<?php if ((int)$cat_limit > 0) { ?>
893
+					<?php if ((int) $cat_limit > 0) { ?>
894 894
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
895 895
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
896
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
896
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
897 897
 						return false;
898 898
 					}
899 899
 					<?php } ?>
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
             }
933 933
 
934 934
             function update_listing_cat(el) {
935
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
935
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
936 936
                 var cat_ids = '';
937 937
                 var main_cat = '';
938 938
                 var sub_cat = '';
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1014 1014
             echo $style;
1015 1015
         }?> ">
1016
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1016
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
1017 1017
             ?>
1018 1018
         </div>
1019 1019
     <?php
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
     if ($exclude != '') {
1041 1041
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
1042 1042
 
1043
-        if(is_array( $exclude_cats)){
1044
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1045
-        }else{
1043
+        if (is_array($exclude_cats)) {
1044
+            $exclude_cats = array_map('intval', $exclude_cats);
1045
+        } else {
1046 1046
             $exclude_cats = intval($exclude_cats);
1047 1047
         }
1048 1048
 
@@ -1056,25 +1056,25 @@  discard block
 block discarded – undo
1056 1056
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1057 1057
 
1058 1058
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1059
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1059
+            <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>"
1060 1060
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1061 1061
             <?php /* ?>
1062 1062
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1063 1063
 		<?php */ ?>
1064 1064
 
1065
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1065
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1066 1066
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1067 1067
                    checked="checked" disabled="disabled"/>
1068 1068
        <span> 
1069
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1069
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1070 1070
         </span>
1071 1071
             <br/>
1072 1072
 
1073 1073
             <div class="post_default_category">
1074
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1075
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1074
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1075
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1076 1076
         <span> 
1077
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1077
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1078 1078
         </span>
1079 1079
             </div>
1080 1080
 
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
         $post_cat_str = $post_categories[$request_taxonomy];
1108 1108
         $post_cat_array = explode("#", $post_cat_str);
1109 1109
         if (is_array($post_cat_array)) {
1110
-            $post_cat_array = array_unique( $post_cat_array );
1110
+            $post_cat_array = array_unique($post_cat_array);
1111 1111
 
1112 1112
 			foreach ($post_cat_array as $post_cat_html) {
1113 1113
 
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
                 }
1123 1123
                 $post_sub_catid = '';
1124 1124
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1125
-                    $post_sub_catid = (int)$post_cat_info[1];
1125
+                    $post_sub_catid = (int) $post_cat_info[1];
1126 1126
                 }
1127 1127
 
1128 1128
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
             }
1144 1144
 
1145 1145
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1146
-                $post_sub_catid = (int)$post_cat_info[1];
1146
+                $post_sub_catid = (int) $post_cat_info[1];
1147 1147
             }
1148 1148
 
1149 1149
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1175,9 +1175,9 @@  discard block
 block discarded – undo
1175 1175
         if (!$selected)
1176 1176
             $option_slected = ' selected="selected" ';
1177 1177
 
1178
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1178
+        echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >';
1179 1179
 
1180
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1180
+        echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
1181 1181
 
1182 1182
         foreach ($cat_terms as $cat_term) {
1183 1183
             $option_selected = '';
@@ -1185,10 +1185,10 @@  discard block
 block discarded – undo
1185 1185
                 $option_selected = ' selected="selected" ';
1186 1186
 
1187 1187
             // Count child terms
1188
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1189
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1188
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1189
+            $has_child = !empty($child_terms) ? 't' : 'f';
1190 1190
 
1191
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1191
+            echo '<option  '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.ucfirst($cat_term->name).'</option>';
1192 1192
         }
1193 1193
         echo '</select>';
1194 1194
     }
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
             2 => __('Custom field updated.', 'geodirectory'),
1220 1220
             3 => __('Custom field deleted.', 'geodirectory'),
1221 1221
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1222
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1222
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1223 1223
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1224 1224
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1225 1225
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 
1246 1246
     global $wpdb;
1247 1247
 
1248
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1248
+    $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico';
1249 1249
 
1250 1250
     if (!$listing_slug = get_option('geodir_listing_prefix'))
1251 1251
         $listing_slug = 'places';
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 
1259 1259
         $gd_placetags = array();
1260 1260
         $gd_placetags['object_type'] = 'gd_place';
1261
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1261
+        $gd_placetags['listing_slug'] = $listing_slug.'/tags';
1262 1262
         $gd_placetags['args'] = array(
1263 1263
             'public' => true,
1264 1264
             'hierarchical' => false,
1265
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1265
+            'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
1266 1266
             'query_var' => true,
1267 1267
 
1268 1268
             'labels' => array(
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
             'menu_icon' => $menu_icon,
1357 1357
             'public' => true,
1358 1358
             'query_var' => true,
1359
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1359
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1360 1360
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1361 1361
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1362 1362
 
@@ -1378,27 +1378,27 @@  discard block
 block discarded – undo
1378 1378
 }
1379 1379
 
1380 1380
 $gd_wpml_get_languages = "";
1381
-function gd_wpml_get_lang_from_url($url){
1381
+function gd_wpml_get_lang_from_url($url) {
1382 1382
 
1383 1383
     global $gd_wpml_get_languages;
1384
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1384
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1385 1385
 
1386 1386
 
1387 1387
     //
1388
-    $url = str_replace(array("http://","https://"),"",$url);
1388
+    $url = str_replace(array("http://", "https://"), "", $url);
1389 1389
 
1390 1390
     // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1391
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1391
+    $site_url = str_replace(array("http://", "https://"), "", site_url());
1392 1392
 
1393
-    $url = str_replace($site_url,"",$url);
1393
+    $url = str_replace($site_url, "", $url);
1394 1394
 
1395 1395
 
1396 1396
     $segments = explode('/', trim($url, '/'));
1397 1397
 
1398 1398
     //print_r( $segments);
1399
-    if($gd_wpml_get_languages){
1399
+    if ($gd_wpml_get_languages) {
1400 1400
         $langs = $gd_wpml_get_languages;
1401
-    }else{
1401
+    } else {
1402 1402
         global $sitepress;
1403 1403
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1404 1404
     }
@@ -1463,17 +1463,17 @@  discard block
 block discarded – undo
1463 1463
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1464 1464
 
1465 1465
         // Alter the CPT slug if WPML is set to do so
1466
-        if(function_exists('icl_object_id')){
1467
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1466
+        if (function_exists('icl_object_id')) {
1467
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1468 1468
 
1469 1469
                 $org_slug = $slug;
1470
-                $slug = apply_filters( 'wpml_translate_single_string',
1470
+                $slug = apply_filters('wpml_translate_single_string',
1471 1471
                     $slug,
1472 1472
                     'WordPress',
1473
-                    'URL slug: ' . $slug,
1473
+                    'URL slug: '.$slug,
1474 1474
                     $language_code);
1475 1475
 
1476
-                if(!$slug){$slug = $org_slug;}
1476
+                if (!$slug) {$slug = $org_slug; }
1477 1477
 
1478 1478
             }
1479 1479
         }
@@ -1495,11 +1495,11 @@  discard block
 block discarded – undo
1495 1495
         }
1496 1496
 
1497 1497
         $post_link = trailingslashit(
1498
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1498
+            preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
1499 1499
         );
1500 1500
 
1501 1501
         if ($fix_url) {
1502
-            $post_link = $site_url . $post_link;
1502
+            $post_link = $site_url.$post_link;
1503 1503
         }
1504 1504
 
1505 1505
         if (isset($comment_post_cache[$post->ID])) {
@@ -1518,12 +1518,12 @@  discard block
 block discarded – undo
1518 1518
             $ID = $post->ID;
1519 1519
             $post2 = $wpdb->get_row(
1520 1520
                 $wpdb->prepare(
1521
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1521
+                    "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1522 1522
                     array($post->ID)
1523 1523
                 )
1524 1524
             );
1525 1525
 
1526
-            $post = (object)array_merge((array)$post, (array)$post2);
1526
+            $post = (object) array_merge((array) $post, (array) $post2);
1527 1527
 
1528 1528
             $comment_post_cache[$post->ID] = $post;
1529 1529
         }
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1534 1534
 
1535
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1535
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1536 1536
                 $location_request = '';
1537 1537
 
1538 1538
 
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1547 1547
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1548 1548
 
1549
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1549
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1550 1550
                             'region_slug' => $post->region_slug,
1551 1551
                             'city_slug' => $post->city_slug
1552 1552
                         );
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 
1560 1560
                     $post_location_sql = $wpdb->get_results(
1561 1561
                         $wpdb->prepare(
1562
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1562
+                            "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1563 1563
                             array($post->ID)
1564 1564
                         )
1565 1565
                     );
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1576 1576
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1577 1577
 
1578
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1578
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1579 1579
                                 'region_slug' => $post->region_slug,
1580 1580
                                 'city_slug' => $post->city_slug
1581 1581
                             );
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
 					}
1605 1605
 					$location_slug[] = $city_slug;
1606 1606
 					
1607
-					$location_request .= implode('/', $location_slug) . '/';
1607
+					$location_request .= implode('/', $location_slug).'/';
1608 1608
                 }
1609 1609
             }
1610 1610
 
@@ -1662,9 +1662,9 @@  discard block
 block discarded – undo
1662 1662
             }
1663 1663
             $request_term = trim($request_term, '/');
1664 1664
             if (!empty($request_term))
1665
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1665
+                $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1666 1666
             else
1667
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1667
+                $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1668 1668
             //echo $post_link ;
1669 1669
         }
1670 1670
         // temp cache the permalink
@@ -1739,9 +1739,9 @@  discard block
 block discarded – undo
1739 1739
                 $url_separator = '';
1740 1740
 
1741 1741
                 if (get_option('permalink_structure') != '') {
1742
-                    $old_listing_slug = '/' . $listing_slug . '/';
1742
+                    $old_listing_slug = '/'.$listing_slug.'/';
1743 1743
                     $request_term = implode("/", $location_terms);
1744
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1744
+                    $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/';
1745 1745
 
1746 1746
                     $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1747 1747
                 } else {
@@ -1761,25 +1761,25 @@  discard block
 block discarded – undo
1761 1761
         // Alter the CPT slug if WPML is set to do so
1762 1762
         if (function_exists('icl_object_id')) {
1763 1763
             $post_types = get_option('geodir_post_types');
1764
-            $post_type = str_replace("category","",$taxonomy);
1765
-            $post_type = str_replace("_tags","",$post_type);
1764
+            $post_type = str_replace("category", "", $taxonomy);
1765
+            $post_type = str_replace("_tags", "", $post_type);
1766 1766
             $slug = $post_types[$post_type]['rewrite']['slug'];
1767 1767
             if (gd_wpml_slug_translation_turned_on($post_type)) {
1768 1768
                 global $sitepress;
1769 1769
                 $default_lang = $sitepress->get_default_language();
1770 1770
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1771
-                if (!$language_code ) {
1772
-                    $language_code  = $default_lang;
1771
+                if (!$language_code) {
1772
+                    $language_code = $default_lang;
1773 1773
                 }
1774 1774
 
1775 1775
                 $org_slug = $slug;
1776
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1776
+                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code);
1777 1777
 
1778 1778
                 if (!$slug) {
1779 1779
                     $slug = $org_slug;
1780 1780
                 }
1781 1781
 
1782
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1782
+                $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1));
1783 1783
             }
1784 1784
         }
1785 1785
     }
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 	
1810 1810
 	if (in_array($post_type, geodir_get_posttypes())) {
1811 1811
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1812
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1812
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1813 1813
                 $location_terms = array(
1814 1814
                     'gd_country' => $post->country_slug,
1815 1815
                     'gd_region' => $post->region_slug,
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 					$location_terms = implode("/", $location_terms);
1827 1827
 					$location_terms = rtrim($location_terms, '/');
1828 1828
 					
1829
-					$link .= urldecode($location_terms) . '/';
1829
+					$link .= urldecode($location_terms).'/';
1830 1830
 				} else {
1831 1831
 					$link = geodir_getlink($link, $location_terms);
1832 1832
 				}
@@ -1908,9 +1908,9 @@  discard block
 block discarded – undo
1908 1908
             return 0;
1909 1909
         $where = 't.term_id = %d';
1910 1910
         if (!empty($taxonomy))
1911
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1911
+            return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912 1912
         else
1913
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1913
+            return $wpdb->get_var($wpdb->prepare($select.$where, $term));
1914 1914
     }
1915 1915
 
1916 1916
     $term = trim(wp_unslash($term));
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
 
1923 1923
     $where_fields = array($slug);
1924 1924
     if (!empty($taxonomy)) {
1925
-        $parent = (int)$parent;
1925
+        $parent = (int) $parent;
1926 1926
         if ($parent > 0) {
1927 1927
             $where_fields[] = $parent;
1928 1928
             $else_where_fields[] = $parent;
@@ -1985,13 +1985,13 @@  discard block
 block discarded – undo
1985 1985
         $post_types = geodir_get_posttypes();
1986 1986
         $tax_arr = array();
1987 1987
         foreach ($post_types as $post_type) {
1988
-            $tax_arr[] = "'" . $post_type . "category'";
1988
+            $tax_arr[] = "'".$post_type."category'";
1989 1989
         }
1990 1990
         $tax_c = implode(',', $tax_arr);
1991 1991
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1992 1992
         //$terms = get_terms( $taxonomy );
1993 1993
 
1994
-        if($terms) {
1994
+        if ($terms) {
1995 1995
             foreach ($terms as $term) {
1996 1996
                 $post_type = str_replace("category", "", $term->taxonomy);
1997 1997
                 $a_terms[$post_type][] = $term;
@@ -1999,7 +1999,7 @@  discard block
 block discarded – undo
1999 1999
             }
2000 2000
         }
2001 2001
 
2002
-        if($a_terms) {
2002
+        if ($a_terms) {
2003 2003
             foreach ($a_terms as $pt => $t2) {
2004 2004
 
2005 2005
                 foreach ($t2 as $term) {
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
     }
2025 2025
 
2026 2026
     if (is_ssl()) {
2027
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2027
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
2028 2028
     }
2029 2029
 
2030 2030
     return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
Please login to merge, or discard this patch.
Braces   +167 added lines, -119 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -159,8 +162,9 @@  discard block
 block discarded – undo
159 162
     if (get_option('geodir_show_addlisting_nav')) {
160 163
 
161 164
         $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
165
+        if (geodir_is_page('add-listing')) {
166
+                    $menu_class = 'current-menu-item';
167
+        }
164 168
 
165 169
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166 170
         $post_types = geodir_get_posttypes('object');
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
                                 if (geodir_get_addlisting_link($post_type)) {
177 181
 
178 182
                                     $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
183
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
184
+                                                                            $menu_class = 'current-menu-item';
185
+                                    }
181 186
                                     /**
182 187
                                      * Filter the menu li class.
183 188
                                      *
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
                                     if (geodir_get_addlisting_link($post_type)) {
262 267
 
263 268
                                         $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
269
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
270
+                                                                                    $menu_class = 'current-menu-item';
271
+                                        }
266 272
                                         /**
267 273
                                          * Filter the menu li class.
268 274
                                          *
@@ -319,8 +325,9 @@  discard block
 block discarded – undo
319 325
     }
320 326
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 327
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
328
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
329
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
330
+    }
324 331
 
325 332
     return $menu;
326 333
 
@@ -406,24 +413,28 @@  discard block
 block discarded – undo
406 413
     $geodir_post_type = get_query_var('post_type');
407 414
 
408 415
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
416
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
417
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
418
+        } elseif (isset($_REQUEST['listing_type'])) {
419
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
420
+        }
413 421
     }
414 422
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
423
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
424
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
425
+    }
417 426
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
427
+    if (is_tax()) {
428
+            $geodir_post_type = geodir_get_taxonomy_posttype();
429
+    }
420 430
 
421 431
 
422 432
     $all_postypes = geodir_get_posttypes();
423 433
     $all_postypes = stripslashes_deep($all_postypes);
424 434
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
435
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
436
+            $geodir_post_type = '';
437
+    }
427 438
 
428 439
     if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429 440
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
@@ -507,11 +518,12 @@  discard block
 block discarded – undo
507 518
         endswitch;
508 519
     }
509 520
 
510
-    if (!empty($post_types))
511
-        return $post_types;
512
-    else
513
-        return array();
514
-}
521
+    if (!empty($post_types)) {
522
+            return $post_types;
523
+    } else {
524
+            return array();
525
+    }
526
+    }
515 527
 
516 528
 /**
517 529
  * Get Custom Post Type info.
@@ -528,9 +540,10 @@  discard block
 block discarded – undo
528 540
     $post_types = stripslashes_deep($post_types);
529 541
     if (!empty($post_types) && $post_type != '') {
530 542
         return $post_types[$post_type];
531
-    } else
532
-        return false;
533
-}
543
+    } else {
544
+            return false;
545
+    }
546
+    }
534 547
 
535 548
 if (!function_exists('geodir_get_taxonomies')) {
536 549
     /**
@@ -554,18 +567,21 @@  discard block
 block discarded – undo
554 567
             $gd_taxonomies = array_keys($taxonomies);
555 568
 
556 569
 
557
-            if ($post_type != '')
558
-                $gd_taxonomies = array();
570
+            if ($post_type != '') {
571
+                            $gd_taxonomies = array();
572
+            }
559 573
 
560 574
             $i = 0;
561 575
             foreach ($taxonomies as $taxonomy => $args) {
562 576
 
563
-                if ($post_type != '' && $args['object_type'] == $post_type)
564
-                    $gd_taxonomies[] = $taxonomy;
577
+                if ($post_type != '' && $args['object_type'] == $post_type) {
578
+                                    $gd_taxonomies[] = $taxonomy;
579
+                }
565 580
 
566 581
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
567
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
568
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
582
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
583
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
584
+                    }
569 585
                 }
570 586
 
571 587
             }
@@ -620,10 +636,11 @@  discard block
 block discarded – undo
620 636
                 . ucfirst($category_obj->name) . '</option>';
621 637
         }
622 638
 
623
-        if ($echo)
624
-            echo $html;
625
-        else
626
-            return $html;
639
+        if ($echo) {
640
+                    echo $html;
641
+        } else {
642
+                    return $html;
643
+        }
627 644
     }
628 645
 }
629 646
 
@@ -657,11 +674,12 @@  discard block
 block discarded – undo
657 674
 
658 675
     }
659 676
 
660
-    if (!empty($listing_slug))
661
-        return $listing_slug;
662
-    else
663
-        return false;
664
-}
677
+    if (!empty($listing_slug)) {
678
+            return $listing_slug;
679
+    } else {
680
+            return false;
681
+    }
682
+    }
665 683
 
666 684
 
667 685
 /**
@@ -692,16 +710,18 @@  discard block
 block discarded – undo
692 710
     if (!empty($taxonomies)) {
693 711
         foreach (geodir_get_posttypes() as $pt) {
694 712
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
695
-            if (array_intersect($taxonomies, $object_taxonomies))
696
-                $post_type[] = $pt;
713
+            if (array_intersect($taxonomies, $object_taxonomies)) {
714
+                            $post_type[] = $pt;
715
+            }
697 716
         }
698 717
     }
699 718
 
700
-    if (!empty($post_type))
701
-        return $post_type[0];
702
-    else
703
-        return false;
704
-}
719
+    if (!empty($post_type)) {
720
+            return $post_type[0];
721
+    } else {
722
+            return false;
723
+    }
724
+    }
705 725
 
706 726
 if (!function_exists('geodir_custom_taxonomy_walker')) {
707 727
     /**
@@ -757,18 +777,18 @@  discard block
 block discarded – undo
757 777
                 $checked = '';
758 778
 
759 779
                 if (in_array($cat_term->term_id, $search_terms)) {
760
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
761
-                        $checked = 'selected="selected"';
762
-                    else
763
-                        $checked = 'checked="checked"';
780
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
781
+                                            $checked = 'selected="selected"';
782
+                    } else {
783
+                                            $checked = 'checked="checked"';
784
+                    }
764 785
                 }
765 786
 
766
-                if ($cat_display == 'radio')
767
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
768
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
770
-
771
-                else {
787
+                if ($cat_display == 'radio') {
788
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
789
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
790
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
791
+                } else {
772 792
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
773 793
                 }
774 794
 
@@ -777,8 +797,9 @@  discard block
 block discarded – undo
777 797
 
778 798
             }
779 799
 
780
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
781
-                $out .= '</div>';
800
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
801
+                            $out .= '</div>';
802
+            }
782 803
 
783 804
             return $out;
784 805
         }
@@ -804,18 +825,21 @@  discard block
 block discarded – undo
804 825
         global $exclude_cats, $gd_session;
805 826
 
806 827
         $cat_exclude = '';
807
-        if (is_array($exclude_cats) && !empty($exclude_cats))
808
-            $cat_exclude = serialize($exclude_cats);
828
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
829
+                    $cat_exclude = serialize($exclude_cats);
830
+        }
809 831
 
810 832
         if (isset($_REQUEST['backandedit'])) {
811 833
             $post = (object)$gd_session->get('listing');
812 834
 
813
-            if (!is_array($post->post_category[$cat_taxonomy]))
814
-                $post_category = $post->post_category[$cat_taxonomy];
835
+            if (!is_array($post->post_category[$cat_taxonomy])) {
836
+                            $post_category = $post->post_category[$cat_taxonomy];
837
+            }
815 838
 
816 839
             $post_categories = $post->post_category_str;
817
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
818
-                $post_category_str = $post_categories[$cat_taxonomy];
840
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
841
+                            $post_category_str = $post_categories[$cat_taxonomy];
842
+            }
819 843
 
820 844
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
821 845
             global $post;
@@ -1006,8 +1030,9 @@  discard block
 block discarded – undo
1006 1030
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1007 1031
             $post_cat_str = $post_categories[$cat_taxonomy];
1008 1032
             $post_cat_array = explode("#", $post_cat_str);
1009
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1010
-                $style = "display:none;";
1033
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
1034
+                            $style = "display:none;";
1035
+            }
1011 1036
         }
1012 1037
         ?>
1013 1038
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -1042,7 +1067,7 @@  discard block
 block discarded – undo
1042 1067
 
1043 1068
         if(is_array( $exclude_cats)){
1044 1069
             $exclude_cats = array_map( 'intval', $exclude_cats );
1045
-        }else{
1070
+        } else{
1046 1071
             $exclude_cats = intval($exclude_cats);
1047 1072
         }
1048 1073
 
@@ -1072,7 +1097,10 @@  discard block
 block discarded – undo
1072 1097
 
1073 1098
             <div class="post_default_category">
1074 1099
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1075
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1100
+                       onchange="update_listing_cat()" <?php if ($default) {
1101
+	echo ' checked="checked" ';
1102
+}
1103
+?>   />
1076 1104
         <span> 
1077 1105
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1078 1106
         </span>
@@ -1172,8 +1200,9 @@  discard block
 block discarded – undo
1172 1200
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1173 1201
 
1174 1202
         $option_selected = '';
1175
-        if (!$selected)
1176
-            $option_slected = ' selected="selected" ';
1203
+        if (!$selected) {
1204
+                    $option_slected = ' selected="selected" ';
1205
+        }
1177 1206
 
1178 1207
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1179 1208
 
@@ -1181,8 +1210,9 @@  discard block
 block discarded – undo
1181 1210
 
1182 1211
         foreach ($cat_terms as $cat_term) {
1183 1212
             $option_selected = '';
1184
-            if ($selected == $cat_term->term_id)
1185
-                $option_selected = ' selected="selected" ';
1213
+            if ($selected == $cat_term->term_id) {
1214
+                            $option_selected = ' selected="selected" ';
1215
+            }
1186 1216
 
1187 1217
             // Count child terms
1188 1218
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1247,8 +1277,9 @@  discard block
 block discarded – undo
1247 1277
 
1248 1278
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1249 1279
 
1250
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1251
-        $listing_slug = 'places';
1280
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1281
+            $listing_slug = 'places';
1282
+    }
1252 1283
 
1253 1284
     /**
1254 1285
      * Taxonomies
@@ -1398,7 +1429,7 @@  discard block
 block discarded – undo
1398 1429
     //print_r( $segments);
1399 1430
     if($gd_wpml_get_languages){
1400 1431
         $langs = $gd_wpml_get_languages;
1401
-    }else{
1432
+    } else{
1402 1433
         global $sitepress;
1403 1434
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1404 1435
     }
@@ -1551,8 +1582,9 @@  discard block
 block discarded – undo
1551 1582
                             'city_slug' => $post->city_slug
1552 1583
                         );
1553 1584
 
1554
-                    } else
1555
-                        $post_location = geodir_get_location();
1585
+                    } else {
1586
+                                            $post_location = geodir_get_location();
1587
+                    }
1556 1588
 
1557 1589
 
1558 1590
                 } else {
@@ -1581,8 +1613,9 @@  discard block
 block discarded – undo
1581 1613
                             );
1582 1614
 
1583 1615
                         }
1584
-                    } else
1585
-                        $post_location = geodir_get_location();
1616
+                    } else {
1617
+                                            $post_location = geodir_get_location();
1618
+                    }
1586 1619
                 }
1587 1620
 
1588 1621
 
@@ -1625,8 +1658,9 @@  discard block
 block discarded – undo
1625 1658
                         $post_terms = $post_terms[0];
1626 1659
                     }
1627 1660
 
1628
-                    if (!$post_terms)
1629
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1661
+                    if (!$post_terms) {
1662
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1663
+                    }
1630 1664
 
1631 1665
                     if (!$post_terms) {
1632 1666
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1640,8 +1674,9 @@  discard block
 block discarded – undo
1640 1674
 
1641 1675
                 $term = get_term_by('id', $post_terms, $taxonomies);
1642 1676
 
1643
-                if (!empty($term))
1644
-                    $term_request = $term->slug;
1677
+                if (!empty($term)) {
1678
+                                    $term_request = $term->slug;
1679
+                }
1645 1680
                 //$term_request = $term->slug.'/';
1646 1681
             }
1647 1682
 
@@ -1656,15 +1691,20 @@  discard block
 block discarded – undo
1656 1691
                 $request_term .= $term_request;
1657 1692
 
1658 1693
             } else {
1659
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1694
+                if (isset($location_request) && $location_request != '') {
1695
+                	$request_term = $location_request;
1696
+                }
1660 1697
 
1661
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1698
+                if (isset($term_request) && $term_request != '') {
1699
+                	$request_term .= $term_request;
1700
+                }
1662 1701
             }
1663 1702
             $request_term = trim($request_term, '/');
1664
-            if (!empty($request_term))
1665
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1666
-            else
1667
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1703
+            if (!empty($request_term)) {
1704
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1705
+            } else {
1706
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1707
+            }
1668 1708
             //echo $post_link ;
1669 1709
         }
1670 1710
         // temp cache the permalink
@@ -1852,10 +1892,11 @@  discard block
 block discarded – undo
1852 1892
     if (!is_object($obj_post_type)) {
1853 1893
         return;
1854 1894
     }
1855
-    if ($echo)
1856
-        echo $obj_post_type->labels->singular_name;
1857
-    else
1858
-        return $obj_post_type->labels->singular_name;
1895
+    if ($echo) {
1896
+            echo $obj_post_type->labels->singular_name;
1897
+    } else {
1898
+            return $obj_post_type->labels->singular_name;
1899
+    }
1859 1900
 
1860 1901
 }
1861 1902
 
@@ -1872,14 +1913,16 @@  discard block
 block discarded – undo
1872 1913
 {
1873 1914
     $all_postypes = geodir_get_posttypes();
1874 1915
 
1875
-    if (!in_array($post_type, $all_postypes))
1876
-        return false;
1916
+    if (!in_array($post_type, $all_postypes)) {
1917
+            return false;
1918
+    }
1877 1919
 
1878 1920
     $obj_post_type = get_post_type_object($post_type);
1879
-    if ($echo)
1880
-        echo $obj_post_type->labels->name;
1881
-    else
1882
-        return $obj_post_type->labels->name;
1921
+    if ($echo) {
1922
+            echo $obj_post_type->labels->name;
1923
+    } else {
1924
+            return $obj_post_type->labels->name;
1925
+    }
1883 1926
 
1884 1927
 }
1885 1928
 
@@ -1904,19 +1947,22 @@  discard block
 block discarded – undo
1904 1947
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1905 1948
 
1906 1949
     if (is_int($term)) {
1907
-        if (0 == $term)
1908
-            return 0;
1950
+        if (0 == $term) {
1951
+                    return 0;
1952
+        }
1909 1953
         $where = 't.term_id = %d';
1910
-        if (!empty($taxonomy))
1911
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912
-        else
1913
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1954
+        if (!empty($taxonomy)) {
1955
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1956
+        } else {
1957
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1958
+        }
1914 1959
     }
1915 1960
 
1916 1961
     $term = trim(wp_unslash($term));
1917 1962
 
1918
-    if ('' === $slug = sanitize_title($term))
1919
-        return 0;
1963
+    if ('' === $slug = sanitize_title($term)) {
1964
+            return 0;
1965
+    }
1920 1966
 
1921 1967
     $where = 't.slug = %s';
1922 1968
 
@@ -1933,14 +1979,16 @@  discard block
 block discarded – undo
1933 1979
         $where_fields[] = $taxonomy;
1934 1980
 
1935 1981
 
1936
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1937
-            return $result;
1982
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
1983
+                    return $result;
1984
+        }
1938 1985
 
1939 1986
         return false;
1940 1987
     }
1941 1988
 
1942
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1943
-        return $result;
1989
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1990
+            return $result;
1991
+    }
1944 1992
 
1945 1993
     return false;
1946 1994
 }
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_template_tags.php 1 patch
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -67,77 +67,77 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_draw_map($map_args = array())
69 69
 {
70
-    global $map_canvas_arr;
71
-    $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
-    $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
-
74
-    $default_location = geodir_get_default_location();
75
-
76
-    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
-    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
-    $map_default_zoom = 12;
79
-    // map options default values
80
-    $width = 950;
81
-    $height = 450;
82
-    $child_collapse = '0';
83
-    $sticky = '';
84
-    $enable_cat_filters = false;
85
-    $enable_text_search = false;
86
-    $enable_post_type_filters = false;
87
-    $enable_location_filters = false;
88
-    $enable_jason_on_load = false;
89
-    $enable_map_direction = false;
90
-    $enable_marker_cluster = false;
91
-    $enable_map_resize_button = false;
92
-    $maptype = 'ROADMAP';
93
-
94
-    $geodir_map_options = array(
95
-        'width' => $width,
96
-        'height' => $height,
97
-        'child_collapse' => $child_collapse,
98
-        'sticky' => $sticky,
99
-        'enable_map_resize_button' => $enable_map_resize_button,
100
-        'enable_cat_filters' => $enable_cat_filters,
101
-        'enable_text_search' => $enable_text_search,
102
-        'enable_post_type_filters' => $enable_post_type_filters,
103
-        'enable_location_filters' => $enable_location_filters,
104
-        'enable_jason_on_load' => $enable_jason_on_load,
105
-        'enable_map_direction' => $enable_map_direction,
106
-        'enable_marker_cluster' => $enable_marker_cluster,
107
-        'ajax_url' => geodir_get_ajax_url(),
108
-        'map_canvas_name' => $map_canvas_name,
109
-        'inputText' => __('Title or Keyword', 'geodirectory'),
110
-        'latitude' => $map_default_lat,
111
-        'longitude' => $map_default_lng,
112
-        'zoom' => $map_default_zoom,
113
-        'scrollwheel' => true,
114
-        'streetViewControl' => true,
115
-        'maptype' => $maptype,
116
-        'showPreview' => '0',
117
-        'maxZoom' => 21,
118
-        'autozoom' => true,
119
-        'bubble_size' => 'small',
120
-        'token' => '68f48005e256696074e1da9bf9f67f06',
121
-        'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
-    );
123
-
124
-    if (!empty($map_args)) {
125
-        foreach ($map_args as $map_option_key => $map_option_value) {
126
-            $geodir_map_options[$map_option_key] = $map_option_value;
127
-        }
128
-    }
129
-
130
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
-    } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
-    }
134
-
135
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
-    } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
-    }
139
-
140
-    /**
70
+	global $map_canvas_arr;
71
+	$map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
+	$map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
+
74
+	$default_location = geodir_get_default_location();
75
+
76
+	$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
+	$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
+	$map_default_zoom = 12;
79
+	// map options default values
80
+	$width = 950;
81
+	$height = 450;
82
+	$child_collapse = '0';
83
+	$sticky = '';
84
+	$enable_cat_filters = false;
85
+	$enable_text_search = false;
86
+	$enable_post_type_filters = false;
87
+	$enable_location_filters = false;
88
+	$enable_jason_on_load = false;
89
+	$enable_map_direction = false;
90
+	$enable_marker_cluster = false;
91
+	$enable_map_resize_button = false;
92
+	$maptype = 'ROADMAP';
93
+
94
+	$geodir_map_options = array(
95
+		'width' => $width,
96
+		'height' => $height,
97
+		'child_collapse' => $child_collapse,
98
+		'sticky' => $sticky,
99
+		'enable_map_resize_button' => $enable_map_resize_button,
100
+		'enable_cat_filters' => $enable_cat_filters,
101
+		'enable_text_search' => $enable_text_search,
102
+		'enable_post_type_filters' => $enable_post_type_filters,
103
+		'enable_location_filters' => $enable_location_filters,
104
+		'enable_jason_on_load' => $enable_jason_on_load,
105
+		'enable_map_direction' => $enable_map_direction,
106
+		'enable_marker_cluster' => $enable_marker_cluster,
107
+		'ajax_url' => geodir_get_ajax_url(),
108
+		'map_canvas_name' => $map_canvas_name,
109
+		'inputText' => __('Title or Keyword', 'geodirectory'),
110
+		'latitude' => $map_default_lat,
111
+		'longitude' => $map_default_lng,
112
+		'zoom' => $map_default_zoom,
113
+		'scrollwheel' => true,
114
+		'streetViewControl' => true,
115
+		'maptype' => $maptype,
116
+		'showPreview' => '0',
117
+		'maxZoom' => 21,
118
+		'autozoom' => true,
119
+		'bubble_size' => 'small',
120
+		'token' => '68f48005e256696074e1da9bf9f67f06',
121
+		'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
+	);
123
+
124
+	if (!empty($map_args)) {
125
+		foreach ($map_args as $map_option_key => $map_option_value) {
126
+			$geodir_map_options[$map_option_key] = $map_option_value;
127
+		}
128
+	}
129
+
130
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
+	} else {
132
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
+	}
134
+
135
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
+	} else {
137
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
+	}
139
+
140
+	/**
141 141
 	 * Filter the options to use in google map.
142 142
 	 *
143 143
 	 * @since 1.0.0
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
148 148
 
149
-    $map_canvas_arr[$map_canvas_name] = array();
149
+	$map_canvas_arr[$map_canvas_name] = array();
150 150
 
151
-    /**
151
+	/**
152 152
 	 * Filter the post types to display data on map.
153 153
 	 *
154 154
 	 * @since 1.0.0
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
-        // Set default map options
169
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
+		// Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
173 173
 
174
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
174
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
176
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
-            $map_width = '100%';
178
-        } else {
179
-            $map_width = $geodir_map_options['width'];
180
-        }
176
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
+			$map_width = '100%';
178
+		} else {
179
+			$map_width = $geodir_map_options['width'];
180
+		}
181 181
 
182
-        /**
182
+		/**
183 183
 		 * Filter the width of map.
184 184
 		 *
185 185
 		 * @since 1.0.0
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 * @param int $map_width Width of map box, eg: gd_place.
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190
-        ?>
190
+		?>
191 191
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222 222
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224
-                    ?>
224
+					?>
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
232
-                ?>
228
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
+					$show_entire_cat_panel = "none";
230
+				else
231
+					$show_entire_cat_panel = "''";
232
+				?>
233 233
 
234 234
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
235 235
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
292 292
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
293 293
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
294
-                                echo 'selected="selected"';
295
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
294
+								echo 'selected="selected"';
295
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
296 296
                         </select>
297 297
                     </div>
298 298
 
@@ -304,12 +304,12 @@  discard block
 block discarded – undo
304 304
 				if (empty($geodir_default_map_search_pt))
305 305
 					$geodir_default_map_search_pt = 'gd_place';
306 306
 
307
-                global $gd_session;
308
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
307
+				global $gd_session;
308
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
309 309
 
310
-                if ($homemap_catlist_ptype) {
311
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
312
-                }
310
+				if ($homemap_catlist_ptype) {
311
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
312
+				}
313 313
 
314 314
 				/**
315 315
 				 * Filter the post type to retrieve data for map
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 				?>
323 323
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
324 324
                     <?php
325
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
326
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
325
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
326
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
327 327
 					$map_cat_class = '';
328 328
 					if ($geodir_map_options['enable_post_type_filters']) {
329 329
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
330 330
 					}
331
-                    ?>
331
+					?>
332 332
                     <div
333 333
                         class="map-category-listing<?php echo $map_cat_class;?>">
334 334
                         <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
347 347
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
348 348
                                 <?php } else {$child_collapse = "0";
349
-                                    ?>
349
+									?>
350 350
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
351 351
                                 <?php } ?>
352 352
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -368,17 +368,17 @@  discard block
 block discarded – undo
368 368
                 <!-- map-category-listings-->
369 369
 
370 370
                 <?php
371
-                if ($geodir_map_options['enable_location_filters']) {
371
+				if ($geodir_map_options['enable_location_filters']) {
372 372
 					$country = get_query_var('gd_country');
373 373
 					$region = get_query_var('gd_region');
374 374
 					$city = get_query_var('gd_city');
375 375
                     
376
-                    //fix for location/me page
377
-                    $country = $country != 'me' ? $country : '';
376
+					//fix for location/me page
377
+					$country = $country != 'me' ? $country : '';
378 378
 					$region = $region != 'me' ? $region : '';
379 379
 					$city = $country != 'me' ? $city : '';
380
-                    $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
381
-                    ?>
380
+					$gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
381
+					?>
382 382
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
383 383
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
384 384
                            value="<?php echo $country;?>"/>
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
390 390
                            value="<?php echo $gd_neighbourhood;?>"/>
391 391
                 <?php } else { //end of location filter
392
-                    ?>
392
+					?>
393 393
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
394 394
                 <?php }?>
395 395
 
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 
401 401
 
402 402
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
403
-                    $post_types = geodir_get_posttypes('object');
404
-                    if (count((array)($post_types)) > 1) {
405
-                        ?>
403
+					$post_types = geodir_get_posttypes('object');
404
+					if (count((array)($post_types)) > 1) {
405
+						?>
406 406
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
407 407
                              style="max-width:<?php echo $map_width;?>!important;">
408 408
 
@@ -410,15 +410,15 @@  discard block
 block discarded – undo
410 410
                             <div class="geodir-map-posttype-list"><?php } ?>
411 411
                                 <ul class="clearfix place-list">
412 412
                                     <?php
413
-                                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
413
+									$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
414 414
 
415
-                                    foreach ($post_types as $post_type => $args) {
416
-                                        if (!in_array($post_type, $exclude_post_types)) {
417
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
415
+									foreach ($post_types as $post_type => $args) {
416
+										if (!in_array($post_type, $exclude_post_types)) {
417
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
418 418
 											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>';
419
-                                        }
420
-                                    }
421
-                                    ?>
419
+										}
420
+									}
421
+									?>
422 422
                                 </ul>
423 423
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
424 424
                             </div><?php } ?>
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 
433 433
                         </div> <!-- map-places-listings-->
434 434
                     <?php }
435
-                } // end of post type filter if
436
-                ?>
435
+				} // end of post type filter if
436
+				?>
437 437
 
438 438
             </div>
439 439
         </div> <!--end of stick trigger container-->
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
         </script>
449 449
         <?php
450 450
 
451
-        if (strpos($geodir_map_options['height'], 'vh')) {
452
-            ?>
451
+		if (strpos($geodir_map_options['height'], 'vh')) {
452
+			?>
453 453
             <script>
454 454
                 (function () {
455 455
                     var screenH = jQuery(window).height();
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 
472 472
         <?php
473 473
 
474
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
475
-            ?>
474
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
475
+			?>
476 476
             <script>
477 477
                 (function () {
478 478
                     var screenH = jQuery(window).height();
@@ -487,20 +487,20 @@  discard block
 block discarded – undo
487 487
                 }());
488 488
             </script>
489 489
         <?php
490
-        }
490
+		}
491 491
 
492
-        /**
493
-         * Action that runs after all the map code has been output;
494
-         *
495
-         * @since 1.5.3
496
-         *
497
-         * @param array $geodir_map_options Array of map settings.
498
-         * @param string $map_canvas_name The canvas name and ID for the map.
499
-         */
500
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
492
+		/**
493
+		 * Action that runs after all the map code has been output;
494
+		 *
495
+		 * @since 1.5.3
496
+		 *
497
+		 * @param array $geodir_map_options Array of map settings.
498
+		 * @param string $map_canvas_name The canvas name and ID for the map.
499
+		 */
500
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
501 501
 
502 502
 
503
-    endif; // Exclude posttypes if end
503
+	endif; // Exclude posttypes if end
504 504
 }
505 505
 
506 506
 /**
Please login to merge, or discard this patch.
geodirectory-functions/general_functions.php 1 patch
Spacing   +1344 added lines, -1344 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function geodir_plugin_url() {
29 29
 
30
-	if ( is_ssl() ) :
31
-		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
30
+	if (is_ssl()) :
31
+		return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
32 32
 	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
33
+		return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__)));
34 34
 	endif;
35 35
 }
36 36
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
  * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory
46 46
  */
47 47
 function geodir_plugin_path() {
48
-	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
49
-		return dirname( dirname( __FILE__ ) );
48
+	if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
49
+		return dirname(dirname(__FILE__));
50 50
 	} else {
51
-		return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
51
+		return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
52 52
 	}
53 53
 }
54 54
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
  * @return bool true or false.
64 64
  * @todo    check if this is faster than normal WP check and remove if not.
65 65
  */
66
-function geodir_is_plugin_active( $plugin ) {
67
-	$active_plugins = get_option( 'active_plugins' );
68
-	foreach ( $active_plugins as $key => $active_plugin ) {
69
-		if ( strstr( $active_plugin, $plugin ) ) {
66
+function geodir_is_plugin_active($plugin) {
67
+	$active_plugins = get_option('active_plugins');
68
+	foreach ($active_plugins as $key => $active_plugin) {
69
+		if (strstr($active_plugin, $plugin)) {
70 70
 			return true;
71 71
 		}
72 72
 	}
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return bool|int|string the formatted date.
90 90
  */
91
-function geodir_get_formated_date( $date ) {
92
-	return mysql2date( get_option( 'date_format' ), $date );
91
+function geodir_get_formated_date($date) {
92
+	return mysql2date(get_option('date_format'), $date);
93 93
 }
94 94
 
95 95
 /**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return bool|int|string the formatted time.
107 107
  */
108
-function geodir_get_formated_time( $time ) {
109
-	return mysql2date( get_option( 'time_format' ), $time, $translate = true );
108
+function geodir_get_formated_time($time) {
109
+	return mysql2date(get_option('time_format'), $time, $translate = true);
110 110
 }
111 111
 
112 112
 
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return string Formatted link.
126 126
  */
127
-function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) {
128
-	if ( $use_existing_arguments ) {
127
+function geodir_getlink($url, $params = array(), $use_existing_arguments = false) {
128
+	if ($use_existing_arguments) {
129 129
 		$params = $params + $_GET;
130 130
 	}
131
-	if ( ! $params ) {
131
+	if (!$params) {
132 132
 		return $url;
133 133
 	}
134 134
 	$link = $url;
135
-	if ( strpos( $link, '?' ) === false ) {
135
+	if (strpos($link, '?') === false) {
136 136
 		$link .= '?';
137 137
 	} //If there is no '?' add one at the end
138
-	elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) {
138
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
139 139
 		$link .= '&amp;';
140 140
 	} //If there is no '&' at the END, add one.
141
-	elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) {
141
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
142 142
 		$link .= '&';
143 143
 	} //If there is no '&' at the END, add one.
144 144
 
145 145
 	$params_arr = array();
146
-	foreach ( $params as $key => $value ) {
147
-		if ( gettype( $value ) == 'array' ) { //Handle array data properly
148
-			foreach ( $value as $val ) {
149
-				$params_arr[] = $key . '[]=' . urlencode( $val );
146
+	foreach ($params as $key => $value) {
147
+		if (gettype($value) == 'array') { //Handle array data properly
148
+			foreach ($value as $val) {
149
+				$params_arr[] = $key.'[]='.urlencode($val);
150 150
 			}
151 151
 		} else {
152
-			$params_arr[] = $key . '=' . urlencode( $value );
152
+			$params_arr[] = $key.'='.urlencode($value);
153 153
 		}
154 154
 	}
155
-	$link .= implode( '&', $params_arr );
155
+	$link .= implode('&', $params_arr);
156 156
 
157 157
 	return $link;
158 158
 }
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @return string Listing page url if valid. Otherwise home url will be returned.
171 171
  */
172
-function geodir_get_addlisting_link( $post_type = '' ) {
172
+function geodir_get_addlisting_link($post_type = '') {
173 173
 	global $wpdb;
174 174
 
175 175
 	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
176 176
 	$check_pkg = 1;
177
-	if ( post_type_exists( $post_type ) && $check_pkg ) {
177
+	if (post_type_exists($post_type) && $check_pkg) {
178 178
 
179
-		$add_listing_link = get_page_link( geodir_add_listing_page_id() );
179
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
180 180
 
181
-		return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) );
181
+		return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
182 182
 	} else {
183
-		return get_bloginfo( 'url' );
183
+		return get_bloginfo('url');
184 184
 	}
185 185
 }
186 186
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
209 209
 		// To build the entire URI we need to prepend the protocol, and the http host
210 210
 		// to the URI string.
211
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
211
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
212 212
 	} else {
213 213
 		/*
214 214
 		 * Since we do not have REQUEST_URI to work with, we will assume we are
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		 *
218 218
 		 * IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
219 219
 		 */
220
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
220
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
221 221
 		
222 222
 		// If the query string exists append it to the URI string
223 223
 		if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
224
-			$pageURL .= '?' . $_SERVER['QUERY_STRING'];
224
+			$pageURL .= '?'.$_SERVER['QUERY_STRING'];
225 225
 		}
226 226
 	}
227 227
 	
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @param string $pageURL The URL of the current page.
234 234
 	 */
235
-	return apply_filters( 'geodir_curPageURL', $pageURL );
235
+	return apply_filters('geodir_curPageURL', $pageURL);
236 236
 }
237 237
 
238 238
 /**
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return string Cleaned variable.
249 249
  */
250
-function geodir_clean( $string ) {
250
+function geodir_clean($string) {
251 251
 
252
-	$string = trim( strip_tags( stripslashes( $string ) ) );
253
-	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
254
-	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
255
-	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.
252
+	$string = trim(strip_tags(stripslashes($string)));
253
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
254
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
255
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
256 256
 
257 257
 	return $string;
258 258
 }
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_get_weekday() {
268 268
 	return array(
269
-		__( 'Sunday', 'geodirectory' ),
270
-		__( 'Monday', 'geodirectory' ),
271
-		__( 'Tuesday', 'geodirectory' ),
272
-		__( 'Wednesday', 'geodirectory' ),
273
-		__( 'Thursday', 'geodirectory' ),
274
-		__( 'Friday', 'geodirectory' ),
275
-		__( 'Saturday', 'geodirectory' )
269
+		__('Sunday', 'geodirectory'),
270
+		__('Monday', 'geodirectory'),
271
+		__('Tuesday', 'geodirectory'),
272
+		__('Wednesday', 'geodirectory'),
273
+		__('Thursday', 'geodirectory'),
274
+		__('Friday', 'geodirectory'),
275
+		__('Saturday', 'geodirectory')
276 276
 	);
277 277
 }
278 278
 
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
  */
286 286
 function geodir_get_weeks() {
287 287
 	return array(
288
-		__( 'First', 'geodirectory' ),
289
-		__( 'Second', 'geodirectory' ),
290
-		__( 'Third', 'geodirectory' ),
291
-		__( 'Fourth', 'geodirectory' ),
292
-		__( 'Last', 'geodirectory' )
288
+		__('First', 'geodirectory'),
289
+		__('Second', 'geodirectory'),
290
+		__('Third', 'geodirectory'),
291
+		__('Fourth', 'geodirectory'),
292
+		__('Last', 'geodirectory')
293 293
 	);
294 294
 }
295 295
 
@@ -308,112 +308,112 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return bool If valid returns true. Otherwise false.
310 310
  */
311
-function geodir_is_page( $gdpage = '' ) {
311
+function geodir_is_page($gdpage = '') {
312 312
 
313 313
 	global $wp_query, $post, $wp;
314 314
 	//if(!is_admin()):
315 315
 
316
-	switch ( $gdpage ):
316
+	switch ($gdpage):
317 317
 		case 'add-listing':
318 318
 
319
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
319
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
320 320
 				return true;
321
-			} elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
321
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
322 322
 				return true;
323 323
 			}
324 324
 
325 325
 			break;
326 326
 		case 'preview':
327
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
328
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
327
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
328
+			     && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
329 329
 			) {
330 330
 				return true;
331 331
 			}
332 332
 			break;
333 333
 		case 'listing-success':
334
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
334
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
335 335
 				return true;
336 336
 			}
337 337
 			break;
338 338
 		case 'detail':
339
-			$post_type = get_query_var( 'post_type' );
340
-			if ( is_array( $post_type ) ) {
341
-				$post_type = reset( $post_type );
339
+			$post_type = get_query_var('post_type');
340
+			if (is_array($post_type)) {
341
+				$post_type = reset($post_type);
342 342
 			}
343
-			if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
343
+			if (is_single() && in_array($post_type, geodir_get_posttypes())) {
344 344
 				return true;
345 345
 			}
346 346
 			break;
347 347
 		case 'pt':
348
-			$post_type = get_query_var( 'post_type' );
349
-			if ( is_array( $post_type ) ) {
350
-				$post_type = reset( $post_type );
348
+			$post_type = get_query_var('post_type');
349
+			if (is_array($post_type)) {
350
+				$post_type = reset($post_type);
351 351
 			}
352
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
352
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
353 353
 				return true;
354 354
 			}
355 355
 
356 356
 			break;
357 357
 		case 'listing':
358
-			if ( is_tax() && geodir_get_taxonomy_posttype() ) {
358
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
359 359
 				global $current_term, $taxonomy, $term;
360 360
 
361 361
 				return true;
362 362
 			}
363
-			$post_type = get_query_var( 'post_type' );
364
-			if ( is_array( $post_type ) ) {
365
-				$post_type = reset( $post_type );
363
+			$post_type = get_query_var('post_type');
364
+			if (is_array($post_type)) {
365
+				$post_type = reset($post_type);
366 366
 			}
367
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
367
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
368 368
 				return true;
369 369
 			}
370 370
 
371 371
 			break;
372 372
 		case 'home':
373 373
 
374
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
374
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
375 375
 				return true;
376 376
 			}
377 377
 
378 378
 			break;
379 379
 		case 'location':
380
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
380
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
381 381
 				return true;
382 382
 			}
383 383
 			break;
384 384
 		case 'author':
385
-			if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
385
+			if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
386 386
 				return true;
387 387
 			}
388 388
 
389
-			if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
390
-				if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
389
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
390
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
391 391
 					return true;
392 392
 				}
393 393
 			}
394 394
 			break;
395 395
 		case 'search':
396
-			if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
396
+			if (is_search() && isset($_REQUEST['geodir_search'])) {
397 397
 				return true;
398 398
 			}
399 399
 			break;
400 400
 		case 'info':
401
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
401
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
402 402
 				return true;
403 403
 			}
404 404
 			break;
405 405
 		case 'login':
406
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
406
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
407 407
 				return true;
408 408
 			}
409 409
 			break;
410 410
 		case 'checkout':
411
-			if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
411
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
412 412
 				return true;
413 413
 			}
414 414
 			break;
415 415
 		case 'invoices':
416
-			if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
416
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
417 417
 				return true;
418 418
 			}
419 419
 			break;
@@ -438,25 +438,25 @@  discard block
 block discarded – undo
438 438
  *
439 439
  * @param object $wp WordPress object.
440 440
  */
441
-function geodir_set_is_geodir_page( $wp ) {
442
-	if ( ! is_admin() ) {
441
+function geodir_set_is_geodir_page($wp) {
442
+	if (!is_admin()) {
443 443
 		//$wp->query_vars['gd_is_geodir_page'] = false;
444 444
 		//print_r()
445
-		if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array(
445
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array(
446 446
 				'preview',
447 447
 				'page',
448 448
 				'paged',
449 449
 				'cpage'
450
-			) )
450
+			))
451 451
 		) {
452
-			if ( geodir_is_page( 'home' ) ) {
452
+			if (geodir_is_page('home')) {
453 453
 				$wp->query_vars['gd_is_geodir_page'] = true;
454 454
 			}
455 455
 
456 456
 
457 457
 		}
458 458
 
459
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
459
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
460 460
 			if (
461 461
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
462 462
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
466 466
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
467 467
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
468
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
469
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
468
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
469
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
470 470
 			) {
471 471
 				$wp->query_vars['gd_is_geodir_page'] = true;
472 472
 			}
473 473
 		}
474 474
 
475
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
476
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
475
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
476
+			$page = get_page_by_path($wp->query_vars['pagename']);
477 477
 
478
-			if ( ! empty( $page ) && (
478
+			if (!empty($page) && (
479 479
 					$page->ID == geodir_add_listing_page_id()
480 480
 					|| $page->ID == geodir_preview_page_id()
481 481
 					|| $page->ID == geodir_success_page_id()
482 482
 					|| $page->ID == geodir_location_page_id()
483
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
484
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
485
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
486
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
487
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
483
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
484
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
485
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
486
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
487
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
488 488
 				)
489 489
 			) {
490 490
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 
494 494
 
495
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
495
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
496 496
 			$requested_post_type = $wp->query_vars['post_type'];
497 497
 			// check if this post type is geodirectory post types
498 498
 			$post_type_array = geodir_get_posttypes();
499
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
499
+			if (in_array($requested_post_type, $post_type_array)) {
500 500
 				$wp->query_vars['gd_is_geodir_page'] = true;
501 501
 			}
502 502
 		}
503 503
 
504
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
505
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
506
-			if ( ! empty( $geodir_taxonomis ) ) {
507
-				foreach ( $geodir_taxonomis as $taxonomy ) {
508
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
504
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
505
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
506
+			if (!empty($geodir_taxonomis)) {
507
+				foreach ($geodir_taxonomis as $taxonomy) {
508
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
509 509
 						$wp->query_vars['gd_is_geodir_page'] = true;
510 510
 						break;
511 511
 					}
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 
515 515
 		}
516 516
 
517
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
517
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
518 518
 			$wp->query_vars['gd_is_geodir_page'] = true;
519 519
 		}
520 520
 
521 521
 
522
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
522
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
523 523
 			$wp->query_vars['gd_is_geodir_page'] = true;
524 524
 		}
525 525
 
526 526
 
527 527
 //check if homepage
528
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
529
-		     && ! isset( $wp->query_vars['page_id'] )
530
-		     && ! isset( $wp->query_vars['pagename'] )
528
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
529
+		     && !isset($wp->query_vars['page_id'])
530
+		     && !isset($wp->query_vars['pagename'])
531 531
 		     && is_page_geodir_home()
532 532
 		) {
533 533
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
  */
552 552
 function geodir_is_geodir_page() {
553 553
 	global $wp;
554
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
554
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
555 555
 		return true;
556 556
 	} else {
557 557
 		return false;
558 558
 	}
559 559
 }
560 560
 
561
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
561
+if (!function_exists('geodir_get_imagesize')) {
562 562
 	/**
563 563
 	 * Get image size using the size key .
564 564
 	 *
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
 	 *
570 570
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
571 571
 	 */
572
-	function geodir_get_imagesize( $size = '' ) {
572
+	function geodir_get_imagesize($size = '') {
573 573
 
574 574
 		$imagesizes = array(
575
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
576
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
577
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
578
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
575
+			'list-thumb'   => array('w' => 283, 'h' => 188),
576
+			'thumbnail'    => array('w' => 125, 'h' => 125),
577
+			'widget-thumb' => array('w' => 50, 'h' => 50),
578
+			'slider-thumb' => array('w' => 100, 'h' => 100)
579 579
 		);
580 580
 
581 581
 		/**
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 		 *
586 586
 		 * @param array $imagesizes Image size array.
587 587
 		 */
588
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
588
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
589 589
 
590
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
590
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
591 591
 			/**
592 592
 			 * Filters image size of the passed key.
593 593
 			 *
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
 			 *
596 596
 			 * @param array $imagesizes [$size] Image size array of the passed key.
597 597
 			 */
598
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
598
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
599 599
 
600
-		} elseif ( ! empty( $size ) ) {
600
+		} elseif (!empty($size)) {
601 601
 
602
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
602
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
603 603
 
604 604
 		}
605 605
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 */
624 624
 
625 625
 
626
-if ( ! function_exists( 'createRandomString' ) ) {
626
+if (!function_exists('createRandomString')) {
627 627
 	/**
628 628
 	 * Creates random string.
629 629
 	 *
@@ -633,21 +633,21 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	function createRandomString() {
635 635
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
636
-		srand( (double) microtime() * 1000000 );
636
+		srand((double) microtime() * 1000000);
637 637
 		$i       = 0;
638 638
 		$rstring = '';
639
-		while ( $i <= 25 ) {
639
+		while ($i <= 25) {
640 640
 			$num     = rand() % 33;
641
-			$tmp     = substr( $chars, $num, 1 );
642
-			$rstring = $rstring . $tmp;
643
-			$i ++;
641
+			$tmp     = substr($chars, $num, 1);
642
+			$rstring = $rstring.$tmp;
643
+			$i++;
644 644
 		}
645 645
 
646 646
 		return $rstring;
647 647
 	}
648 648
 }
649 649
 
650
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
650
+if (!function_exists('geodir_getDistanceRadius')) {
651 651
 	/**
652 652
 	 * Calculates the distance radius.
653 653
 	 *
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 	 *
659 659
 	 * @return float The mean radius.
660 660
 	 */
661
-	function geodir_getDistanceRadius( $uom = 'km' ) {
661
+	function geodir_getDistanceRadius($uom = 'km') {
662 662
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
663
-		switch ( geodir_strtolower( $uom ) ):
663
+		switch (geodir_strtolower($uom)):
664 664
 			case 'km'    :
665 665
 				$earthMeanRadius = 6371.009; // km
666 666
 				break;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 }
693 693
 
694 694
 
695
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
695
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
696 696
 	/**
697 697
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
698 698
 	 *
@@ -705,17 +705,17 @@  discard block
 block discarded – undo
705 705
 	 *
706 706
 	 * @return float The distance.
707 707
 	 */
708
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
708
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
709 709
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
710 710
 
711
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
711
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
712 712
 
713
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
714
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
715
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
716
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
717
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
718
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
713
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
714
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
715
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
716
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
717
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
718
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
719 719
 		$distance       = $earthMeanRadius * $c;
720 720
 
721 721
 		return $distance;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 }
725 725
 
726 726
 
727
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
727
+if (!function_exists('geodir_sendEmail')) {
728 728
 	/**
729 729
 	 * The main function that send transactional emails using the args provided.
730 730
 	 *
@@ -743,93 +743,93 @@  discard block
 block discarded – undo
743 743
 	 * @param string $post_id       The post ID.
744 744
 	 * @param string $user_id       The user ID.
745 745
 	 */
746
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
746
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
747 747
 		$login_details = '';
748 748
 
749 749
 		// strip slashes from subject & message text
750
-		$to_subject = stripslashes_deep( $to_subject );
751
-		$to_message = stripslashes_deep( $to_message );
750
+		$to_subject = stripslashes_deep($to_subject);
751
+		$to_message = stripslashes_deep($to_message);
752 752
 
753
-		if ( $message_type == 'send_friend' ) {
754
-			$subject = get_option( 'geodir_email_friend_subject' );
755
-			$message = get_option( 'geodir_email_friend_content' );
756
-		} elseif ( $message_type == 'send_enquiry' ) {
757
-			$subject = get_option( 'geodir_email_enquiry_subject' );
758
-			$message = get_option( 'geodir_email_enquiry_content' );
753
+		if ($message_type == 'send_friend') {
754
+			$subject = get_option('geodir_email_friend_subject');
755
+			$message = get_option('geodir_email_friend_content');
756
+		} elseif ($message_type == 'send_enquiry') {
757
+			$subject = get_option('geodir_email_enquiry_subject');
758
+			$message = get_option('geodir_email_enquiry_content');
759 759
 
760 760
 			// change to name in some cases
761
-			$post_author = get_post_field( 'post_author', $post_id );
762
-			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
763
-				$toEmailName = __('Business Owner','geodirectory');
764
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
765
-				$toEmailName = __('Business Owner','geodirectory');
761
+			$post_author = get_post_field('post_author', $post_id);
762
+			if (is_super_admin($post_author)) {// if admin probably not the post author so change name
763
+				$toEmailName = __('Business Owner', 'geodirectory');
764
+			}elseif (defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id, 'claimed') != '1') {// if claim manager installed but listing not claimed
765
+				$toEmailName = __('Business Owner', 'geodirectory');
766 766
 			}
767 767
 
768 768
 
769
-		} elseif ( $message_type == 'forgot_password' ) {
770
-			$subject       = get_option( 'geodir_forgot_password_subject' );
771
-			$message       = get_option( 'geodir_forgot_password_content' );
769
+		} elseif ($message_type == 'forgot_password') {
770
+			$subject       = get_option('geodir_forgot_password_subject');
771
+			$message       = get_option('geodir_forgot_password_content');
772 772
 			$login_details = $to_message;
773
-		} elseif ( $message_type == 'registration' ) {
774
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
775
-			$message       = get_option( 'geodir_registration_success_email_content' );
773
+		} elseif ($message_type == 'registration') {
774
+			$subject       = get_option('geodir_registration_success_email_subject');
775
+			$message       = get_option('geodir_registration_success_email_content');
776 776
 			$login_details = $to_message;
777
-		} elseif ( $message_type == 'post_submit' ) {
778
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
779
-			$message = get_option( 'geodir_post_submited_success_email_content' );
780
-		} elseif ( $message_type == 'listing_published' ) {
781
-			$subject = get_option( 'geodir_post_published_email_subject' );
782
-			$message = get_option( 'geodir_post_published_email_content' );
783
-		} elseif ( $message_type == 'listing_edited' ) {
784
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
785
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
777
+		} elseif ($message_type == 'post_submit') {
778
+			$subject = get_option('geodir_post_submited_success_email_subject');
779
+			$message = get_option('geodir_post_submited_success_email_content');
780
+		} elseif ($message_type == 'listing_published') {
781
+			$subject = get_option('geodir_post_published_email_subject');
782
+			$message = get_option('geodir_post_published_email_content');
783
+		} elseif ($message_type == 'listing_edited') {
784
+			$subject = get_option('geodir_post_edited_email_subject_admin');
785
+			$message = get_option('geodir_post_edited_email_content_admin');
786 786
 		}
787 787
 
788
-		if ( ! empty( $subject ) ) {
789
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
788
+		if (!empty($subject)) {
789
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
790 790
 		}
791 791
 
792
-		if ( ! empty( $message ) ) {
793
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
792
+		if (!empty($message)) {
793
+			$message = __(stripslashes_deep($message), 'geodirectory');
794 794
 		}
795 795
 
796
-		$to_message        = nl2br( $to_message );
797
-		$sitefromEmail     = get_option( 'site_email' );
796
+		$to_message        = nl2br($to_message);
797
+		$sitefromEmail     = get_option('site_email');
798 798
 		$sitefromEmailName = get_site_emailName();
799
-		$productlink       = get_permalink( $post_id );
799
+		$productlink       = get_permalink($post_id);
800 800
 
801 801
 		$user_login = '';
802
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
802
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
803 803
 			$user_login = $user_info->user_login;
804 804
 		}
805 805
 
806 806
 		$posted_date = '';
807 807
 		$listingLink = '';
808 808
 
809
-		$post_info = get_post( $post_id );
809
+		$post_info = get_post($post_id);
810 810
 
811
-		if ( $post_info ) {
811
+		if ($post_info) {
812 812
 			$posted_date = $post_info->post_date;
813
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
813
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
814 814
 		}
815 815
 		$siteurl       = home_url();
816
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
816
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
817 817
 		$loginurl      = geodir_login_url();
818
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
818
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
819 819
 
820
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
821
-		$post_author_name = geodir_get_client_name( $post_author_id );
822
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
820
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
821
+		$post_author_name = geodir_get_client_name($post_author_id);
822
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
823 823
 
824
-		if ( $fromEmail == '' ) {
825
-			$fromEmail = get_option( 'site_email' );
824
+		if ($fromEmail == '') {
825
+			$fromEmail = get_option('site_email');
826 826
 		}
827 827
 
828
-		if ( $fromEmailName == '' ) {
829
-			$fromEmailName = get_option( 'site_email_name' );
828
+		if ($fromEmailName == '') {
829
+			$fromEmailName = get_option('site_email_name');
830 830
 		}
831 831
 
832
-		$search_array  = array(
832
+		$search_array = array(
833 833
 			'[#listing_link#]',
834 834
 			'[#site_name_url#]',
835 835
 			'[#post_id#]',
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 			$post_author_name,
870 870
 			$current_date
871 871
 		);
872
-		$message       = str_replace( $search_array, $replace_array, $message );
872
+		$message       = str_replace($search_array, $replace_array, $message);
873 873
 
874 874
 		$search_array  = array(
875 875
 			'[#listing_link#]',
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
 			$post_author_name,
906 906
 			$current_date
907 907
 		);
908
-		$subject       = str_replace( $search_array, $replace_array, $subject );
908
+		$subject = str_replace($search_array, $replace_array, $subject);
909 909
 
910
-		$headers =  array();
910
+		$headers = array();
911 911
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
912
-		$headers[] = "Reply-To: " . $fromEmail;
913
-		$headers[] = 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>';
912
+		$headers[] = "Reply-To: ".$fromEmail;
913
+		$headers[] = 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>';
914 914
 
915 915
 		$to = $toEmail;
916 916
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 		 * @param string $post_id       The post ID.
933 933
 		 * @param string $user_id       The user ID.
934 934
 		 */
935
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
935
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
936 936
 		/**
937 937
 		 * Filter the client email subject.
938 938
 		 *
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 		 * @param string $post_id       The post ID.
952 952
 		 * @param string $user_id       The user ID.
953 953
 		 */
954
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
954
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
955 955
 		/**
956 956
 		 * Filter the client email message.
957 957
 		 *
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 		 * @param string $post_id       The post ID.
971 971
 		 * @param string $user_id       The user ID.
972 972
 		 */
973
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
973
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
974 974
 		/**
975 975
 		 * Filter the client email headers.
976 976
 		 *
@@ -989,39 +989,39 @@  discard block
 block discarded – undo
989 989
 		 * @param string $post_id       The post ID.
990 990
 		 * @param string $user_id       The user ID.
991 991
 		 */
992
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
992
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
993 993
 
994
-		$sent = wp_mail( $to, $subject, $message, $headers );
994
+		$sent = wp_mail($to, $subject, $message, $headers);
995 995
 
996
-		if ( ! $sent ) {
997
-			if ( is_array( $to ) ) {
998
-				$to = implode( ',', $to );
996
+		if (!$sent) {
997
+			if (is_array($to)) {
998
+				$to = implode(',', $to);
999 999
 			}
1000 1000
 			$log_message = sprintf(
1001
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1001
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1002 1002
 				$message_type,
1003
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1003
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1004 1004
 				$to,
1005 1005
 				$subject
1006 1006
 			);
1007
-			geodir_error_log( $log_message );
1007
+			geodir_error_log($log_message);
1008 1008
 		}
1009 1009
 
1010 1010
 		///////// ADMIN BCC EMIALS
1011
-		$adminEmail = get_bloginfo( 'admin_email' );
1011
+		$adminEmail = get_bloginfo('admin_email');
1012 1012
 		$to         = $adminEmail;
1013 1013
 
1014 1014
 		$admin_bcc = false;
1015
-		if ( $message_type == 'registration' ) {
1016
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1017
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1018
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1015
+		if ($message_type == 'registration') {
1016
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1017
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1018
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1019 1019
 		}
1020
-		if ( $message_type == 'post_submit' ) {
1021
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
1022
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
1020
+		if ($message_type == 'post_submit') {
1021
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
1022
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
1023 1023
 
1024
-			$search_array  = array(
1024
+			$search_array = array(
1025 1025
 				'[#listing_link#]',
1026 1026
 				'[#site_name_url#]',
1027 1027
 				'[#post_id#]',
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 				$user_login,
1054 1054
 				$user_login
1055 1055
 			);
1056
-			$message       = str_replace( $search_array, $replace_array, $message );
1056
+			$message       = str_replace($search_array, $replace_array, $message);
1057 1057
 
1058 1058
 			$search_array  = array(
1059 1059
 				'[#listing_link#]',
@@ -1081,40 +1081,40 @@  discard block
 block discarded – undo
1081 1081
 				$user_login,
1082 1082
 				$user_login
1083 1083
 			);
1084
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1084
+			$subject = str_replace($search_array, $replace_array, $subject);
1085 1085
 
1086 1086
 			$subject .= ' - ADMIN BCC COPY';
1087 1087
 			$admin_bcc = true;
1088 1088
 
1089
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1089
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1090 1090
 			$subject .= ' - ADMIN BCC COPY';
1091 1091
 			$admin_bcc = true;
1092
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1092
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1093 1093
 			$subject .= ' - ADMIN BCC COPY';
1094 1094
 			$admin_bcc = true;
1095
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1095
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1096 1096
 			$subject .= ' - ADMIN BCC COPY';
1097 1097
 			$admin_bcc = true;
1098
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1098
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1099 1099
 			$subject .= ' - ADMIN BCC COPY';
1100 1100
 			$admin_bcc = true;
1101 1101
 		}
1102 1102
 
1103
-		if ( $admin_bcc === true ) {
1104
-			$sent = wp_mail( $to, $subject, $message, $headers );
1103
+		if ($admin_bcc === true) {
1104
+			$sent = wp_mail($to, $subject, $message, $headers);
1105 1105
 
1106
-			if ( ! $sent ) {
1107
-				if ( is_array( $to ) ) {
1108
-					$to = implode( ',', $to );
1106
+			if (!$sent) {
1107
+				if (is_array($to)) {
1108
+					$to = implode(',', $to);
1109 1109
 				}
1110 1110
 				$log_message = sprintf(
1111
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1111
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1112 1112
 					$message_type,
1113
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1113
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1114 1114
 					$to,
1115 1115
 					$subject
1116 1116
 				);
1117
-				geodir_error_log( $log_message );
1117
+				geodir_error_log($log_message);
1118 1118
 			}
1119 1119
 		}
1120 1120
 
@@ -1130,52 +1130,52 @@  discard block
 block discarded – undo
1130 1130
  */
1131 1131
 function geodir_taxonomy_breadcrumb() {
1132 1132
 
1133
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1133
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1134 1134
 	$parent = $term->parent;
1135 1135
 
1136
-	while ( $parent ):
1136
+	while ($parent):
1137 1137
 		$parents[]  = $parent;
1138
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1138
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1139 1139
 		$parent     = $new_parent->parent;
1140 1140
 	endwhile;
1141 1141
 
1142
-	if ( ! empty( $parents ) ):
1143
-		$parents = array_reverse( $parents );
1142
+	if (!empty($parents)):
1143
+		$parents = array_reverse($parents);
1144 1144
 
1145
-		foreach ( $parents as $parent ):
1146
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1147
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1148
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1145
+		foreach ($parents as $parent):
1146
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1147
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1148
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1149 1149
 		endforeach;
1150 1150
 
1151 1151
 	endif;
1152 1152
 
1153
-	echo '<li> > ' . $term->name . '</li>';
1153
+	echo '<li> > '.$term->name.'</li>';
1154 1154
 }
1155 1155
 
1156
-function geodir_wpml_post_type_archive_link($link, $post_type){
1156
+function geodir_wpml_post_type_archive_link($link, $post_type) {
1157 1157
 
1158
-	if(function_exists('icl_object_id')) {
1159
-		$post_types   = get_option( 'geodir_post_types' );
1160
-		$slug         = $post_types[ $post_type ]['rewrite']['slug'];
1158
+	if (function_exists('icl_object_id')) {
1159
+		$post_types   = get_option('geodir_post_types');
1160
+		$slug         = $post_types[$post_type]['rewrite']['slug'];
1161 1161
 
1162 1162
 		//echo $link.'###'.gd_wpml_get_lang_from_url( $link) ;
1163 1163
 
1164 1164
 		// Alter the CPT slug if WPML is set to do so
1165
-		if ( function_exists( 'icl_object_id' ) ) {
1166
-			if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {
1165
+		if (function_exists('icl_object_id')) {
1166
+			if (gd_wpml_slug_translation_turned_on($post_type) && $language_code = gd_wpml_get_lang_from_url($link)) {
1167 1167
 
1168 1168
 				$org_slug = $slug;
1169
-				$slug     = apply_filters( 'wpml_translate_single_string',
1169
+				$slug     = apply_filters('wpml_translate_single_string',
1170 1170
 					$slug,
1171 1171
 					'WordPress',
1172
-					'URL slug: ' . $slug,
1173
-					$language_code );
1172
+					'URL slug: '.$slug,
1173
+					$language_code);
1174 1174
 
1175
-				if ( ! $slug ) {
1175
+				if (!$slug) {
1176 1176
 					$slug = $org_slug;
1177 1177
 				} else {
1178
-					$link = str_replace( $org_slug, $slug, $link );
1178
+					$link = str_replace($org_slug, $slug, $link);
1179 1179
 				}
1180 1180
 
1181 1181
 			}
@@ -1206,9 +1206,9 @@  discard block
 block discarded – undo
1206 1206
 	 *
1207 1207
 	 * @since 1.0.0
1208 1208
 	 */
1209
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1209
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1210 1210
 
1211
-	if ( ! geodir_is_page( 'home' ) ) {
1211
+	if (!geodir_is_page('home')) {
1212 1212
 		$breadcrumb    = '';
1213 1213
 		$url_categoris = '';
1214 1214
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1217,162 +1217,162 @@  discard block
 block discarded – undo
1217 1217
 		 *
1218 1218
 		 * @since 1.0.0
1219 1219
 		 */
1220
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1220
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1221 1221
 
1222 1222
 		$gd_post_type   = geodir_get_current_posttype();
1223
-		$post_type_info = get_post_type_object( $gd_post_type );
1223
+		$post_type_info = get_post_type_object($gd_post_type);
1224 1224
 
1225
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1225
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1226 1226
 
1227
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1227
+		$listing_link = get_post_type_archive_link($gd_post_type);
1228 1228
 
1229
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1230
-		$listing_link = rtrim( $listing_link, '/' );
1229
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1230
+		$listing_link = rtrim($listing_link, '/');
1231 1231
 		$listing_link .= '/';
1232 1232
 
1233 1233
 		$post_type_for_location_link = $listing_link;
1234
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1234
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1235 1235
 
1236 1236
 		global $wp, $gd_session;
1237 1237
 		$location_link = $post_type_for_location_link;
1238 1238
 
1239
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1239
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1240 1240
 			global $post;
1241
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1242
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1241
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1242
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1243 1243
 
1244
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1244
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1245 1245
 				$location_terms = array(
1246 1246
 					'gd_country' => $post->country_slug,
1247 1247
 					'gd_region'  => $post->region_slug,
1248 1248
 					'gd_city'    => $post->city_slug
1249 1249
 				);
1250 1250
 
1251
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1251
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1252 1252
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1253 1253
 				}
1254 1254
 			}
1255 1255
 
1256
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1256
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1257 1257
 
1258 1258
 			$hide_url_part = array();
1259
-			if ( $location_manager ) {
1260
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1261
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1262
-
1263
-				if ( $hide_region_part && $hide_country_part ) {
1264
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1265
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1266
-					$hide_url_part = array( 'gd_region' );
1267
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1268
-					$hide_url_part = array( 'gd_country' );
1259
+			if ($location_manager) {
1260
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1261
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1262
+
1263
+				if ($hide_region_part && $hide_country_part) {
1264
+					$hide_url_part = array('gd_country', 'gd_region');
1265
+				} else if ($hide_region_part && !$hide_country_part) {
1266
+					$hide_url_part = array('gd_region');
1267
+				} else if (!$hide_region_part && $hide_country_part) {
1268
+					$hide_url_part = array('gd_country');
1269 1269
 				}
1270 1270
 			}
1271 1271
 
1272 1272
 			$hide_text_part = array();
1273
-			if ( $geodir_show_location_url == 'country_city' ) {
1274
-				$hide_text_part = array( 'gd_region' );
1273
+			if ($geodir_show_location_url == 'country_city') {
1274
+				$hide_text_part = array('gd_region');
1275 1275
 
1276
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1277
-					unset( $location_terms['gd_region'] );
1276
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1277
+					unset($location_terms['gd_region']);
1278 1278
 				}
1279
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1280
-				$hide_text_part = array( 'gd_country' );
1279
+			} else if ($geodir_show_location_url == 'region_city') {
1280
+				$hide_text_part = array('gd_country');
1281 1281
 
1282
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1283
-					unset( $location_terms['gd_country'] );
1282
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1283
+					unset($location_terms['gd_country']);
1284 1284
 				}
1285
-			} else if ( $geodir_show_location_url == 'city' ) {
1286
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1285
+			} else if ($geodir_show_location_url == 'city') {
1286
+				$hide_text_part = array('gd_country', 'gd_region');
1287 1287
 
1288
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1289
-					unset( $location_terms['gd_country'] );
1288
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1289
+					unset($location_terms['gd_country']);
1290 1290
 				}
1291
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1292
-					unset( $location_terms['gd_region'] );
1291
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1292
+					unset($location_terms['gd_region']);
1293 1293
 				}
1294 1294
 			}
1295 1295
 
1296 1296
 			$is_location_last = '';
1297 1297
 			$is_taxonomy_last = '';
1298 1298
 			$breadcrumb .= '<li>';
1299
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1300
-				$gd_taxonomy = $gd_post_type . 'category';
1301
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1302
-				$gd_taxonomy = $gd_post_type . '_tags';
1299
+			if (get_query_var($gd_post_type.'category')) {
1300
+				$gd_taxonomy = $gd_post_type.'category';
1301
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1302
+				$gd_taxonomy = $gd_post_type.'_tags';
1303 1303
 			}
1304 1304
 
1305
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1306
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1305
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1306
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1307 1307
 				$is_location_last = false;
1308 1308
 			} else {
1309 1309
 				$is_location_last = true;
1310 1310
 			}
1311 1311
 
1312
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1312
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1313 1313
 				$is_taxonomy_last = true;
1314 1314
 			} else {
1315 1315
 				$is_taxonomy_last = false;
1316 1316
 			}
1317 1317
 
1318
-			if ( ! empty( $location_terms ) ) {
1319
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1318
+			if (!empty($location_terms)) {
1319
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1320 1320
 
1321
-				foreach ( $location_terms as $key => $location_term ) {
1322
-					if ( $location_term != '' ) {
1323
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1321
+				foreach ($location_terms as $key => $location_term) {
1322
+					if ($location_term != '') {
1323
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1324 1324
 							continue;
1325 1325
 						}
1326 1326
 
1327
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1328
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1329
-						$gd_location_link_text = ucfirst( $gd_location_link_text );
1327
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1328
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1329
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1330 1330
 
1331 1331
 						$location_term_actual_country = '';
1332 1332
 						$location_term_actual_region  = '';
1333 1333
 						$location_term_actual_city    = '';
1334
-						if ( $geodir_get_locations ) {
1335
-							if ( $key == 'gd_country' ) {
1336
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1337
-							} else if ( $key == 'gd_region' ) {
1338
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1339
-							} else if ( $key == 'gd_city' ) {
1340
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1334
+						if ($geodir_get_locations) {
1335
+							if ($key == 'gd_country') {
1336
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1337
+							} else if ($key == 'gd_region') {
1338
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1339
+							} else if ($key == 'gd_city') {
1340
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1341 1341
 							}
1342 1342
 						} else {
1343 1343
 							$location_info = geodir_get_location();
1344 1344
 
1345
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1346
-								if ( $key == 'gd_country' ) {
1347
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1348
-								} else if ( $key == 'gd_region' ) {
1349
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1350
-								} else if ( $key == 'gd_city' ) {
1351
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1345
+							if (!empty($location_info) && isset($location_info->location_id)) {
1346
+								if ($key == 'gd_country') {
1347
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1348
+								} else if ($key == 'gd_region') {
1349
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1350
+								} else if ($key == 'gd_city') {
1351
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1352 1352
 								}
1353 1353
 							}
1354 1354
 						}
1355 1355
 
1356
-						if ( $is_location_last && $key == 'gd_country' && ! ( isset( $location_terms['gd_region'] ) && $location_terms['gd_region'] != '' ) && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1357
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1358
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1359
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1360
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1361
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1362
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1363
-							$breadcrumb .= $separator . $gd_location_link_text;
1356
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1357
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1358
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1359
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1360
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1361
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1362
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1363
+							$breadcrumb .= $separator.$gd_location_link_text;
1364 1364
 						} else {
1365
-							if ( get_option( 'permalink_structure' ) != '' ) {
1366
-								$location_link .= $location_term . '/';
1365
+							if (get_option('permalink_structure') != '') {
1366
+								$location_link .= $location_term.'/';
1367 1367
 							} else {
1368
-								$location_link .= "&$key=" . $location_term;
1368
+								$location_link .= "&$key=".$location_term;
1369 1369
 							}
1370 1370
 
1371
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1371
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1372 1372
 								$gd_location_link_text = $location_term_actual_country;
1373
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1373
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1374 1374
 								$gd_location_link_text = $location_term_actual_region;
1375
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1375
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1376 1376
 								$gd_location_link_text = $location_term_actual_city;
1377 1377
 							}
1378 1378
 
@@ -1382,76 +1382,76 @@  discard block
 block discarded – undo
1382 1382
                             }
1383 1383
                             */
1384 1384
 
1385
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1385
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1386 1386
 						}
1387 1387
 					}
1388 1388
 				}
1389 1389
 			}
1390 1390
 
1391
-			if ( ! empty( $gd_taxonomy ) ) {
1391
+			if (!empty($gd_taxonomy)) {
1392 1392
 				$term_index = 1;
1393 1393
 
1394 1394
 				//if(get_option('geodir_add_categories_url'))
1395 1395
 				{
1396
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1397
-						$cat_link = $listing_link . 'tags/';
1396
+					if (get_query_var($gd_post_type.'_tags')) {
1397
+						$cat_link = $listing_link.'tags/';
1398 1398
 					} else {
1399 1399
 						$cat_link = $listing_link;
1400 1400
 					}
1401 1401
 
1402
-					foreach ( $location_terms as $key => $location_term ) {
1403
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1402
+					foreach ($location_terms as $key => $location_term) {
1403
+						if ($location_manager && in_array($key, $hide_url_part)) {
1404 1404
 							continue;
1405 1405
 						}
1406 1406
 
1407
-						if ( $location_term != '' ) {
1408
-							if ( get_option( 'permalink_structure' ) != '' ) {
1409
-								$cat_link .= $location_term . '/';
1407
+						if ($location_term != '') {
1408
+							if (get_option('permalink_structure') != '') {
1409
+								$cat_link .= $location_term.'/';
1410 1410
 							}
1411 1411
 						}
1412 1412
 					}
1413 1413
 
1414
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1415
-					foreach ( $term_array as $term ) {
1416
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1417
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1414
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1415
+					foreach ($term_array as $term) {
1416
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1417
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1418 1418
 
1419 1419
 						// get term actual name
1420
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1421
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1422
-							$term_link_text = urldecode( $term_info['name'] );
1420
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1421
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1422
+							$term_link_text = urldecode($term_info['name']);
1423 1423
 						} else {
1424 1424
 							continue;
1425 1425
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1426 1426
 						}
1427 1427
 
1428
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1429
-							$breadcrumb .= $separator . $term_link_text;
1428
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1429
+							$breadcrumb .= $separator.$term_link_text;
1430 1430
 						} else {
1431
-							$cat_link .= $term . '/';
1432
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1431
+							$cat_link .= $term.'/';
1432
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1433 1433
 						}
1434
-						$term_index ++;
1434
+						$term_index++;
1435 1435
 					}
1436 1436
 				}
1437 1437
 
1438 1438
 
1439 1439
 			}
1440 1440
 
1441
-			if ( geodir_is_page( 'detail' ) ) {
1442
-				$breadcrumb .= $separator . get_the_title();
1441
+			if (geodir_is_page('detail')) {
1442
+				$breadcrumb .= $separator.get_the_title();
1443 1443
 			}
1444 1444
 
1445 1445
 			$breadcrumb .= '</li>';
1446 1446
 
1447 1447
 
1448
-		} elseif ( geodir_is_page( 'author' ) ) {
1448
+		} elseif (geodir_is_page('author')) {
1449 1449
 			$user_id             = get_current_user_id();
1450
-			$author_link         = get_author_posts_url( $user_id );
1451
-			$default_author_link = geodir_getlink( $author_link, array(
1450
+			$author_link         = get_author_posts_url($user_id);
1451
+			$default_author_link = geodir_getlink($author_link, array(
1452 1452
 				'geodir_dashbord' => 'true',
1453 1453
 				'stype'           => 'gd_place'
1454
-			), false );
1454
+			), false);
1455 1455
 
1456 1456
 			/**
1457 1457
 			 * Filter author page link.
@@ -1461,16 +1461,16 @@  discard block
 block discarded – undo
1461 1461
 			 * @param string $default_author_link Default author link.
1462 1462
 			 * @param int $user_id                Author ID.
1463 1463
 			 */
1464
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1464
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1465 1465
 
1466 1466
 			$breadcrumb .= '<li>';
1467
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1467
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1468 1468
 
1469
-			if ( isset( $_REQUEST['list'] ) ) {
1470
-				$author_link = geodir_getlink( $author_link, array(
1469
+			if (isset($_REQUEST['list'])) {
1470
+				$author_link = geodir_getlink($author_link, array(
1471 1471
 					'geodir_dashbord' => 'true',
1472 1472
 					'stype'           => $_REQUEST['stype']
1473
-				), false );
1473
+				), false);
1474 1474
 
1475 1475
 				/**
1476 1476
 				 * Filter author page link.
@@ -1481,61 +1481,61 @@  discard block
 block discarded – undo
1481 1481
 				 * @param int $user_id        Author ID.
1482 1482
 				 * @param string $_REQUEST    ['stype'] Post type.
1483 1483
 				 */
1484
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1484
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1485 1485
 
1486
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1487
-				$breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1486
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1487
+				$breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1488 1488
 			} else {
1489
-				$breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' );
1489
+				$breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1490 1490
 			}
1491 1491
 
1492 1492
 			$breadcrumb .= '</li>';
1493
-		} elseif ( is_category() || is_single() ) {
1493
+		} elseif (is_category() || is_single()) {
1494 1494
 			$category = get_the_category();
1495
-			if ( is_category() ) {
1496
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1495
+			if (is_category()) {
1496
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1497 1497
 			}
1498
-			if ( is_single() ) {
1499
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1500
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1498
+			if (is_single()) {
1499
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1500
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1501 1501
 			}
1502 1502
 			/* End of my version ##################################################### */
1503
-		} else if ( is_page() ) {
1503
+		} else if (is_page()) {
1504 1504
 			$page_title = get_the_title();
1505 1505
 
1506
-			if ( geodir_is_page( 'location' ) ) {
1506
+			if (geodir_is_page('location')) {
1507 1507
 				$location_page_id = geodir_location_page_id();
1508
-				$loc_post         = get_post( $location_page_id );
1508
+				$loc_post         = get_post($location_page_id);
1509 1509
 				$post_name        = $loc_post->post_name;
1510
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1511
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1510
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1511
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1512 1512
 			}
1513 1513
 
1514
-			$breadcrumb .= '<li>' . $separator;
1515
-			$breadcrumb .= stripslashes_deep( $page_title );
1514
+			$breadcrumb .= '<li>'.$separator;
1515
+			$breadcrumb .= stripslashes_deep($page_title);
1516 1516
 			$breadcrumb .= '</li>';
1517
-		} else if ( is_tag() ) {
1518
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1519
-		} else if ( is_day() ) {
1520
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1521
-			the_time( 'F jS, Y' );
1517
+		} else if (is_tag()) {
1518
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1519
+		} else if (is_day()) {
1520
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1521
+			the_time('F jS, Y');
1522 1522
 			$breadcrumb .= '</li>';
1523
-		} else if ( is_month() ) {
1524
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1525
-			the_time( 'F, Y' );
1523
+		} else if (is_month()) {
1524
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1525
+			the_time('F, Y');
1526 1526
 			$breadcrumb .= '</li>';
1527
-		} else if ( is_year() ) {
1528
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1529
-			the_time( 'Y' );
1527
+		} else if (is_year()) {
1528
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1529
+			the_time('Y');
1530 1530
 			$breadcrumb .= '</li>';
1531
-		} else if ( is_author() ) {
1532
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1531
+		} else if (is_author()) {
1532
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1533 1533
 			$breadcrumb .= '</li>';
1534
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1535
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1534
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1535
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1536 1536
 			$breadcrumb .= '</li>';
1537
-		} else if ( is_search() ) {
1538
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1537
+		} else if (is_search()) {
1538
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1539 1539
 			$breadcrumb .= '</li>';
1540 1540
 		}
1541 1541
 		$breadcrumb .= '</ul></div>';
@@ -1548,13 +1548,13 @@  discard block
 block discarded – undo
1548 1548
 		 * @param string $breadcrumb Breadcrumb HTML.
1549 1549
 		 * @param string $separator  Breadcrumb separator.
1550 1550
 		 */
1551
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1551
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1552 1552
 	}
1553 1553
 }
1554 1554
 
1555 1555
 
1556
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1557
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1556
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1557
+if (!function_exists('geodir_allow_wpadmin')) {
1558 1558
 	/**
1559 1559
 	 * Allow only admins to access wp-admin.
1560 1560
 	 *
@@ -1566,12 +1566,12 @@  discard block
 block discarded – undo
1566 1566
 	 */
1567 1567
 	function geodir_allow_wpadmin() {
1568 1568
 		global $wpdb;
1569
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1569
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1570 1570
 		{
1571
-			if ( current_user_can( 'administrator' ) ) {
1571
+			if (current_user_can('administrator')) {
1572 1572
 			} else {
1573 1573
 
1574
-				wp_redirect( home_url() );
1574
+				wp_redirect(home_url());
1575 1575
 				exit;
1576 1576
 			}
1577 1577
 
@@ -1590,23 +1590,23 @@  discard block
 block discarded – undo
1590 1590
  *
1591 1591
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1592 1592
  */
1593
-function fetch_remote_file( $url ) {
1593
+function fetch_remote_file($url) {
1594 1594
 	// extract the file name and extension from the url
1595
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1596
-	$file_name = basename( $url );
1597
-	if ( strpos( $file_name, '?' ) !== false ) {
1598
-		list( $file_name ) = explode( '?', $file_name );
1595
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1596
+	$file_name = basename($url);
1597
+	if (strpos($file_name, '?') !== false) {
1598
+		list($file_name) = explode('?', $file_name);
1599 1599
 	}
1600 1600
 	$dummy        = false;
1601 1601
 	$add_to_cache = false;
1602 1602
 	$key          = null;
1603
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1603
+	if (strpos($url, '/dummy/') !== false) {
1604 1604
 		$dummy = true;
1605
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1606
-		$value = get_transient( 'cached_dummy_images' );
1607
-		if ( $value ) {
1608
-			if ( isset( $value[ $key ] ) ) {
1609
-				return $value[ $key ];
1605
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1606
+		$value = get_transient('cached_dummy_images');
1607
+		if ($value) {
1608
+			if (isset($value[$key])) {
1609
+				return $value[$key];
1610 1610
 			} else {
1611 1611
 				$add_to_cache = true;
1612 1612
 			}
@@ -1617,58 +1617,58 @@  discard block
 block discarded – undo
1617 1617
 
1618 1618
 	// get placeholder file in the upload dir with a unique, sanitized filename
1619 1619
 
1620
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1620
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1621 1621
 
1622
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1623
-	if ( $upload['error'] ) {
1624
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1622
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1623
+	if ($upload['error']) {
1624
+		return new WP_Error('upload_dir_error', $upload['error']);
1625 1625
 	}
1626 1626
 
1627 1627
 
1628
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1628
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1629 1629
 
1630 1630
 	// fetch the remote url and write it to the placeholder file
1631
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1631
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1632 1632
 
1633 1633
 	$log_message = '';
1634
-	if ( is_wp_error( $headers ) ) {
1635
-		echo 'file: ' . $url;
1634
+	if (is_wp_error($headers)) {
1635
+		echo 'file: '.$url;
1636 1636
 
1637
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1637
+		return new WP_Error('import_file_error', $headers->get_error_message());
1638 1638
 	}
1639 1639
 
1640
-	$filesize = filesize( $upload['file'] );
1640
+	$filesize = filesize($upload['file']);
1641 1641
 	// request failed
1642
-	if ( ! $headers ) {
1643
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1642
+	if (!$headers) {
1643
+		$log_message = __('Remote server did not respond', 'geodirectory');
1644 1644
 	} // make sure the fetch was successful
1645
-	elseif ( $headers['response']['code'] != '200' ) {
1646
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1647
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1648
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1649
-	} elseif ( 0 == $filesize ) {
1650
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1651
-	}
1652
-
1653
-	if ( $log_message ) {
1654
-		$del = unlink( $upload['file'] );
1655
-		if ( ! $del ) {
1656
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1645
+	elseif ($headers['response']['code'] != '200') {
1646
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1647
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1648
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1649
+	} elseif (0 == $filesize) {
1650
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1651
+	}
1652
+
1653
+	if ($log_message) {
1654
+		$del = unlink($upload['file']);
1655
+		if (!$del) {
1656
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1657 1657
 		}
1658 1658
 
1659
-		return new WP_Error( 'import_file_error', $log_message );
1659
+		return new WP_Error('import_file_error', $log_message);
1660 1660
 	}
1661 1661
 
1662
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1663
-		$images = get_transient( 'cached_dummy_images' );
1664
-		if ( is_array( $images ) ) {
1665
-			$images[ $key ] = $upload;
1662
+	if ($dummy && $add_to_cache && is_array($upload)) {
1663
+		$images = get_transient('cached_dummy_images');
1664
+		if (is_array($images)) {
1665
+			$images[$key] = $upload;
1666 1666
 		} else {
1667
-			$images = array( $key => $upload );
1667
+			$images = array($key => $upload);
1668 1668
 		}
1669 1669
 
1670 1670
 		//setting the cache using the WP Transient API
1671
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1671
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1672 1672
 	}
1673 1673
 
1674 1674
 	return $upload;
@@ -1682,12 +1682,12 @@  discard block
 block discarded – undo
1682 1682
  * @return string|void Max upload size.
1683 1683
  */
1684 1684
 function geodir_max_upload_size() {
1685
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1685
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1686 1686
 
1687
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1688
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1687
+	if ($max_filesize > 0 && $max_filesize < 1) {
1688
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1689 1689
 	} else {
1690
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1690
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1691 1691
 	}
1692 1692
 
1693 1693
 	/**
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 	 *
1698 1698
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1699 1699
 	 */
1700
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1700
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1701 1701
 }
1702 1702
 
1703 1703
 /**
@@ -1710,8 +1710,8 @@  discard block
 block discarded – undo
1710 1710
  * @return bool If dummy folder exists returns true, else false.
1711 1711
  */
1712 1712
 function geodir_dummy_folder_exists() {
1713
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1714
-	if ( ! is_dir( $path ) ) {
1713
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1714
+	if (!is_dir($path)) {
1715 1715
 		return false;
1716 1716
 	} else {
1717 1717
 		return true;
@@ -1730,17 +1730,17 @@  discard block
 block discarded – undo
1730 1730
  *
1731 1731
  * @return object Author info.
1732 1732
  */
1733
-function geodir_get_author_info( $aid ) {
1733
+function geodir_get_author_info($aid) {
1734 1734
 	global $wpdb;
1735 1735
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1736
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1737
-	$info    = $wpdb->get_results( $infosql );
1738
-	if ( $info ) {
1736
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1737
+	$info    = $wpdb->get_results($infosql);
1738
+	if ($info) {
1739 1739
 		return $info[0];
1740 1740
 	}
1741 1741
 }
1742 1742
 
1743
-if ( ! function_exists( 'adminEmail' ) ) {
1743
+if (!function_exists('adminEmail')) {
1744 1744
 	/**
1745 1745
 	 * Send emails to client on post submission, renew etc.
1746 1746
 	 *
@@ -1753,67 +1753,67 @@  discard block
 block discarded – undo
1753 1753
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1754 1754
 	 * @param string $custom_1     Custom data to be sent.
1755 1755
 	 */
1756
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1756
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1757 1757
 		global $wpdb;
1758
-		if ( $message_type == 'expiration' ) {
1759
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1760
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1761
-		} elseif ( $message_type == 'post_submited' ) {
1762
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1763
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1764
-		} elseif ( $message_type == 'renew' ) {
1765
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1766
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1767
-		} elseif ( $message_type == 'upgrade' ) {
1768
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1769
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1770
-		} elseif ( $message_type == 'claim_approved' ) {
1771
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1772
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1773
-		} elseif ( $message_type == 'claim_rejected' ) {
1774
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1775
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1776
-		} elseif ( $message_type == 'claim_requested' ) {
1777
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1778
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1779
-		} elseif ( $message_type == 'auto_claim' ) {
1780
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1781
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1782
-		} elseif ( $message_type == 'payment_success' ) {
1783
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1784
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1785
-		} elseif ( $message_type == 'payment_fail' ) {
1786
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1787
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1758
+		if ($message_type == 'expiration') {
1759
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1760
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1761
+		} elseif ($message_type == 'post_submited') {
1762
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1763
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1764
+		} elseif ($message_type == 'renew') {
1765
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1766
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1767
+		} elseif ($message_type == 'upgrade') {
1768
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1769
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1770
+		} elseif ($message_type == 'claim_approved') {
1771
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1772
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1773
+		} elseif ($message_type == 'claim_rejected') {
1774
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1775
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1776
+		} elseif ($message_type == 'claim_requested') {
1777
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1778
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1779
+		} elseif ($message_type == 'auto_claim') {
1780
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1781
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1782
+		} elseif ($message_type == 'payment_success') {
1783
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1784
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1785
+		} elseif ($message_type == 'payment_fail') {
1786
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1787
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1788 1788
 		}
1789 1789
 		$transaction_details = $custom_1;
1790
-		$fromEmail           = get_option( 'site_email' );
1790
+		$fromEmail           = get_option('site_email');
1791 1791
 		$fromEmailName       = get_site_emailName();
1792 1792
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1793
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1793
+		$pkg_limit            = get_property_price_info_listing($page_id);
1794 1794
 		$alivedays            = $pkg_limit['days'];
1795
-		$productlink          = get_permalink( $page_id );
1796
-		$post_info            = get_post( $page_id );
1797
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1798
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1795
+		$productlink          = get_permalink($page_id);
1796
+		$post_info            = get_post($page_id);
1797
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1798
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1799 1799
 		$loginurl             = geodir_login_url();
1800
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1800
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1801 1801
 		$siteurl              = home_url();
1802
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1803
-		$user_info            = get_userdata( $user_id );
1802
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1803
+		$user_info            = get_userdata($user_id);
1804 1804
 		$user_email           = $user_info->user_email;
1805
-		$display_name         = geodir_get_client_name( $user_id );
1805
+		$display_name         = geodir_get_client_name($user_id);
1806 1806
 		$user_login           = $user_info->user_login;
1807
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1808
-		if ( $number_of_grace_days == '' ) {
1807
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1808
+		if ($number_of_grace_days == '') {
1809 1809
 			$number_of_grace_days = 1;
1810 1810
 		}
1811
-		if ( $post_info->post_type == 'event' ) {
1811
+		if ($post_info->post_type == 'event') {
1812 1812
 			$post_type = 'event';
1813 1813
 		} else {
1814 1814
 			$post_type = 'listing';
1815 1815
 		}
1816
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1816
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1817 1817
 		$search_array   = array(
1818 1818
 			'[#client_name#]',
1819 1819
 			'[#listing_link#]',
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
 			'[#site_name#]',
1830 1830
 			'[#transaction_details#]'
1831 1831
 		);
1832
-		$replace_array  = array(
1832
+		$replace_array = array(
1833 1833
 			$display_name,
1834 1834
 			$listingLink,
1835 1835
 			$post_date,
@@ -1844,13 +1844,13 @@  discard block
 block discarded – undo
1844 1844
 			$fromEmailName,
1845 1845
 			$transaction_details
1846 1846
 		);
1847
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1848
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1847
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1848
+		$subject        = str_replace($search_array, $replace_array, $subject);
1849 1849
 		
1850 1850
 		
1851
-		$headers  = array();
1851
+		$headers = array();
1852 1852
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
1853
-		$headers[] = 'From: ' . $fromEmailName . ' <' . $fromEmail . '>';
1853
+		$headers[] = 'From: '.$fromEmailName.' <'.$fromEmail.'>';
1854 1854
 
1855 1855
 		$to      = $fromEmail;
1856 1856
 		$message = $client_message;
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1869 1869
 		 * @param string $custom_1     Custom data to be sent.
1870 1870
 		 */
1871
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1871
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1872 1872
 		/**
1873 1873
 		 * Filter the admin email subject.
1874 1874
 		 *
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1882 1882
 		 * @param string $custom_1     Custom data to be sent.
1883 1883
 		 */
1884
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1884
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1885 1885
 		/**
1886 1886
 		 * Filter the admin email message.
1887 1887
 		 *
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1895 1895
 		 * @param string $custom_1     Custom data to be sent.
1896 1896
 		 */
1897
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1897
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1898 1898
 		/**
1899 1899
 		 * Filter the admin email headers.
1900 1900
 		 *
@@ -1907,22 +1907,22 @@  discard block
 block discarded – undo
1907 1907
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1908 1908
 		 * @param string $custom_1     Custom data to be sent.
1909 1909
 		 */
1910
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1910
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1911 1911
 
1912 1912
 
1913
-		$sent = wp_mail( $to, $subject, $message, $headers );
1914
-		if ( ! $sent ) {
1915
-			if ( is_array( $to ) ) {
1916
-				$to = implode( ',', $to );
1913
+		$sent = wp_mail($to, $subject, $message, $headers);
1914
+		if (!$sent) {
1915
+			if (is_array($to)) {
1916
+				$to = implode(',', $to);
1917 1917
 			}
1918 1918
 			$log_message = sprintf(
1919
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1919
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1920 1920
 				$message_type,
1921
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1921
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1922 1922
 				$to,
1923 1923
 				$subject
1924 1924
 			);
1925
-			geodir_error_log( $log_message );
1925
+			geodir_error_log($log_message);
1926 1926
 		}
1927 1927
 	}
1928 1928
 }
@@ -1942,12 +1942,12 @@  discard block
 block discarded – undo
1942 1942
  *
1943 1943
  * @return array Category IDs.
1944 1944
  */
1945
-function gd_lang_object_ids( $ids_array, $type ) {
1946
-	if ( function_exists( 'icl_object_id' ) ) {
1945
+function gd_lang_object_ids($ids_array, $type) {
1946
+	if (function_exists('icl_object_id')) {
1947 1947
 		$res = array();
1948
-		foreach ( $ids_array as $id ) {
1949
-			$xlat = icl_object_id( $id, $type, false );
1950
-			if ( ! is_null( $xlat ) ) {
1948
+		foreach ($ids_array as $id) {
1949
+			$xlat = icl_object_id($id, $type, false);
1950
+			if (!is_null($xlat)) {
1951 1951
 				$res[] = $xlat;
1952 1952
 			}
1953 1953
 		}
@@ -1971,20 +1971,20 @@  discard block
 block discarded – undo
1971 1971
  *
1972 1972
  * @return array Modified Body CSS classes.
1973 1973
  */
1974
-function geodir_custom_posts_body_class( $classes ) {
1974
+function geodir_custom_posts_body_class($classes) {
1975 1975
 	global $wpdb, $wp;
1976
-	$post_types = geodir_get_posttypes( 'object' );
1977
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
1976
+	$post_types = geodir_get_posttypes('object');
1977
+	if (!empty($post_types) && count((array) $post_types) > 1) {
1978 1978
 		$classes[] = 'geodir_custom_posts';
1979 1979
 	}
1980 1980
 
1981 1981
 	// fix body class for signup page
1982
-	if ( geodir_is_page( 'login' ) ) {
1982
+	if (geodir_is_page('login')) {
1983 1983
 		$new_classes   = array();
1984 1984
 		$new_classes[] = 'signup page-geodir-signup';
1985
-		if ( ! empty( $classes ) ) {
1986
-			foreach ( $classes as $class ) {
1987
-				if ( $class && $class != 'home' && $class != 'blog' ) {
1985
+		if (!empty($classes)) {
1986
+			foreach ($classes as $class) {
1987
+				if ($class && $class != 'home' && $class != 'blog') {
1988 1988
 					$new_classes[] = $class;
1989 1989
 				}
1990 1990
 			}
@@ -1992,14 +1992,14 @@  discard block
 block discarded – undo
1992 1992
 		$classes = $new_classes;
1993 1993
 	}
1994 1994
 
1995
-	if ( geodir_is_geodir_page() ) {
1995
+	if (geodir_is_geodir_page()) {
1996 1996
 		$classes[] = 'geodir-page';
1997 1997
 	}
1998 1998
 
1999 1999
 	return $classes;
2000 2000
 }
2001 2001
 
2002
-add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search
2002
+add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
2003 2003
 
2004 2004
 
2005 2005
 /**
@@ -2015,7 +2015,7 @@  discard block
 block discarded – undo
2015 2015
 	 *
2016 2016
 	 * @since 1.0.0
2017 2017
 	 */
2018
-	return apply_filters( 'geodir_map_zoom_level', array(
2018
+	return apply_filters('geodir_map_zoom_level', array(
2019 2019
 		1,
2020 2020
 		2,
2021 2021
 		3,
@@ -2035,7 +2035,7 @@  discard block
 block discarded – undo
2035 2035
 		17,
2036 2036
 		18,
2037 2037
 		19
2038
-	) );
2038
+	));
2039 2039
 
2040 2040
 }
2041 2041
 
@@ -2048,12 +2048,12 @@  discard block
 block discarded – undo
2048 2048
  *
2049 2049
  * @param string $geodir_option_name Option key.
2050 2050
  */
2051
-function geodir_option_version_backup( $geodir_option_name ) {
2051
+function geodir_option_version_backup($geodir_option_name) {
2052 2052
 	$version_date  = time();
2053
-	$geodir_option = get_option( $geodir_option_name );
2053
+	$geodir_option = get_option($geodir_option_name);
2054 2054
 
2055
-	if ( ! empty( $geodir_option ) ) {
2056
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2055
+	if (!empty($geodir_option)) {
2056
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2057 2057
 	}
2058 2058
 }
2059 2059
 
@@ -2067,10 +2067,10 @@  discard block
 block discarded – undo
2067 2067
  *
2068 2068
  * @return int Page ID.
2069 2069
  */
2070
-function get_page_id_geodir_add_listing_page( $page_id ) {
2071
-	if ( geodir_wpml_multilingual_status() ) {
2070
+function get_page_id_geodir_add_listing_page($page_id) {
2071
+	if (geodir_wpml_multilingual_status()) {
2072 2072
 		$post_type = 'post_page';
2073
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2073
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2074 2074
 	}
2075 2075
 
2076 2076
 	return $page_id;
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2085 2085
  */
2086 2086
 function geodir_wpml_multilingual_status() {
2087
-	if ( function_exists( 'icl_object_id' ) ) {
2087
+	if (function_exists('icl_object_id')) {
2088 2088
 		return true;
2089 2089
 	}
2090 2090
 
@@ -2102,19 +2102,19 @@  discard block
 block discarded – undo
2102 2102
  *
2103 2103
  * @return int Element ID when exists. Else the page id.
2104 2104
  */
2105
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2105
+function geodir_get_wpml_element_id($page_id, $post_type) {
2106 2106
 	global $sitepress;
2107
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2108
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2107
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2108
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2109 2109
 
2110
-		if ( $trid > 0 ) {
2111
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2110
+		if ($trid > 0) {
2111
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2112 2112
 
2113 2113
 			$lang = $sitepress->get_current_language();
2114 2114
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2115 2115
 
2116
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2117
-				$page_id = $translations[ $lang ]->element_id;
2116
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2117
+				$page_id = $translations[$lang]->element_id;
2118 2118
 			}
2119 2119
 		}
2120 2120
 	}
@@ -2131,15 +2131,15 @@  discard block
 block discarded – undo
2131 2131
  */
2132 2132
 function geodir_wpml_check_element_id() {
2133 2133
 	global $sitepress;
2134
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2134
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2135 2135
 		$el_type      = 'post_page';
2136
-		$el_id        = get_option( 'geodir_add_listing_page' );
2136
+		$el_id        = get_option('geodir_add_listing_page');
2137 2137
 		$default_lang = $sitepress->get_default_language();
2138
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2138
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2139 2139
 
2140
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2141
-			if ( ! $el_details->source_language_code ) {
2142
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2140
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2141
+			if (!$el_details->source_language_code) {
2142
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2143 2143
 				$sitepress->icl_translations_cache->clear();
2144 2144
 			}
2145 2145
 		}
@@ -2158,41 +2158,41 @@  discard block
 block discarded – undo
2158 2158
  *
2159 2159
  * @return string Orderby SQL.
2160 2160
  */
2161
-function geodir_widget_listings_get_order( $query_args ) {
2161
+function geodir_widget_listings_get_order($query_args) {
2162 2162
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2163 2163
 
2164 2164
 	$query_args = $gd_query_args_widgets;
2165
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2166
-		return $wpdb->posts . ".post_date DESC, ";
2165
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2166
+		return $wpdb->posts.".post_date DESC, ";
2167 2167
 	}
2168 2168
 
2169
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2170
-	$table     = $plugin_prefix . $post_type . '_detail';
2169
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2170
+	$table     = $plugin_prefix.$post_type.'_detail';
2171 2171
 
2172
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2172
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2173 2173
 
2174
-	switch ( $sort_by ) {
2174
+	switch ($sort_by) {
2175 2175
 		case 'latest':
2176 2176
 		case 'newest':
2177
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2177
+			$orderby = $wpdb->posts.".post_date DESC, ";
2178 2178
 			break;
2179 2179
 		case 'featured':
2180
-			$orderby = $table . ".is_featured ASC, ";
2180
+			$orderby = $table.".is_featured ASC, ";
2181 2181
 			break;
2182 2182
 		case 'az':
2183
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2183
+			$orderby = $wpdb->posts.".post_title ASC, ";
2184 2184
 			break;
2185 2185
 		case 'high_review':
2186
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2186
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2187 2187
 			break;
2188 2188
 		case 'high_rating':
2189
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2189
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2190 2190
 			break;
2191 2191
 		case 'random':
2192 2192
 			$orderby = "RAND(), ";
2193 2193
 			break;
2194 2194
 		default:
2195
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2195
+			$orderby = $wpdb->posts.".post_title ASC, ";
2196 2196
 			break;
2197 2197
 	}
2198 2198
 
@@ -2215,15 +2215,15 @@  discard block
 block discarded – undo
2215 2215
  *
2216 2216
  * @return mixed Result object.
2217 2217
  */
2218
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2218
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2219 2219
 	global $wpdb, $plugin_prefix, $table_prefix;
2220 2220
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2221 2221
 	$gd_query_args_widgets            = $query_args;
2222 2222
 
2223
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2224
-	$table     = $plugin_prefix . $post_type . '_detail';
2223
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2224
+	$table     = $plugin_prefix.$post_type.'_detail';
2225 2225
 
2226
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2226
+	$fields = $wpdb->posts.".*, ".$table.".*";
2227 2227
 	/**
2228 2228
 	 * Filter widget listing fields string part that is being used for query.
2229 2229
 	 *
@@ -2233,17 +2233,17 @@  discard block
 block discarded – undo
2233 2233
 	 * @param string $table     Table name.
2234 2234
 	 * @param string $post_type Post type.
2235 2235
 	 */
2236
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2236
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2237 2237
 
2238
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2238
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2239 2239
 
2240 2240
 	########### WPML ###########
2241 2241
 
2242
-	if ( function_exists( 'icl_object_id' ) ) {
2242
+	if (function_exists('icl_object_id')) {
2243 2243
 		global $sitepress;
2244 2244
 		$lang_code = ICL_LANGUAGE_CODE;
2245
-		if ( $lang_code ) {
2246
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2245
+		if ($lang_code) {
2246
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2247 2247
 		}
2248 2248
 	}
2249 2249
 
@@ -2257,15 +2257,15 @@  discard block
 block discarded – undo
2257 2257
 	 * @param string $join      Join clause string.
2258 2258
 	 * @param string $post_type Post type.
2259 2259
 	 */
2260
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2260
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2261 2261
 
2262
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2262
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2263 2263
 
2264
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2264
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2265 2265
 
2266 2266
 	########### WPML ###########
2267
-	if ( function_exists( 'icl_object_id' ) ) {
2268
-		if ( $lang_code ) {
2267
+	if (function_exists('icl_object_id')) {
2268
+		if ($lang_code) {
2269 2269
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2270 2270
 		}
2271 2271
 	}
@@ -2278,8 +2278,8 @@  discard block
 block discarded – undo
2278 2278
 	 * @param string $where     Where clause string.
2279 2279
 	 * @param string $post_type Post type.
2280 2280
 	 */
2281
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2282
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2281
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2282
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2283 2283
 
2284 2284
 	$groupby = " GROUP BY $wpdb->posts.ID ";
2285 2285
 	/**
@@ -2290,15 +2290,15 @@  discard block
 block discarded – undo
2290 2290
 	 * @param string $groupby   Group by clause string.
2291 2291
 	 * @param string $post_type Post type.
2292 2292
 	 */
2293
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2293
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2294 2294
 
2295
-	if ( $count_only ) {
2296
-		$sql  = "SELECT COUNT(DISTINCT " . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2297
-			" . $join . "
2295
+	if ($count_only) {
2296
+		$sql  = "SELECT COUNT(DISTINCT ".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2297
+			" . $join."
2298 2298
 			" . $where;
2299
-		$rows = (int) $wpdb->get_var( $sql );
2299
+		$rows = (int) $wpdb->get_var($sql);
2300 2300
 	} else {
2301
-		$orderby = geodir_widget_listings_get_order( $query_args );
2301
+		$orderby = geodir_widget_listings_get_order($query_args);
2302 2302
 		/**
2303 2303
 		 * Filter widget listing orderby clause string part that is being used for query.
2304 2304
 		 *
@@ -2308,11 +2308,11 @@  discard block
 block discarded – undo
2308 2308
 		 * @param string $table     Table name.
2309 2309
 		 * @param string $post_type Post type.
2310 2310
 		 */
2311
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2312
-		$orderby .= $wpdb->posts . ".post_title ASC";
2313
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2311
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2312
+		$orderby .= $wpdb->posts.".post_title ASC";
2313
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2314 2314
 
2315
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2315
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2316 2316
 		/**
2317 2317
 		 * Filter widget listing limit that is being used for query.
2318 2318
 		 *
@@ -2321,26 +2321,26 @@  discard block
 block discarded – undo
2321 2321
 		 * @param int $limit        Query results limit.
2322 2322
 		 * @param string $post_type Post type.
2323 2323
 		 */
2324
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2324
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2325 2325
 
2326
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2327
-		if ( ! $page ) {
2326
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2327
+		if (!$page) {
2328 2328
 			$page = 1;
2329 2329
 		}
2330 2330
 
2331
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2331
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2332 2332
 
2333
-		$sql  = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2334
-			" . $join . "
2335
-			" . $where . "
2336
-			" . $groupby . "
2337
-			" . $orderby . "
2333
+		$sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2334
+			" . $join."
2335
+			" . $where."
2336
+			" . $groupby."
2337
+			" . $orderby."
2338 2338
 			" . $limit;
2339
-		$rows = $wpdb->get_results( $sql );
2339
+		$rows = $wpdb->get_results($sql);
2340 2340
 	}
2341 2341
 
2342
-	unset( $GLOBALS['gd_query_args_widgets'] );
2343
-	unset( $gd_query_args_widgets );
2342
+	unset($GLOBALS['gd_query_args_widgets']);
2343
+	unset($gd_query_args_widgets);
2344 2344
 
2345 2345
 	return $rows;
2346 2346
 }
@@ -2357,11 +2357,11 @@  discard block
 block discarded – undo
2357 2357
  *
2358 2358
  * @return string Modified fields SQL.
2359 2359
  */
2360
-function geodir_function_widget_listings_fields( $fields ) {
2360
+function geodir_function_widget_listings_fields($fields) {
2361 2361
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2362 2362
 
2363 2363
 	$query_args = $gd_query_args_widgets;
2364
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2364
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2365 2365
 		return $fields;
2366 2366
 	}
2367 2367
 
@@ -2380,24 +2380,24 @@  discard block
 block discarded – undo
2380 2380
  *
2381 2381
  * @return string Modified join clause SQL.
2382 2382
  */
2383
-function geodir_function_widget_listings_join( $join ) {
2383
+function geodir_function_widget_listings_join($join) {
2384 2384
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2385 2385
 
2386 2386
 	$query_args = $gd_query_args_widgets;
2387
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2387
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2388 2388
 		return $join;
2389 2389
 	}
2390 2390
 
2391
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2392
-	$table     = $plugin_prefix . $post_type . '_detail';
2391
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2392
+	$table     = $plugin_prefix.$post_type.'_detail';
2393 2393
 
2394
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2395
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2394
+	if (!empty($query_args['with_pics_only'])) {
2395
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2396 2396
 	}
2397 2397
 
2398
-	if ( ! empty( $query_args['tax_query'] ) ) {
2399
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2400
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2398
+	if (!empty($query_args['tax_query'])) {
2399
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2400
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2401 2401
 			$join .= $tax_queries['join'];
2402 2402
 		}
2403 2403
 	}
@@ -2417,49 +2417,49 @@  discard block
 block discarded – undo
2417 2417
  *
2418 2418
  * @return string Modified where clause SQL.
2419 2419
  */
2420
-function geodir_function_widget_listings_where( $where ) {
2420
+function geodir_function_widget_listings_where($where) {
2421 2421
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2422 2422
 
2423 2423
 	$query_args = $gd_query_args_widgets;
2424
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2424
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2425 2425
 		return $where;
2426 2426
 	}
2427
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2428
-	$table     = $plugin_prefix . $post_type . '_detail';
2427
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2428
+	$table     = $plugin_prefix.$post_type.'_detail';
2429 2429
 
2430
-	if ( ! empty( $query_args ) ) {
2431
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2432
-			$where = geodir_default_location_where( $where, $table );
2430
+	if (!empty($query_args)) {
2431
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2432
+			$where = geodir_default_location_where($where, $table);
2433 2433
 		}
2434 2434
 
2435
-		if ( ! empty( $query_args['post_author'] ) ) {
2436
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2435
+		if (!empty($query_args['post_author'])) {
2436
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2437 2437
 		}
2438 2438
 
2439
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2440
-			$where .= " AND " . $table . ".is_featured = '1'";
2439
+		if (!empty($query_args['show_featured_only'])) {
2440
+			$where .= " AND ".$table.".is_featured = '1'";
2441 2441
 		}
2442 2442
 
2443
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2444
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2443
+		if (!empty($query_args['show_special_only'])) {
2444
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2445 2445
 		}
2446 2446
 
2447
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2448
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2447
+		if (!empty($query_args['with_pics_only'])) {
2448
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2449 2449
 		}
2450 2450
 
2451
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2452
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2451
+		if (!empty($query_args['featured_image_only'])) {
2452
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2453 2453
 		}
2454 2454
 
2455
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2456
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2455
+		if (!empty($query_args['with_videos_only'])) {
2456
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2457 2457
 		}
2458 2458
 
2459
-		if ( ! empty( $query_args['tax_query'] ) ) {
2460
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2459
+		if (!empty($query_args['tax_query'])) {
2460
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2461 2461
 
2462
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2462
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2463 2463
 				$where .= $tax_queries['where'];
2464 2464
 			}
2465 2465
 		}
@@ -2480,11 +2480,11 @@  discard block
 block discarded – undo
2480 2480
  *
2481 2481
  * @return string Modified orderby clause SQL.
2482 2482
  */
2483
-function geodir_function_widget_listings_orderby( $orderby ) {
2483
+function geodir_function_widget_listings_orderby($orderby) {
2484 2484
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2485 2485
 
2486 2486
 	$query_args = $gd_query_args_widgets;
2487
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2487
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2488 2488
 		return $orderby;
2489 2489
 	}
2490 2490
 
@@ -2503,15 +2503,15 @@  discard block
 block discarded – undo
2503 2503
  *
2504 2504
  * @return int Query limit.
2505 2505
  */
2506
-function geodir_function_widget_listings_limit( $limit ) {
2506
+function geodir_function_widget_listings_limit($limit) {
2507 2507
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2508 2508
 
2509 2509
 	$query_args = $gd_query_args_widgets;
2510
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2510
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2511 2511
 		return $limit;
2512 2512
 	}
2513 2513
 
2514
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2514
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2515 2515
 		$limit = (int) $query_args['posts_per_page'];
2516 2516
 	}
2517 2517
 
@@ -2529,12 +2529,12 @@  discard block
 block discarded – undo
2529 2529
  *
2530 2530
  * @return int Large size width.
2531 2531
  */
2532
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2533
-	$large_size_w = get_option( 'large_size_w' );
2532
+function geodir_media_image_large_width($default = 800, $params = '') {
2533
+	$large_size_w = get_option('large_size_w');
2534 2534
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2535
-	$large_size_w = absint( $large_size_w );
2535
+	$large_size_w = absint($large_size_w);
2536 2536
 
2537
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2537
+	if (!get_option('geodir_use_wp_media_large_size')) {
2538 2538
 		$large_size_w = 800;
2539 2539
 	}
2540 2540
 
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
 	 * @param int $default         Default width.
2548 2548
 	 * @param string|array $params Image parameters.
2549 2549
 	 */
2550
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2550
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2551 2551
 
2552 2552
 	return $large_size_w;
2553 2553
 }
@@ -2563,12 +2563,12 @@  discard block
 block discarded – undo
2563 2563
  *
2564 2564
  * @return int Large size height.
2565 2565
  */
2566
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2567
-	$large_size_h = get_option( 'large_size_h' );
2566
+function geodir_media_image_large_height($default = 800, $params = '') {
2567
+	$large_size_h = get_option('large_size_h');
2568 2568
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2569
-	$large_size_h = absint( $large_size_h );
2569
+	$large_size_h = absint($large_size_h);
2570 2570
 
2571
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2571
+	if (!get_option('geodir_use_wp_media_large_size')) {
2572 2572
 		$large_size_h = 800;
2573 2573
 	}
2574 2574
 
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
 	 * @param int $default         Default height.
2582 2582
 	 * @param string|array $params Image parameters.
2583 2583
 	 */
2584
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2584
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2585 2585
 
2586 2586
 	return $large_size_h;
2587 2587
 }
@@ -2598,8 +2598,8 @@  discard block
 block discarded – undo
2598 2598
  *
2599 2599
  * @return string Sanitized name.
2600 2600
  */
2601
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2602
-	if ( $name == '' ) {
2601
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2602
+	if ($name == '') {
2603 2603
 		return null;
2604 2604
 	}
2605 2605
 
@@ -2608,13 +2608,13 @@  discard block
 block discarded – undo
2608 2608
 	$type = $type == 'gd_city' ? 'city' : $type;
2609 2609
 
2610 2610
 	$return = $name;
2611
-	if ( function_exists( 'get_actual_location_name' ) ) {
2612
-		$return = get_actual_location_name( $type, $name, $translate );
2611
+	if (function_exists('get_actual_location_name')) {
2612
+		$return = get_actual_location_name($type, $name, $translate);
2613 2613
 	} else {
2614
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2615
-		$return = preg_replace( '/[_-]/', ' ', $return );
2616
-		$return = geodir_ucwords( $return );
2617
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2614
+		$return = preg_replace('/-(\d+)$/', '', $return);
2615
+		$return = preg_replace('/[_-]/', ' ', $return);
2616
+		$return = geodir_ucwords($return);
2617
+		$return = $translate ? __($return, 'geodirectory') : $return;
2618 2618
 	}
2619 2619
 
2620 2620
 	return $return;
@@ -2629,14 +2629,14 @@  discard block
 block discarded – undo
2629 2629
  *
2630 2630
  * @param int $number Comments number.
2631 2631
  */
2632
-function geodir_comments_number( $number ) {
2632
+function geodir_comments_number($number) {
2633 2633
 
2634
-	if ( $number > 1 ) {
2635
-		$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2636
-	} elseif ( $number == 0 || $number == '' ) {
2637
-		$output = __( 'No Reviews', 'geodirectory' );
2634
+	if ($number > 1) {
2635
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2636
+	} elseif ($number == 0 || $number == '') {
2637
+		$output = __('No Reviews', 'geodirectory');
2638 2638
 	} else { // must be one
2639
-		$output = __( '1 Review', 'geodirectory' );
2639
+		$output = __('1 Review', 'geodirectory');
2640 2640
 	}
2641 2641
 	echo $output;
2642 2642
 }
@@ -2651,18 +2651,18 @@  discard block
 block discarded – undo
2651 2651
  */
2652 2652
 function is_page_geodir_home() {
2653 2653
 	global $wpdb;
2654
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2655
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2656
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2654
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2655
+	if (function_exists('geodir_location_geo_home_link')) {
2656
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2657 2657
 	}
2658
-	$home_url = home_url( '', 'http' );
2659
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2660
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2658
+	$home_url = home_url('', 'http');
2659
+	if (function_exists('geodir_location_geo_home_link')) {
2660
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2661 2661
 	}
2662
-	$home_url = str_replace( "www.", "", $home_url );
2663
-	if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) {
2662
+	$home_url = str_replace("www.", "", $home_url);
2663
+	if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2664 2664
 		return true;
2665
-	} elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) {
2665
+	} elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2666 2666
 		return true;
2667 2667
 	} else {
2668 2668
 		return false;
@@ -2682,18 +2682,18 @@  discard block
 block discarded – undo
2682 2682
  *
2683 2683
  * @return string The canonical URL.
2684 2684
  */
2685
-function geodir_wpseo_homepage_canonical( $url ) {
2685
+function geodir_wpseo_homepage_canonical($url) {
2686 2686
 	global $post;
2687 2687
 
2688
-	if ( is_page_geodir_home() ) {
2688
+	if (is_page_geodir_home()) {
2689 2689
 		return home_url();
2690 2690
 	}
2691 2691
 
2692 2692
 	return $url;
2693 2693
 }
2694 2694
 
2695
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2696
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2695
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2696
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2697 2697
 
2698 2698
 /**
2699 2699
  * Add extra fields to google maps script call.
@@ -2706,20 +2706,20 @@  discard block
 block discarded – undo
2706 2706
  *
2707 2707
  * @return string Modified extra string.
2708 2708
  */
2709
-function geodir_googlemap_script_extra_details_page( $extra ) {
2709
+function geodir_googlemap_script_extra_details_page($extra) {
2710 2710
 	global $post;
2711 2711
 	$add_google_places_api = false;
2712
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2712
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2713 2713
 		$add_google_places_api = true;
2714 2714
 	}
2715
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2715
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2716 2716
 		$extra .= "&amp;libraries=places";
2717 2717
 	}
2718 2718
 
2719 2719
 	return $extra;
2720 2720
 }
2721 2721
 
2722
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2722
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2723 2723
 
2724 2724
 
2725 2725
 /**
@@ -2737,99 +2737,99 @@  discard block
 block discarded – undo
2737 2737
  *                                          after_widget.
2738 2738
  * @param array|string $instance            The settings for the particular instance of the widget.
2739 2739
  */
2740
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2740
+function geodir_popular_post_category_output($args = '', $instance = '') {
2741 2741
 	// prints the widget
2742 2742
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2743
-	extract( $args, EXTR_SKIP );
2743
+	extract($args, EXTR_SKIP);
2744 2744
 
2745 2745
 	echo $before_widget;
2746 2746
 
2747 2747
 	/** This filter is documented in geodirectory_widgets.php */
2748
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2748
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2749 2749
 
2750 2750
 	$gd_post_type = geodir_get_current_posttype();
2751 2751
 
2752
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2753
-	if ( ! empty( $gd_post_type ) ) {
2752
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2753
+	if (!empty($gd_post_type)) {
2754 2754
 		$default_post_type = $gd_post_type;
2755
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2755
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2756 2756
 		$default_post_type = $instance['default_post_type'];
2757 2757
 	} else {
2758 2758
 		$all_gd_post_type  = geodir_get_posttypes();
2759
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2759
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2760 2760
 	}
2761
-	$parent_only = !empty( $instance['parent_only'] ) ? true : false;
2761
+	$parent_only = !empty($instance['parent_only']) ? true : false;
2762 2762
 
2763 2763
 	$taxonomy = array();
2764
-	if ( ! empty( $gd_post_type ) ) {
2765
-		$taxonomy[] = $gd_post_type . "category";
2764
+	if (!empty($gd_post_type)) {
2765
+		$taxonomy[] = $gd_post_type."category";
2766 2766
 	} else {
2767
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2767
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2768 2768
 	}
2769 2769
     
2770
-	$term_args = array( 'taxonomy' => $taxonomy );
2771
-	if ( $parent_only ) {
2770
+	$term_args = array('taxonomy' => $taxonomy);
2771
+	if ($parent_only) {
2772 2772
 		$term_args['parent'] = 0;
2773 2773
 	}
2774 2774
 
2775
-	$terms   = get_terms( $term_args );
2775
+	$terms   = get_terms($term_args);
2776 2776
 	$a_terms = array();
2777 2777
 	$b_terms = array();
2778 2778
 
2779
-	foreach ( $terms as $term ) {
2780
-		if ( $term->count > 0 ) {
2781
-			$a_terms[ $term->taxonomy ][] = $term;
2779
+	foreach ($terms as $term) {
2780
+		if ($term->count > 0) {
2781
+			$a_terms[$term->taxonomy][] = $term;
2782 2782
 		}
2783 2783
 	}
2784 2784
 
2785
-	if ( ! empty( $a_terms ) ) {
2786
-		foreach ( $a_terms as $b_key => $b_val ) {
2787
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2785
+	if (!empty($a_terms)) {
2786
+		foreach ($a_terms as $b_key => $b_val) {
2787
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2788 2788
 		}
2789 2789
 
2790
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2790
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2791 2791
 
2792 2792
 		$tax_change_output = '';
2793
-		if ( count( $b_terms ) > 1 ) {
2794
-			$tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2795
-			foreach ( $b_terms as $key => $val ) {
2796
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2797
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2798
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2793
+		if (count($b_terms) > 1) {
2794
+			$tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2795
+			foreach ($b_terms as $key => $val) {
2796
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2797
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2798
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2799 2799
 			}
2800 2800
 			$tax_change_output .= "</select>";
2801 2801
 		}
2802 2802
 
2803
-		if ( ! empty( $b_terms ) ) {
2804
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2805
-			global $cat_count;//make global so we can change via function
2803
+		if (!empty($b_terms)) {
2804
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2805
+			global $cat_count; //make global so we can change via function
2806 2806
 			$cat_count = 0;
2807 2807
 			?>
2808 2808
 			<div class="geodir-category-list-in clearfix">
2809 2809
 				<div class="geodir-cat-list clearfix">
2810 2810
 					<?php
2811
-					echo $before_title . __( $title ) . $after_title;
2811
+					echo $before_title.__($title).$after_title;
2812 2812
 
2813 2813
 					echo $tax_change_output;
2814 2814
 
2815 2815
 					echo '<ul class="geodir-popular-cat-list">';
2816 2816
 
2817
-					geodir_helper_cat_list_output( $terms, $category_limit );
2817
+					geodir_helper_cat_list_output($terms, $category_limit);
2818 2818
 
2819 2819
 					echo '</ul>';
2820 2820
 					?>
2821 2821
 				</div>
2822 2822
 				<?php
2823 2823
 				$hide = '';
2824
-				if ( $cat_count < $category_limit ) {
2824
+				if ($cat_count < $category_limit) {
2825 2825
 					$hide = 'style="display:none;"';
2826 2826
 				}
2827 2827
 				echo "<div class='geodir-cat-list-more' $hide >";
2828
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2829
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2828
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2829
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2830 2830
 				echo "</div>";
2831 2831
 				/* add scripts */
2832
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2832
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2833 2833
 				?>
2834 2834
 			</div>
2835 2835
 			<?php
@@ -2848,25 +2848,25 @@  discard block
 block discarded – undo
2848 2848
  * @param array $terms                      An array of term objects.
2849 2849
  * @param int $category_limit               Number of categories to display by default.
2850 2850
  */
2851
-function geodir_helper_cat_list_output( $terms, $category_limit ) {
2851
+function geodir_helper_cat_list_output($terms, $category_limit) {
2852 2852
 	global $geodir_post_category_str, $cat_count;
2853 2853
 	$term_icons = geodir_get_term_icon();
2854 2854
 
2855 2855
 	$geodir_post_category_str = array();
2856 2856
 
2857 2857
 
2858
-	foreach ( $terms as $cat ) {
2859
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
2860
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
2858
+	foreach ($terms as $cat) {
2859
+		$post_type     = str_replace("category", "", $cat->taxonomy);
2860
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2861 2861
 
2862
-		$cat_count ++;
2862
+		$cat_count++;
2863 2863
 
2864
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
2864
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2865 2865
 
2866 2866
 		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2867 2867
 		$total_post = $cat->count;
2868 2868
 
2869
-		$term_link = get_term_link( $cat, $cat->taxonomy );
2869
+		$term_link = get_term_link($cat, $cat->taxonomy);
2870 2870
 		/**
2871 2871
 		 * Filer the category term link.
2872 2872
 		 *
@@ -2876,11 +2876,11 @@  discard block
 block discarded – undo
2876 2876
 		 * @param int $cat          ->term_id The term id.
2877 2877
 		 * @param string $post_type Wordpress post type.
2878 2878
 		 */
2879
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2879
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2880 2880
 
2881
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2882
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
2883
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2881
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2882
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
2883
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
2884 2884
 		echo '</a></li>';
2885 2885
 	}
2886 2886
 }
@@ -2895,14 +2895,14 @@  discard block
 block discarded – undo
2895 2895
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
2896 2896
  * @param array|string $instance The settings for the particular instance of the widget.
2897 2897
  */
2898
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
2898
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
2899 2899
 	// prints the widget
2900
-	extract( $args, EXTR_SKIP );
2900
+	extract($args, EXTR_SKIP);
2901 2901
 
2902 2902
 	echo $before_widget;
2903 2903
 
2904 2904
 	/** This filter is documented in geodirectory_widgets.php */
2905
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2905
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2906 2906
 	/**
2907 2907
 	 * Filter the widget post type.
2908 2908
 	 *
@@ -2910,7 +2910,7 @@  discard block
 block discarded – undo
2910 2910
 	 *
2911 2911
 	 * @param string $instance ['post_type'] Post type of listing.
2912 2912
 	 */
2913
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
2913
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2914 2914
 	/**
2915 2915
 	 * Filter the widget's term.
2916 2916
 	 *
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
 	 *
2919 2919
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
2920 2920
 	 */
2921
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
2921
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2922 2922
 	/**
2923 2923
 	 * Filter widget's "add_location_filter" value.
2924 2924
 	 *
@@ -2926,7 +2926,7 @@  discard block
 block discarded – undo
2926 2926
 	 *
2927 2927
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2928 2928
 	 */
2929
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
2929
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
2930 2930
 	/**
2931 2931
 	 * Filter the widget listings limit.
2932 2932
 	 *
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
 	 *
2935 2935
 	 * @param string $instance ['post_number'] Number of listings to display.
2936 2936
 	 */
2937
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
2937
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2938 2938
 	/**
2939 2939
 	 * Filter the widget listings limit shown at one time.
2940 2940
 	 *
@@ -2942,7 +2942,7 @@  discard block
 block discarded – undo
2942 2942
 	 *
2943 2943
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
2944 2944
 	 */
2945
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
2945
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2946 2946
 	/**
2947 2947
 	 * Filter the widget slide width.
2948 2948
 	 *
@@ -2950,7 +2950,7 @@  discard block
 block discarded – undo
2950 2950
 	 *
2951 2951
 	 * @param string $instance ['slide_width'] Width of the slides shown.
2952 2952
 	 */
2953
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
2953
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2954 2954
 	/**
2955 2955
 	 * Filter widget's "show title" value.
2956 2956
 	 *
@@ -2958,7 +2958,7 @@  discard block
 block discarded – undo
2958 2958
 	 *
2959 2959
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
2960 2960
 	 */
2961
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
2961
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2962 2962
 	/**
2963 2963
 	 * Filter widget's "slideshow" value.
2964 2964
 	 *
@@ -2966,7 +2966,7 @@  discard block
 block discarded – undo
2966 2966
 	 *
2967 2967
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
2968 2968
 	 */
2969
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
2969
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2970 2970
 	/**
2971 2971
 	 * Filter widget's "animationLoop" value.
2972 2972
 	 *
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
 	 *
2975 2975
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
2976 2976
 	 */
2977
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
2977
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2978 2978
 	/**
2979 2979
 	 * Filter widget's "directionNav" value.
2980 2980
 	 *
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
 	 *
2983 2983
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2984 2984
 	 */
2985
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
2985
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2986 2986
 	/**
2987 2987
 	 * Filter widget's "slideshowSpeed" value.
2988 2988
 	 *
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
 	 *
2991 2991
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2992 2992
 	 */
2993
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
2993
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2994 2994
 	/**
2995 2995
 	 * Filter widget's "animationSpeed" value.
2996 2996
 	 *
@@ -2998,7 +2998,7 @@  discard block
 block discarded – undo
2998 2998
 	 *
2999 2999
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3000 3000
 	 */
3001
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3001
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3002 3002
 	/**
3003 3003
 	 * Filter widget's "animation" value.
3004 3004
 	 *
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
 	 *
3007 3007
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3008 3008
 	 */
3009
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3009
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3010 3010
 	/**
3011 3011
 	 * Filter widget's "list_sort" type.
3012 3012
 	 *
@@ -3014,10 +3014,10 @@  discard block
 block discarded – undo
3014 3014
 	 *
3015 3015
 	 * @param string $instance ['list_sort'] Listing sort by type.
3016 3016
 	 */
3017
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3018
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3017
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3018
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3019 3019
 
3020
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3020
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3021 3021
 	?>
3022 3022
 	<script type="text/javascript">
3023 3023
 		jQuery(window).load(function () {
@@ -3035,23 +3035,23 @@  discard block
 block discarded – undo
3035 3035
 				itemWidth: 75,
3036 3036
 				itemMargin: 5,
3037 3037
 				asNavFor: '#geodir_widget_slider',
3038
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3038
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3039 3039
 			});
3040 3040
 
3041 3041
 			jQuery('#geodir_widget_slider').flexslider({
3042
-				animation: "<?php echo $animation;?>",
3042
+				animation: "<?php echo $animation; ?>",
3043 3043
 				selector: ".geodir-slides > li",
3044 3044
 				namespace: "geodir-",
3045 3045
 				controlNav: true,
3046
-				animationLoop: <?php echo $animationLoop;?>,
3047
-				slideshow: <?php echo $slideshow;?>,
3048
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3049
-				animationSpeed: <?php echo $animationSpeed;?>,
3050
-				directionNav: <?php echo $directionNav;?>,
3051
-				maxItems: <?php echo $max_show;?>,
3046
+				animationLoop: <?php echo $animationLoop; ?>,
3047
+				slideshow: <?php echo $slideshow; ?>,
3048
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3049
+				animationSpeed: <?php echo $animationSpeed; ?>,
3050
+				directionNav: <?php echo $directionNav; ?>,
3051
+				maxItems: <?php echo $max_show; ?>,
3052 3052
 				move: 1,
3053
-				<?php if ( $slide_width ) {
3054
-				echo "itemWidth: " . $slide_width . ",";
3053
+				<?php if ($slide_width) {
3054
+				echo "itemWidth: ".$slide_width.",";
3055 3055
 			}?>
3056 3056
 				sync: "#geodir_widget_carousel",
3057 3057
 				start: function (slider) {
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3064 3064
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3065 3065
 				},
3066
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3066
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3067 3067
 			});
3068 3068
 		});
3069 3069
 	</script>
@@ -3076,62 +3076,62 @@  discard block
 block discarded – undo
3076 3076
 		'order_by'       => $list_sort
3077 3077
 	);
3078 3078
 
3079
-	if ( $show_featured_only ) {
3079
+	if ($show_featured_only) {
3080 3080
 		$query_args['show_featured_only'] = 1;
3081 3081
 	}
3082 3082
 
3083
-	if ( $category != 0 || $category != '' ) {
3084
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3083
+	if ($category != 0 || $category != '') {
3084
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3085 3085
 		$tax_query         = array(
3086 3086
 			'taxonomy' => $category_taxonomy[0],
3087 3087
 			'field'    => 'id',
3088 3088
 			'terms'    => $category
3089 3089
 		);
3090 3090
 
3091
-		$query_args['tax_query'] = array( $tax_query );
3091
+		$query_args['tax_query'] = array($tax_query);
3092 3092
 	}
3093 3093
 
3094 3094
 	// we want listings with featured image only
3095 3095
 	$query_args['featured_image_only'] = 1;
3096 3096
 
3097
-	if ( $post_type == 'gd_event' ) {
3097
+	if ($post_type == 'gd_event') {
3098 3098
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3099 3099
 	}// show only upcoming events
3100 3100
 
3101
-	$widget_listings = geodir_get_widget_listings( $query_args );
3102
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3103
-		if ( $title ) {
3104
-			echo $before_title . $title . $after_title;
3101
+	$widget_listings = geodir_get_widget_listings($query_args);
3102
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3103
+		if ($title) {
3104
+			echo $before_title.$title.$after_title;
3105 3105
 		}
3106 3106
 
3107 3107
 		global $post;
3108 3108
 
3109
-		$current_post = $post;// keep current post info
3109
+		$current_post = $post; // keep current post info
3110 3110
 
3111 3111
 		$widget_main_slides = '';
3112 3112
 		$nav_slides         = '';
3113 3113
 		$widget_slides      = 0;
3114 3114
 
3115
-		foreach ( $widget_listings as $widget_listing ) {
3115
+		foreach ($widget_listings as $widget_listing) {
3116 3116
 			global $gd_widget_listing_type;
3117 3117
 			$post         = $widget_listing;
3118
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3118
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3119 3119
 
3120
-			if ( ! empty( $widget_image ) ) {
3121
-				if ( $widget_image->height >= 200 ) {
3120
+			if (!empty($widget_image)) {
3121
+				if ($widget_image->height >= 200) {
3122 3122
 					$widget_spacer_height = 0;
3123 3123
 				} else {
3124
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3124
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3125 3125
 				}
3126 3126
 
3127
-				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
3127
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />';
3128 3128
 
3129 3129
 				$title = '';
3130
-				if ( $show_title ) {
3131
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3130
+				if ($show_title) {
3131
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3132 3132
 					$post_id        = $post->ID;
3133
-					$post_permalink = get_permalink( $post->ID );
3134
-					$post_title     = get_the_title( $post->ID );
3133
+					$post_permalink = get_permalink($post->ID);
3134
+					$post_title     = get_the_title($post->ID);
3135 3135
 					/**
3136 3136
 					 * Filter the listing slider widget title.
3137 3137
 					 *
@@ -3142,12 +3142,12 @@  discard block
 block discarded – undo
3142 3142
 					 * @param string $post_permalink The post permalink url.
3143 3143
 					 * @param string $post_title     The post title text.
3144 3144
 					 */
3145
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3145
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3146 3146
 				}
3147 3147
 
3148
-				$widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
3149
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3150
-				$widget_slides ++;
3148
+				$widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>';
3149
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3150
+				$widget_slides++;
3151 3151
 			}
3152 3152
 		}
3153 3153
 		?>
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3157 3157
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3158 3158
 			</div>
3159
-			<?php if ( $widget_slides > 1 ) { ?>
3159
+			<?php if ($widget_slides > 1) { ?>
3160 3160
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3161 3161
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3162 3162
 				</div>
@@ -3164,7 +3164,7 @@  discard block
 block discarded – undo
3164 3164
 		</div>
3165 3165
 		<?php
3166 3166
 		$GLOBALS['post'] = $current_post;
3167
-		setup_postdata( $current_post );
3167
+		setup_postdata($current_post);
3168 3168
 	}
3169 3169
 	echo $after_widget;
3170 3170
 }
@@ -3180,46 +3180,46 @@  discard block
 block discarded – undo
3180 3180
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3181 3181
  * @param array|string $instance The settings for the particular instance of the widget.
3182 3182
  */
3183
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3183
+function geodir_loginwidget_output($args = '', $instance = '') {
3184 3184
 	//print_r($args);
3185 3185
 	//print_r($instance);
3186 3186
 	// prints the widget
3187
-	extract( $args, EXTR_SKIP );
3187
+	extract($args, EXTR_SKIP);
3188 3188
 
3189 3189
 	/** This filter is documented in geodirectory_widgets.php */
3190
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) );
3190
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
3191 3191
 
3192 3192
 	echo $before_widget;
3193
-	echo $before_title . $title . $after_title;
3193
+	echo $before_title.$title.$after_title;
3194 3194
 
3195
-	if ( is_user_logged_in() ) {
3195
+	if (is_user_logged_in()) {
3196 3196
 		global $current_user;
3197 3197
 
3198
-		$author_link = get_author_posts_url( $current_user->data->ID );
3199
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3198
+		$author_link = get_author_posts_url($current_user->data->ID);
3199
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3200 3200
 
3201 3201
 		echo '<ul class="geodir-loginbox-list">';
3202 3202
 		ob_start();
3203 3203
 		?>
3204 3204
 		<li><a class="signin"
3205
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3205
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3206 3206
 		<?php
3207
-		$post_types                           = geodir_get_posttypes( 'object' );
3208
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3209
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3207
+		$post_types                           = geodir_get_posttypes('object');
3208
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3209
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3210 3210
 
3211
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3211
+		if (!empty($show_add_listing_post_types_main_nav)) {
3212 3212
 			$addlisting_links = '';
3213
-			foreach ( $post_types as $key => $postobj ) {
3213
+			foreach ($post_types as $key => $postobj) {
3214 3214
 
3215
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3215
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3216 3216
 
3217
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3217
+					if ($add_link = geodir_get_addlisting_link($key)) {
3218 3218
 
3219 3219
 						$name = $postobj->labels->name;
3220 3220
 
3221 3221
 						$selected = '';
3222
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3222
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3223 3223
 							$selected = 'selected="selected"';
3224 3224
 						}
3225 3225
 
@@ -3232,22 +3232,22 @@  discard block
 block discarded – undo
3232 3232
 						 * @param string $key       Add listing array key.
3233 3233
 						 * @param int $current_user ->ID Current user ID.
3234 3234
 						 */
3235
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3235
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3236 3236
 
3237
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3237
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3238 3238
 
3239 3239
 					}
3240 3240
 				}
3241 3241
 
3242 3242
 			}
3243 3243
 
3244
-			if ( $addlisting_links != '' ) { ?>
3244
+			if ($addlisting_links != '') { ?>
3245 3245
 
3246 3246
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3247 3247
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3248
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3248
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3249 3249
 						<option value="" disabled="disabled" selected="selected"
3250
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3250
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3251 3251
 						<?php echo $addlisting_links; ?>
3252 3252
 					</select></li> <?php
3253 3253
 
@@ -3255,23 +3255,23 @@  discard block
 block discarded – undo
3255 3255
 
3256 3256
 		}
3257 3257
 		// My Favourites in Dashboard
3258
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3258
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3259 3259
 		$user_favourite                    = geodir_user_favourite_listing_count();
3260 3260
 
3261
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3261
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3262 3262
 			$favourite_links = '';
3263 3263
 
3264
-			foreach ( $post_types as $key => $postobj ) {
3265
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3264
+			foreach ($post_types as $key => $postobj) {
3265
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3266 3266
 					$name           = $postobj->labels->name;
3267
-					$post_type_link = geodir_getlink( $author_link, array(
3267
+					$post_type_link = geodir_getlink($author_link, array(
3268 3268
 						'stype' => $key,
3269 3269
 						'list'  => 'favourite'
3270
-					), false );
3270
+					), false);
3271 3271
 
3272 3272
 					$selected = '';
3273 3273
 
3274
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3274
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3275 3275
 						$selected = 'selected="selected"';
3276 3276
 					}
3277 3277
 					/**
@@ -3283,20 +3283,20 @@  discard block
 block discarded – undo
3283 3283
 					 * @param string $key            Favorite listing array key.
3284 3284
 					 * @param int $current_user      ->ID Current user ID.
3285 3285
 					 */
3286
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3286
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3287 3287
 
3288
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3288
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3289 3289
 				}
3290 3290
 			}
3291 3291
 
3292
-			if ( $favourite_links != '' ) {
3292
+			if ($favourite_links != '') {
3293 3293
 				?>
3294 3294
 				<li>
3295 3295
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3296 3296
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3297
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3297
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3298 3298
 						<option value="" disabled="disabled" selected="selected"
3299
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3299
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3300 3300
 						<?php echo $favourite_links; ?>
3301 3301
 					</select>
3302 3302
 				</li>
@@ -3305,19 +3305,19 @@  discard block
 block discarded – undo
3305 3305
 		}
3306 3306
 
3307 3307
 
3308
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3308
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3309 3309
 		$user_listing                     = geodir_user_post_listing_count();
3310 3310
 
3311
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3311
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3312 3312
 			$listing_links = '';
3313 3313
 
3314
-			foreach ( $post_types as $key => $postobj ) {
3315
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3314
+			foreach ($post_types as $key => $postobj) {
3315
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3316 3316
 					$name         = $postobj->labels->name;
3317
-					$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
3317
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3318 3318
 
3319 3319
 					$selected = '';
3320
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3320
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3321 3321
 						$selected = 'selected="selected"';
3322 3322
 					}
3323 3323
 
@@ -3330,20 +3330,20 @@  discard block
 block discarded – undo
3330 3330
 					 * @param string $key          My listing array key.
3331 3331
 					 * @param int $current_user    ->ID Current user ID.
3332 3332
 					 */
3333
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3333
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3334 3334
 
3335
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3335
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3336 3336
 				}
3337 3337
 			}
3338 3338
 
3339
-			if ( $listing_links != '' ) {
3339
+			if ($listing_links != '') {
3340 3340
 				?>
3341 3341
 				<li>
3342 3342
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3343 3343
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3344
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3344
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3345 3345
 						<option value="" disabled="disabled" selected="selected"
3346
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3346
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3347 3347
 						<?php echo $listing_links; ?>
3348 3348
 					</select>
3349 3349
 				</li>
@@ -3359,7 +3359,7 @@  discard block
 block discarded – undo
3359 3359
 		 *
3360 3360
 		 * @param string $dashboard_link Dashboard links HTML.
3361 3361
 		 */
3362
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3362
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3363 3363
 		echo '</ul>';
3364 3364
 
3365 3365
 		/**
@@ -3367,7 +3367,7 @@  discard block
 block discarded – undo
3367 3367
 		 *
3368 3368
 		 * @since 1.6.6
3369 3369
 		 */
3370
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3370
+		do_action('geodir_after_loginwidget_form_logged_in');
3371 3371
 
3372 3372
 
3373 3373
 	} else {
@@ -3382,18 +3382,18 @@  discard block
 block discarded – undo
3382 3382
 		<form name="loginform" class="loginform1"
3383 3383
 		      action="<?php echo geodir_login_url(); ?>"
3384 3384
 		      method="post">
3385
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3385
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3386 3386
 			                                    type="text" class="textfield user_login1"/> <span
3387 3387
 					class="user_loginInfo"></span></div>
3388
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3388
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3389 3389
 			                                    name="pwd" type="password"
3390 3390
 			                                    class="textfield user_pass1 input-text"/><span
3391 3391
 					class="user_passInfo"></span></div>
3392 3392
 
3393
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3393
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3394 3394
 			<input type="hidden" name="testcookie" value="1"/>
3395 3395
 
3396
-				<?php do_action( 'login_form' ); ?>
3396
+				<?php do_action('login_form'); ?>
3397 3397
 
3398 3398
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3399 3399
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3406,7 +3406,7 @@  discard block
 block discarded – undo
3406 3406
 					 * @since 1.0.0
3407 3407
 					 */
3408 3408
 					?>
3409
-					<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3409
+					<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3410 3410
 					   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3411 3411
 
3412 3412
 					<?php
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
 					 * @since 1.0.0
3417 3417
 					 */
3418 3418
 					?>
3419
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3419
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3420 3420
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3421 3421
 		</form>
3422 3422
 		<?php
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 		 *
3426 3426
 		 * @since 1.6.6
3427 3427
 		 */
3428
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3428
+		do_action('geodir_after_loginwidget_form_logged_out');
3429 3429
 	}
3430 3430
 
3431 3431
 	echo $after_widget;
@@ -3447,16 +3447,16 @@  discard block
 block discarded – undo
3447 3447
  *                                         after_widget.
3448 3448
  * @param array|string $instance           The settings for the particular instance of the widget.
3449 3449
  */
3450
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3450
+function geodir_popular_postview_output($args = '', $instance = '') {
3451 3451
 	global $gd_session;
3452 3452
 
3453 3453
 	// prints the widget
3454
-	extract( $args, EXTR_SKIP );
3454
+	extract($args, EXTR_SKIP);
3455 3455
 
3456 3456
 	echo $before_widget;
3457 3457
 
3458 3458
 	/** This filter is documented in geodirectory_widgets.php */
3459
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3459
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3460 3460
 	/**
3461 3461
 	 * Filter the widget post type.
3462 3462
 	 *
@@ -3464,7 +3464,7 @@  discard block
 block discarded – undo
3464 3464
 	 *
3465 3465
 	 * @param string $instance ['post_type'] Post type of listing.
3466 3466
 	 */
3467
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3467
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3468 3468
 	/**
3469 3469
 	 * Filter the widget's term.
3470 3470
 	 *
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 	 *
3473 3473
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3474 3474
 	 */
3475
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3475
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3476 3476
 	/**
3477 3477
 	 * Filter the widget listings limit.
3478 3478
 	 *
@@ -3480,7 +3480,7 @@  discard block
 block discarded – undo
3480 3480
 	 *
3481 3481
 	 * @param string $instance ['post_number'] Number of listings to display.
3482 3482
 	 */
3483
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3483
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3484 3484
 	/**
3485 3485
 	 * Filter widget's "layout" type.
3486 3486
 	 *
@@ -3488,7 +3488,7 @@  discard block
 block discarded – undo
3488 3488
 	 *
3489 3489
 	 * @param string $instance ['layout'] Widget layout type.
3490 3490
 	 */
3491
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3491
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3492 3492
 	/**
3493 3493
 	 * Filter widget's "add_location_filter" value.
3494 3494
 	 *
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
 	 *
3497 3497
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3498 3498
 	 */
3499
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3499
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3500 3500
 	/**
3501 3501
 	 * Filter widget's listing width.
3502 3502
 	 *
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
 	 *
3505 3505
 	 * @param string $instance ['listing_width'] Listing width.
3506 3506
 	 */
3507
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3507
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3508 3508
 	/**
3509 3509
 	 * Filter widget's "list_sort" type.
3510 3510
 	 *
@@ -3512,25 +3512,25 @@  discard block
 block discarded – undo
3512 3512
 	 *
3513 3513
 	 * @param string $instance ['list_sort'] Listing sort by type.
3514 3514
 	 */
3515
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3516
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3515
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3516
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3517 3517
 
3518 3518
 	// set post type to current viewing post type
3519
-	if ( $use_viewing_post_type ) {
3519
+	if ($use_viewing_post_type) {
3520 3520
 		$current_post_type = geodir_get_current_posttype();
3521
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3521
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3522 3522
 			$post_type = $current_post_type;
3523 3523
 			$category  = array(); // old post type category will not work for current changed post type
3524 3524
 		}
3525 3525
 	}
3526 3526
 	// replace widget title dynamically
3527
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3528
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3527
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3528
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3529 3529
 
3530
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3531
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3530
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3531
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3532 3532
 
3533
-	if ( isset( $instance['character_count'] ) ) {
3533
+	if (isset($instance['character_count'])) {
3534 3534
 		/**
3535 3535
 		 * Filter the widget's excerpt character count.
3536 3536
 		 *
@@ -3538,37 +3538,37 @@  discard block
 block discarded – undo
3538 3538
 		 *
3539 3539
 		 * @param int $instance ['character_count'] Excerpt character count.
3540 3540
 		 */
3541
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3541
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3542 3542
 	} else {
3543 3543
 		$character_count = '';
3544 3544
 	}
3545 3545
 
3546
-	if ( empty( $title ) || $title == 'All' ) {
3547
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3546
+	if (empty($title) || $title == 'All') {
3547
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3548 3548
 	}
3549 3549
 
3550 3550
 	$location_url = array();
3551
-	$city         = get_query_var( 'gd_city' );
3552
-	if ( ! empty( $city ) ) {
3553
-		$country = get_query_var( 'gd_country' );
3554
-		$region  = get_query_var( 'gd_region' );
3551
+	$city         = get_query_var('gd_city');
3552
+	if (!empty($city)) {
3553
+		$country = get_query_var('gd_country');
3554
+		$region  = get_query_var('gd_region');
3555 3555
 
3556
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3556
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3557 3557
 
3558
-		if ( $geodir_show_location_url == 'all' ) {
3559
-			if ( $country != '' ) {
3558
+		if ($geodir_show_location_url == 'all') {
3559
+			if ($country != '') {
3560 3560
 				$location_url[] = $country;
3561 3561
 			}
3562 3562
 
3563
-			if ( $region != '' ) {
3563
+			if ($region != '') {
3564 3564
 				$location_url[] = $region;
3565 3565
 			}
3566
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3567
-			if ( $country != '' ) {
3566
+		} else if ($geodir_show_location_url == 'country_city') {
3567
+			if ($country != '') {
3568 3568
 				$location_url[] = $country;
3569 3569
 			}
3570
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3571
-			if ( $region != '' ) {
3570
+		} else if ($geodir_show_location_url == 'region_city') {
3571
+			if ($region != '') {
3572 3572
 				$location_url[] = $region;
3573 3573
 			}
3574 3574
 		}
@@ -3576,37 +3576,37 @@  discard block
 block discarded – undo
3576 3576
 		$location_url[] = $city;
3577 3577
 	}
3578 3578
 
3579
-	$location_url  = implode( '/', $location_url );
3579
+	$location_url  = implode('/', $location_url);
3580 3580
 	$skip_location = false;
3581
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3581
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3582 3582
 		$skip_location = true;
3583
-		$gd_session->un_set( 'gd_multi_location' );
3583
+		$gd_session->un_set('gd_multi_location');
3584 3584
 	}
3585 3585
 
3586
-	if ( get_option( 'permalink_structure' ) ) {
3587
-		$viewall_url = get_post_type_archive_link( $post_type );
3586
+	if (get_option('permalink_structure')) {
3587
+		$viewall_url = get_post_type_archive_link($post_type);
3588 3588
 	} else {
3589
-		$viewall_url = get_post_type_archive_link( $post_type );
3589
+		$viewall_url = get_post_type_archive_link($post_type);
3590 3590
 	}
3591 3591
 
3592
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3592
+	if (!empty($category) && $category[0] != '0') {
3593 3593
 		global $geodir_add_location_url;
3594 3594
 
3595 3595
 		$geodir_add_location_url = '0';
3596 3596
 
3597
-		if ( $add_location_filter != '0' ) {
3597
+		if ($add_location_filter != '0') {
3598 3598
 			$geodir_add_location_url = '1';
3599 3599
 		}
3600 3600
 
3601
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3601
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3602 3602
 
3603 3603
 		$geodir_add_location_url = null;
3604 3604
 	}
3605
-	if ( $skip_location ) {
3606
-		$gd_session->set( 'gd_multi_location', 1 );
3605
+	if ($skip_location) {
3606
+		$gd_session->set('gd_multi_location', 1);
3607 3607
 	}
3608 3608
 
3609
-	if ( is_wp_error( $viewall_url ) ) {
3609
+	if (is_wp_error($viewall_url)) {
3610 3610
 		$viewall_url = '';
3611 3611
 	}
3612 3612
 
@@ -3618,34 +3618,34 @@  discard block
 block discarded – undo
3618 3618
 		'order_by'       => $list_sort
3619 3619
 	);
3620 3620
 
3621
-	if ( $character_count ) {
3621
+	if ($character_count) {
3622 3622
 		$query_args['excerpt_length'] = $character_count;
3623 3623
 	}
3624 3624
 
3625
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3625
+	if (!empty($instance['show_featured_only'])) {
3626 3626
 		$query_args['show_featured_only'] = 1;
3627 3627
 	}
3628 3628
 
3629
-	if ( ! empty( $instance['show_special_only'] ) ) {
3629
+	if (!empty($instance['show_special_only'])) {
3630 3630
 		$query_args['show_special_only'] = 1;
3631 3631
 	}
3632 3632
 
3633
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3633
+	if (!empty($instance['with_pics_only'])) {
3634 3634
 		$query_args['with_pics_only']      = 0;
3635 3635
 		$query_args['featured_image_only'] = 1;
3636 3636
 	}
3637 3637
 
3638
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3638
+	if (!empty($instance['with_videos_only'])) {
3639 3639
 		$query_args['with_videos_only'] = 1;
3640 3640
 	}
3641
-	$with_no_results = ! empty( $instance['without_no_results'] ) ? false : true;
3641
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3642 3642
 
3643
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3644
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3643
+	if (!empty($category) && $category[0] != '0') {
3644
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3645 3645
 
3646 3646
 		######### WPML #########
3647
-		if ( function_exists( 'icl_object_id' ) ) {
3648
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3647
+		if (function_exists('icl_object_id')) {
3648
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3649 3649
 		}
3650 3650
 		######### WPML #########
3651 3651
 
@@ -3655,14 +3655,14 @@  discard block
 block discarded – undo
3655 3655
 			'terms'    => $category
3656 3656
 		);
3657 3657
 
3658
-		$query_args['tax_query'] = array( $tax_query );
3658
+		$query_args['tax_query'] = array($tax_query);
3659 3659
 	}
3660 3660
 
3661 3661
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3662 3662
 
3663
-	$widget_listings = geodir_get_widget_listings( $query_args );
3663
+	$widget_listings = geodir_get_widget_listings($query_args);
3664 3664
 
3665
-	if ( ! empty( $widget_listings ) || $with_no_results ) {
3665
+	if (!empty($widget_listings) || $with_no_results) {
3666 3666
 		?>
3667 3667
 		<div class="geodir_locations geodir_location_listing">
3668 3668
 
@@ -3672,11 +3672,11 @@  discard block
 block discarded – undo
3672 3672
 			 *
3673 3673
 			 * @since 1.0.0
3674 3674
 			 */
3675
-			do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3675
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3676 3676
 			<div class="geodir_list_heading clearfix">
3677
-				<?php echo $before_title . $title . $after_title; ?>
3677
+				<?php echo $before_title.$title.$after_title; ?>
3678 3678
 				<a href="<?php echo $viewall_url; ?>"
3679
-				   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3679
+				   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3680 3680
 			</div>
3681 3681
 			<?php
3682 3682
 			/**
@@ -3684,10 +3684,10 @@  discard block
 block discarded – undo
3684 3684
 			 *
3685 3685
 			 * @since 1.0.0
3686 3686
 			 */
3687
-			do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3687
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3688 3688
 			<?php
3689
-			if ( strstr( $layout, 'gridview' ) ) {
3690
-				$listing_view_exp        = explode( '_', $layout );
3689
+			if (strstr($layout, 'gridview')) {
3690
+				$listing_view_exp        = explode('_', $layout);
3691 3691
 				$gridview_columns_widget = $layout;
3692 3692
 				$layout                  = $listing_view_exp[0];
3693 3693
 			} else {
@@ -3699,8 +3699,8 @@  discard block
 block discarded – undo
3699 3699
 			 *
3700 3700
 			 * @since 1.0.0
3701 3701
 			 */
3702
-			$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3703
-			if ( ! isset( $character_count ) ) {
3702
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3703
+			if (!isset($character_count)) {
3704 3704
 				/**
3705 3705
 				 * Filter the widget's excerpt character count.
3706 3706
 				 *
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
 				 *
3709 3709
 				 * @param int $instance ['character_count'] Excerpt character count.
3710 3710
 				 */
3711
-				$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3711
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3712 3712
 			}
3713 3713
 
3714 3714
 			global $post, $map_jason, $map_canvas_arr;
@@ -3723,13 +3723,13 @@  discard block
 block discarded – undo
3723 3723
 			 *
3724 3724
 			 * @since 1.0.0
3725 3725
 			 */
3726
-			include( $template );
3726
+			include($template);
3727 3727
 
3728 3728
 			$geodir_is_widget_listing = false;
3729 3729
 
3730 3730
 			$GLOBALS['post'] = $current_post;
3731
-			if ( ! empty( $current_post ) ) {
3732
-				setup_postdata( $current_post );
3731
+			if (!empty($current_post)) {
3732
+				setup_postdata($current_post);
3733 3733
 			}
3734 3734
 			$map_jason      = $current_map_jason;
3735 3735
 			$map_canvas_arr = $current_map_canvas_arr;
@@ -3760,12 +3760,12 @@  discard block
 block discarded – undo
3760 3760
  *
3761 3761
  * @return int Reviews count.
3762 3762
  */
3763
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3763
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3764 3764
 	global $wpdb, $plugin_prefix;
3765 3765
 
3766
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3766
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3767 3767
 
3768
-	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3768
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
3769 3769
 
3770 3770
 	/**
3771 3771
 	 * Filter count review sql query.
@@ -3777,9 +3777,9 @@  discard block
 block discarded – undo
3777 3777
 	 * @param int $taxonomy     The taxonomy Id.
3778 3778
 	 * @param string $post_type The post type.
3779 3779
 	 */
3780
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3780
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3781 3781
 
3782
-	$count = $wpdb->get_var( $sql );
3782
+	$count = $wpdb->get_var($sql);
3783 3783
 
3784 3784
 	return $count;
3785 3785
 }
@@ -3797,7 +3797,7 @@  discard block
 block discarded – undo
3797 3797
  *
3798 3798
  * @return array Term array data.
3799 3799
  */
3800
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3800
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3801 3801
 	/**
3802 3802
 	 * Filter review count option data.
3803 3803
 	 *
@@ -3807,78 +3807,78 @@  discard block
 block discarded – undo
3807 3807
 	 * @param bool $force_update Force update option value?. Default.false.
3808 3808
 	 * @param int $post_ID       The post id to update if any.
3809 3809
 	 */
3810
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3811
-	if ( ! empty( $option_data ) ) {
3810
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3811
+	if (!empty($option_data)) {
3812 3812
 		return $option_data;
3813 3813
 	}
3814 3814
 
3815
-	$option_data = get_option( 'geodir_global_review_count' );
3815
+	$option_data = get_option('geodir_global_review_count');
3816 3816
 
3817
-	if ( ! $option_data || $force_update ) {
3818
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3817
+	if (!$option_data || $force_update) {
3818
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3819 3819
 			global $gd_session;
3820 3820
 			$term_array = (array) $option_data;
3821
-			$post_type  = get_post_type( $post_ID );
3822
-			$taxonomy   = $post_type . 'category';
3823
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3824
-
3825
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3826
-				foreach ( $terms as $term_id ) {
3827
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3828
-					$children               = get_term_children( $term_id, $taxonomy );
3829
-					$term_array[ $term_id ] = $count;
3821
+			$post_type  = get_post_type($post_ID);
3822
+			$taxonomy   = $post_type.'category';
3823
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3824
+
3825
+			if (!empty($terms) && !is_wp_error($terms)) {
3826
+				foreach ($terms as $term_id) {
3827
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3828
+					$children               = get_term_children($term_id, $taxonomy);
3829
+					$term_array[$term_id] = $count;
3830 3830
 				}
3831 3831
 			}
3832 3832
 
3833
-			$session_listing = $gd_session->get( 'listing' );
3833
+			$session_listing = $gd_session->get('listing');
3834 3834
 
3835 3835
 			$terms = array();
3836
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
3837
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
3838
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
3839
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3836
+			if (isset($_POST['post_category'][$taxonomy])) {
3837
+				$terms = (array) $_POST['post_category'][$taxonomy];
3838
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3839
+				$terms = (array) $session_listing['post_category'][$taxonomy];
3840 3840
 			}
3841 3841
 
3842
-			if ( ! empty( $terms ) ) {
3843
-				foreach ( $terms as $term_id ) {
3844
-					if ( $term_id > 0 ) {
3845
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3846
-						$children               = get_term_children( $term_id, $taxonomy );
3847
-						$term_array[ $term_id ] = $count;
3842
+			if (!empty($terms)) {
3843
+				foreach ($terms as $term_id) {
3844
+					if ($term_id > 0) {
3845
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3846
+						$children               = get_term_children($term_id, $taxonomy);
3847
+						$term_array[$term_id] = $count;
3848 3848
 					}
3849 3849
 				}
3850 3850
 			}
3851 3851
 		} else { // Update reviews count for all post categories.
3852 3852
 			$term_array = array();
3853 3853
 			$post_types = geodir_get_posttypes();
3854
-			foreach ( $post_types as $post_type ) {
3854
+			foreach ($post_types as $post_type) {
3855 3855
 
3856
-				$taxonomy = geodir_get_taxonomies( $post_type );
3856
+				$taxonomy = geodir_get_taxonomies($post_type);
3857 3857
 				$taxonomy = $taxonomy[0];
3858 3858
 
3859 3859
 				$args = array(
3860 3860
 					'hide_empty' => false
3861 3861
 				);
3862 3862
 
3863
-				$terms = get_terms( $taxonomy, $args );
3863
+				$terms = get_terms($taxonomy, $args);
3864 3864
 
3865
-				foreach ( $terms as $term ) {
3866
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
3867
-					$children = get_term_children( $term->term_id, $taxonomy );
3865
+				foreach ($terms as $term) {
3866
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3867
+					$children = get_term_children($term->term_id, $taxonomy);
3868 3868
 					/*if ( is_array( $children ) ) {
3869 3869
                         foreach ( $children as $child_id ) {
3870 3870
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3871 3871
                             $count = $count + $child_count;
3872 3872
                         }
3873 3873
                     }*/
3874
-					$term_array[ $term->term_id ] = $count;
3874
+					$term_array[$term->term_id] = $count;
3875 3875
 				}
3876 3876
 			}
3877 3877
 		}
3878 3878
 
3879
-		update_option( 'geodir_global_review_count', $term_array );
3879
+		update_option('geodir_global_review_count', $term_array);
3880 3880
 		//clear cache
3881
-		wp_cache_delete( 'geodir_global_review_count' );
3881
+		wp_cache_delete('geodir_global_review_count');
3882 3882
 
3883 3883
 		return $term_array;
3884 3884
 	} else {
@@ -3894,39 +3894,39 @@  discard block
 block discarded – undo
3894 3894
  * @package GeoDirectory
3895 3895
  * @return bool
3896 3896
  */
3897
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3898
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
3897
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3898
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3899 3899
 		return; // do not run if importing listings
3900 3900
 	}
3901 3901
 
3902
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
3902
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3903 3903
 		return;
3904 3904
 	}
3905 3905
 
3906 3906
 	$post_ID = 0;
3907
-	if ( ! empty( $post ) ) {
3908
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
3907
+	if (!empty($post)) {
3908
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3909 3909
 			return;
3910 3910
 		}
3911 3911
 
3912
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
3912
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3913 3913
 			return;
3914 3914
 		}
3915 3915
 
3916
-		if ( ! empty( $post->ID ) ) {
3916
+		if (!empty($post->ID)) {
3917 3917
 			$post_ID = $post->ID;
3918 3918
 		}
3919 3919
 	}
3920 3920
 
3921
-	if ( $new_status != $old_status ) {
3922
-		geodir_count_reviews_by_terms( true, $post_ID );
3921
+	if ($new_status != $old_status) {
3922
+		geodir_count_reviews_by_terms(true, $post_ID);
3923 3923
 	}
3924 3924
 
3925 3925
 	return true;
3926 3926
 }
3927 3927
 
3928
-function geodir_term_review_count_force_update_single_post( $post_id ) {
3929
-	geodir_count_reviews_by_terms( true, $post_id );
3928
+function geodir_term_review_count_force_update_single_post($post_id) {
3929
+	geodir_count_reviews_by_terms(true, $post_id);
3930 3930
 }
3931 3931
 
3932 3932
 /*-----------------------------------------------------------------------------------*/
@@ -3943,11 +3943,11 @@  discard block
 block discarded – undo
3943 3943
  *
3944 3944
  * @return int Post count.
3945 3945
  */
3946
-function geodir_count_posts_by_term( $data, $term ) {
3946
+function geodir_count_posts_by_term($data, $term) {
3947 3947
 
3948
-	if ( $data ) {
3949
-		if ( isset( $data[ $term->term_id ] ) ) {
3950
-			return $data[ $term->term_id ];
3948
+	if ($data) {
3949
+		if (isset($data[$term->term_id])) {
3950
+			return $data[$term->term_id];
3951 3951
 		} else {
3952 3952
 			return 0;
3953 3953
 		}
@@ -3964,8 +3964,8 @@  discard block
 block discarded – undo
3964 3964
  * param array $terms An array of term objects.
3965 3965
  * @return array Sorted terms array.
3966 3966
  */
3967
-function geodir_sort_terms_by_count( $terms ) {
3968
-	usort( $terms, "geodir_sort_by_count_obj" );
3967
+function geodir_sort_terms_by_count($terms) {
3968
+	usort($terms, "geodir_sort_by_count_obj");
3969 3969
 
3970 3970
 	return $terms;
3971 3971
 }
@@ -3980,8 +3980,8 @@  discard block
 block discarded – undo
3980 3980
  *
3981 3981
  * @return array Sorted terms array.
3982 3982
  */
3983
-function geodir_sort_terms_by_review_count( $terms ) {
3984
-	usort( $terms, "geodir_sort_by_review_count_obj" );
3983
+function geodir_sort_terms_by_review_count($terms) {
3984
+	usort($terms, "geodir_sort_by_review_count_obj");
3985 3985
 
3986 3986
 	return $terms;
3987 3987
 }
@@ -3997,12 +3997,12 @@  discard block
 block discarded – undo
3997 3997
  *
3998 3998
  * @return array Sorted terms array.
3999 3999
  */
4000
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4001
-	if ( $sort == 'count' ) {
4002
-		return geodir_sort_terms_by_count( $terms );
4000
+function geodir_sort_terms($terms, $sort = 'count') {
4001
+	if ($sort == 'count') {
4002
+		return geodir_sort_terms_by_count($terms);
4003 4003
 	}
4004
-	if ( $sort == 'review_count' ) {
4005
-		return geodir_sort_terms_by_review_count( $terms );
4004
+	if ($sort == 'review_count') {
4005
+		return geodir_sort_terms_by_review_count($terms);
4006 4006
 	}
4007 4007
 }
4008 4008
 
@@ -4020,7 +4020,7 @@  discard block
 block discarded – undo
4020 4020
  *
4021 4021
  * @return bool
4022 4022
  */
4023
-function geodir_sort_by_count( $a, $b ) {
4023
+function geodir_sort_by_count($a, $b) {
4024 4024
 	return $a['count'] < $b['count'];
4025 4025
 }
4026 4026
 
@@ -4035,7 +4035,7 @@  discard block
 block discarded – undo
4035 4035
  *
4036 4036
  * @return bool
4037 4037
  */
4038
-function geodir_sort_by_count_obj( $a, $b ) {
4038
+function geodir_sort_by_count_obj($a, $b) {
4039 4039
 	return $a->count < $b->count;
4040 4040
 }
4041 4041
 
@@ -4050,7 +4050,7 @@  discard block
 block discarded – undo
4050 4050
  *
4051 4051
  * @return bool
4052 4052
  */
4053
-function geodir_sort_by_review_count_obj( $a, $b ) {
4053
+function geodir_sort_by_review_count_obj($a, $b) {
4054 4054
 	return $a->review_count < $b->review_count;
4055 4055
 }
4056 4056
 
@@ -4067,35 +4067,35 @@  discard block
 block discarded – undo
4067 4067
 	 * @since   1.4.2
4068 4068
 	 * @package GeoDirectory
4069 4069
 	 */
4070
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4070
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4071 4071
 
4072
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4073
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4072
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4073
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4074 4074
 
4075 4075
 	/**
4076 4076
 	 * Define language constants.
4077 4077
 	 *
4078 4078
 	 * @since 1.0.0
4079 4079
 	 */
4080
-	require_once( geodir_plugin_path() . '/language.php' );
4080
+	require_once(geodir_plugin_path().'/language.php');
4081 4081
 
4082
-	$language_file = geodir_plugin_path() . '/db-language.php';
4082
+	$language_file = geodir_plugin_path().'/db-language.php';
4083 4083
 
4084 4084
 	// Load language string file if not created yet
4085
-	if ( ! file_exists( $language_file ) ) {
4085
+	if (!file_exists($language_file)) {
4086 4086
 		geodirectory_load_db_language();
4087 4087
 	}
4088 4088
 
4089
-	if ( file_exists( $language_file ) ) {
4089
+	if (file_exists($language_file)) {
4090 4090
 		/**
4091 4091
 		 * Language strings from database.
4092 4092
 		 *
4093 4093
 		 * @since 1.4.2
4094 4094
 		 */
4095 4095
 		try {
4096
-			require_once( $language_file );
4097
-		} catch ( Exception $e ) {
4098
-			error_log( 'Language Error: ' . $e->getMessage() );
4096
+			require_once($language_file);
4097
+		} catch (Exception $e) {
4098
+			error_log('Language Error: '.$e->getMessage());
4099 4099
 		}
4100 4100
 	}
4101 4101
 }
@@ -4112,19 +4112,19 @@  discard block
 block discarded – undo
4112 4112
  */
4113 4113
 function geodirectory_load_db_language() {
4114 4114
 	global $wp_filesystem;
4115
-	if ( empty( $wp_filesystem ) ) {
4116
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4115
+	if (empty($wp_filesystem)) {
4116
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4117 4117
 		WP_Filesystem();
4118 4118
 		global $wp_filesystem;
4119 4119
 	}
4120 4120
 
4121
-	$language_file = geodir_plugin_path() . '/db-language.php';
4121
+	$language_file = geodir_plugin_path().'/db-language.php';
4122 4122
 
4123
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4123
+	if (is_file($language_file) && !is_writable($language_file)) {
4124 4124
 		return false;
4125 4125
 	} // Not possible to create.
4126 4126
 
4127
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4127
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4128 4128
 		return false;
4129 4129
 	} // Not possible to create.
4130 4130
 
@@ -4137,9 +4137,9 @@  discard block
 block discarded – undo
4137 4137
 	 *
4138 4138
 	 * @param array $contents_strings Array of strings.
4139 4139
 	 */
4140
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4140
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4141 4141
 
4142
-	$contents_strings = array_unique( $contents_strings );
4142
+	$contents_strings = array_unique($contents_strings);
4143 4143
 
4144 4144
 	$contents_head   = array();
4145 4145
 	$contents_head[] = "<?php";
@@ -4156,20 +4156,20 @@  discard block
 block discarded – undo
4156 4156
 	$contents_foot[] = "";
4157 4157
 	$contents_foot[] = "";
4158 4158
 
4159
-	$contents = implode( PHP_EOL, $contents_head );
4159
+	$contents = implode(PHP_EOL, $contents_head);
4160 4160
 
4161
-	if ( ! empty( $contents_strings ) ) {
4162
-		foreach ( $contents_strings as $string ) {
4163
-			if ( is_scalar( $string ) && $string != '' ) {
4164
-				$string = str_replace( "'", "\'", $string );
4165
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4161
+	if (!empty($contents_strings)) {
4162
+		foreach ($contents_strings as $string) {
4163
+			if (is_scalar($string) && $string != '') {
4164
+				$string = str_replace("'", "\'", $string);
4165
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4166 4166
 			}
4167 4167
 		}
4168 4168
 	}
4169 4169
 
4170
-	$contents .= implode( PHP_EOL, $contents_foot );
4170
+	$contents .= implode(PHP_EOL, $contents_foot);
4171 4171
 
4172
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4172
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4173 4173
 		return false;
4174 4174
 	} // Failure; could not write file.
4175 4175
 
@@ -4190,49 +4190,49 @@  discard block
 block discarded – undo
4190 4190
  *
4191 4191
  * @return array Translation texts.
4192 4192
  */
4193
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4193
+function geodir_load_custom_field_translation($translation_texts = array()) {
4194 4194
 	global $wpdb;
4195 4195
 
4196 4196
 	// Custom fields table
4197
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4198
-	$rows = $wpdb->get_results( $sql );
4197
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4198
+	$rows = $wpdb->get_results($sql);
4199 4199
 
4200
-	if ( ! empty( $rows ) ) {
4201
-		foreach ( $rows as $row ) {
4202
-			if ( ! empty( $row->admin_title ) ) {
4203
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4200
+	if (!empty($rows)) {
4201
+		foreach ($rows as $row) {
4202
+			if (!empty($row->admin_title)) {
4203
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4204 4204
 			}
4205 4205
 
4206
-			if ( ! empty( $row->admin_desc ) ) {
4207
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4206
+			if (!empty($row->admin_desc)) {
4207
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4208 4208
 			}
4209 4209
 
4210
-			if ( ! empty( $row->site_title ) ) {
4211
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4210
+			if (!empty($row->site_title)) {
4211
+				$translation_texts[] = stripslashes_deep($row->site_title);
4212 4212
 			}
4213 4213
 
4214
-			if ( ! empty( $row->clabels ) ) {
4215
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4214
+			if (!empty($row->clabels)) {
4215
+				$translation_texts[] = stripslashes_deep($row->clabels);
4216 4216
 			}
4217 4217
 
4218
-			if ( ! empty( $row->required_msg ) ) {
4219
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4218
+			if (!empty($row->required_msg)) {
4219
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4220 4220
 			}
4221 4221
             
4222
-			if ( ! empty( $row->validation_msg ) ) {
4223
-				$translation_texts[] = stripslashes_deep( $row->validation_msg );
4222
+			if (!empty($row->validation_msg)) {
4223
+				$translation_texts[] = stripslashes_deep($row->validation_msg);
4224 4224
 			}
4225 4225
 
4226
-			if ( ! empty( $row->default_value ) ) {
4227
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4226
+			if (!empty($row->default_value)) {
4227
+				$translation_texts[] = stripslashes_deep($row->default_value);
4228 4228
 			}
4229 4229
 
4230
-			if ( ! empty( $row->option_values ) ) {
4231
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4230
+			if (!empty($row->option_values)) {
4231
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4232 4232
 
4233
-				if ( ! empty( $option_values ) ) {
4234
-					foreach ( $option_values as $option_value ) {
4235
-						if ( ! empty( $option_value['label'] ) ) {
4233
+				if (!empty($option_values)) {
4234
+					foreach ($option_values as $option_value) {
4235
+						if (!empty($option_value['label'])) {
4236 4236
 							$translation_texts[] = $option_value['label'];
4237 4237
 						}
4238 4238
 					}
@@ -4242,56 +4242,56 @@  discard block
 block discarded – undo
4242 4242
 	}
4243 4243
 
4244 4244
 	// Custom sorting fields table
4245
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4246
-	$rows = $wpdb->get_results( $sql );
4245
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4246
+	$rows = $wpdb->get_results($sql);
4247 4247
 
4248
-	if ( ! empty( $rows ) ) {
4249
-		foreach ( $rows as $row ) {
4250
-			if ( ! empty( $row->site_title ) ) {
4251
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4248
+	if (!empty($rows)) {
4249
+		foreach ($rows as $row) {
4250
+			if (!empty($row->site_title)) {
4251
+				$translation_texts[] = stripslashes_deep($row->site_title);
4252 4252
 			}
4253 4253
 
4254
-			if ( ! empty( $row->asc_title ) ) {
4255
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4254
+			if (!empty($row->asc_title)) {
4255
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4256 4256
 			}
4257 4257
 
4258
-			if ( ! empty( $row->desc_title ) ) {
4259
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4258
+			if (!empty($row->desc_title)) {
4259
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4260 4260
 			}
4261 4261
 		}
4262 4262
 	}
4263 4263
 
4264 4264
 	// Advance search filter fields table
4265
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4266
-		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4267
-		$rows = $wpdb->get_results( $sql );
4268
-
4269
-		if ( ! empty( $rows ) ) {
4270
-			foreach ( $rows as $row ) {
4271
-				if ( ! empty( $row->field_site_name ) ) {
4272
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4265
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4266
+		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4267
+		$rows = $wpdb->get_results($sql);
4268
+
4269
+		if (!empty($rows)) {
4270
+			foreach ($rows as $row) {
4271
+				if (!empty($row->field_site_name)) {
4272
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4273 4273
 				}
4274 4274
 
4275
-				if ( ! empty( $row->front_search_title ) ) {
4276
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4275
+				if (!empty($row->front_search_title)) {
4276
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4277 4277
 				}
4278 4278
 
4279
-				if ( ! empty( $row->first_search_text ) ) {
4280
-					$translation_texts[] = stripslashes_deep( $row->first_search_text );
4279
+				if (!empty($row->first_search_text)) {
4280
+					$translation_texts[] = stripslashes_deep($row->first_search_text);
4281 4281
 				}
4282 4282
 
4283
-				if ( ! empty( $row->last_search_text ) ) {
4284
-					$translation_texts[] = stripslashes_deep( $row->last_search_text );
4283
+				if (!empty($row->last_search_text)) {
4284
+					$translation_texts[] = stripslashes_deep($row->last_search_text);
4285 4285
 				}
4286 4286
 
4287
-				if ( ! empty( $row->field_desc ) ) {
4288
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4287
+				if (!empty($row->field_desc)) {
4288
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4289 4289
 				}
4290 4290
 			}
4291 4291
 		}
4292 4292
 	}
4293 4293
 
4294
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4294
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4295 4295
 
4296 4296
 	return $translation_texts;
4297 4297
 }
@@ -4313,7 +4313,7 @@  discard block
 block discarded – undo
4313 4313
 	 *
4314 4314
 	 * @param array $geodir_allowed_mime_types and file extensions.
4315 4315
 	 */
4316
-	return apply_filters( 'geodir_allowed_mime_types', array(
4316
+	return apply_filters('geodir_allowed_mime_types', array(
4317 4317
 			'Image'       => array( // Image formats.
4318 4318
 				'jpg'  => 'image/jpeg',
4319 4319
 				'jpe'  => 'image/jpeg',
@@ -4381,18 +4381,18 @@  discard block
 block discarded – undo
4381 4381
  *
4382 4382
  * @return string User display name.
4383 4383
  */
4384
-function geodir_get_client_name( $user_id ) {
4384
+function geodir_get_client_name($user_id) {
4385 4385
 	$client_name = '';
4386 4386
 
4387
-	$user_data = get_userdata( $user_id );
4387
+	$user_data = get_userdata($user_id);
4388 4388
 
4389
-	if ( ! empty( $user_data ) ) {
4390
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4391
-			$client_name = trim( $user_data->display_name );
4392
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4393
-			$client_name = trim( $user_data->user_nicename );
4389
+	if (!empty($user_data)) {
4390
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4391
+			$client_name = trim($user_data->display_name);
4392
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4393
+			$client_name = trim($user_data->user_nicename);
4394 4394
 		} else {
4395
-			$client_name = trim( $user_data->user_login );
4395
+			$client_name = trim($user_data->user_login);
4396 4396
 		}
4397 4397
 	}
4398 4398
 
@@ -4400,19 +4400,19 @@  discard block
 block discarded – undo
4400 4400
 }
4401 4401
 
4402 4402
 
4403
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4403
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4404 4404
 /*
4405 4405
  * Add location variables to wpseo replacements.
4406 4406
  *
4407 4407
  * @since 1.5.4
4408 4408
  */
4409
-function geodir_wpseo_replacements( $vars ) {
4409
+function geodir_wpseo_replacements($vars) {
4410 4410
 
4411 4411
 	global $wp;
4412 4412
 	$title = '';
4413 4413
 	// location variables
4414 4414
 	$gd_post_type   = geodir_get_current_posttype();
4415
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4415
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4416 4416
 	/**
4417 4417
 	 * Filter the title variables location variables array
4418 4418
 	 *
@@ -4422,105 +4422,105 @@  discard block
 block discarded – undo
4422 4422
 	 * @param array $location_array The array of location variables.
4423 4423
 	 * @param array $vars           The page title variables.
4424 4424
 	 */
4425
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4425
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4426 4426
 	$location_titles = array();
4427
-	if ( get_query_var( 'gd_country_full' ) ) {
4428
-		if ( get_query_var( 'gd_country_full' ) ) {
4429
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4427
+	if (get_query_var('gd_country_full')) {
4428
+		if (get_query_var('gd_country_full')) {
4429
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4430 4430
 		}
4431
-		if ( get_query_var( 'gd_region_full' ) ) {
4432
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4431
+		if (get_query_var('gd_region_full')) {
4432
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4433 4433
 		}
4434
-		if ( get_query_var( 'gd_city_full' ) ) {
4435
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4434
+		if (get_query_var('gd_city_full')) {
4435
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4436 4436
 		}
4437 4437
 	}
4438 4438
 	$location_single = '';
4439
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4440
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4441
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4439
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4440
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4441
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4442 4442
 
4443 4443
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4444 4444
 
4445
-	if ( function_exists( 'get_actual_location_name' ) ) {
4446
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4447
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4448
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4445
+	if (function_exists('get_actual_location_name')) {
4446
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4447
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4448
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4449 4449
 	}
4450 4450
 
4451
-	if ( $gd_city != '' ) {
4452
-		if ( $gd_city_actual != '' ) {
4451
+	if ($gd_city != '') {
4452
+		if ($gd_city_actual != '') {
4453 4453
 			$gd_city = $gd_city_actual;
4454 4454
 		} else {
4455
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4456
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4457
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4455
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4456
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4457
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4458 4458
 		}
4459 4459
 		$location_single = $gd_city;
4460 4460
 
4461
-	} else if ( $gd_region != '' ) {
4462
-		if ( $gd_region_actual != '' ) {
4461
+	} else if ($gd_region != '') {
4462
+		if ($gd_region_actual != '') {
4463 4463
 			$gd_region = $gd_region_actual;
4464 4464
 		} else {
4465
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4466
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4467
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4465
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4466
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4467
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4468 4468
 		}
4469 4469
 
4470 4470
 		$location_single = $gd_region;
4471
-	} else if ( $gd_country != '' ) {
4472
-		if ( $gd_country_actual != '' ) {
4471
+	} else if ($gd_country != '') {
4472
+		if ($gd_country_actual != '') {
4473 4473
 			$gd_country = $gd_country_actual;
4474 4474
 		} else {
4475
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4476
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4477
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4475
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4476
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4477
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4478 4478
 		}
4479 4479
 
4480 4480
 		$location_single = $gd_country;
4481 4481
 	}
4482 4482
 
4483
-	if ( ! empty( $location_array ) ) {
4483
+	if (!empty($location_array)) {
4484 4484
 
4485
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4486
-		$location_array       = array_reverse( $location_array );
4485
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4486
+		$location_array       = array_reverse($location_array);
4487 4487
 
4488
-		foreach ( $location_array as $location_type => $location ) {
4489
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4490
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4488
+		foreach ($location_array as $location_type => $location) {
4489
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4490
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4491 4491
 
4492
-			$location_name = geodir_ucwords( $gd_location_link_text );
4493
-			$location_name = __( $location_name, 'geodirectory' );
4492
+			$location_name = geodir_ucwords($gd_location_link_text);
4493
+			$location_name = __($location_name, 'geodirectory');
4494 4494
 
4495
-			if ( $actual_location_name ) {
4496
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4497
-				$location_name = get_actual_location_name( $location_type, $location, true );
4495
+			if ($actual_location_name) {
4496
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4497
+				$location_name = get_actual_location_name($location_type, $location, true);
4498 4498
 			}
4499 4499
 
4500 4500
 			$location_titles[] = $location_name;
4501 4501
 		}
4502
-		if ( ! empty( $location_titles ) ) {
4503
-			$location_titles = array_unique( $location_titles );
4502
+		if (!empty($location_titles)) {
4503
+			$location_titles = array_unique($location_titles);
4504 4504
 		}
4505 4505
 	}
4506 4506
 
4507 4507
 
4508
-	if ( ! empty( $location_titles ) ) {
4509
-		$vars['%%location%%'] = implode( ", ", $location_titles );
4508
+	if (!empty($location_titles)) {
4509
+		$vars['%%location%%'] = implode(", ", $location_titles);
4510 4510
 	}
4511 4511
 
4512 4512
 
4513
-	if ( ! empty( $location_titles ) ) {
4514
-		$vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4513
+	if (!empty($location_titles)) {
4514
+		$vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4515 4515
 	}
4516 4516
 
4517 4517
 
4518
-	if ( $location_single ) {
4519
-		$vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4518
+	if ($location_single) {
4519
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4520 4520
 	}
4521 4521
 
4522 4522
 
4523
-	if ( $location_single ) {
4523
+	if ($location_single) {
4524 4524
 		$vars['%%location_single%%'] = $location_single;
4525 4525
 	}
4526 4526
 
@@ -4533,13 +4533,13 @@  discard block
 block discarded – undo
4533 4533
 	 * @param string $vars          The title with variables.
4534 4534
 	 * @param array $location_array The array of location variables.
4535 4535
 	 */
4536
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4536
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4537 4537
 }
4538 4538
 
4539 4539
 
4540
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4541
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4542
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4540
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4541
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4542
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4543 4543
 
4544 4544
 /**
4545 4545
  * Filter the title variables.
@@ -4581,14 +4581,14 @@  discard block
 block discarded – undo
4581 4581
  *
4582 4582
  * @return string Title after filtered variables.
4583 4583
  */
4584
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4584
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4585 4585
 	global $wp, $post;
4586 4586
 
4587
-	if ( ! $gd_page || ! $title ) {
4587
+	if (!$gd_page || !$title) {
4588 4588
 		return $title; // if no a GD page then bail.
4589 4589
 	}
4590 4590
 
4591
-	if ( $sep == '' ) {
4591
+	if ($sep == '') {
4592 4592
 		/**
4593 4593
 		 * Filter the page title separator.
4594 4594
 		 *
@@ -4597,100 +4597,100 @@  discard block
 block discarded – undo
4597 4597
 		 *
4598 4598
 		 * @param string $sep The separator, default: `|`.
4599 4599
 		 */
4600
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4600
+		$sep = apply_filters('geodir_page_title_separator', '|');
4601 4601
 	}
4602 4602
 
4603
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4604
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4603
+	if (strpos($title, '%%title%%') !== false) {
4604
+		$title = str_replace("%%title%%", $post->post_title, $title);
4605 4605
 	}
4606 4606
 
4607
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4608
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4607
+	if (strpos($title, '%%sitename%%') !== false) {
4608
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4609 4609
 	}
4610 4610
 
4611
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4612
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4611
+	if (strpos($title, '%%sitedesc%%') !== false) {
4612
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4613 4613
 	}
4614 4614
 
4615
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4616
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4615
+	if (strpos($title, '%%excerpt%%') !== false) {
4616
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4617 4617
 	}
4618 4618
 
4619
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4620
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4621
-	} else if ( $gd_page == 'add-listing' ) {
4622
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4623
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4624
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4619
+	if ($gd_page == 'search' || $gd_page == 'author') {
4620
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4621
+	} else if ($gd_page == 'add-listing') {
4622
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4623
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4624
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4625 4625
 		$post_type = $post->post_type;
4626 4626
 	} else {
4627
-		$post_type = get_query_var( 'post_type' );
4627
+		$post_type = get_query_var('post_type');
4628 4628
 	}
4629 4629
 
4630
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4630
+	if (strpos($title, '%%pt_single%%') !== false) {
4631 4631
 		$singular_name = '';
4632
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4633
-			$singular_name = __( $singular_name, 'geodirectory' );
4632
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4633
+			$singular_name = __($singular_name, 'geodirectory');
4634 4634
 		}
4635 4635
 
4636
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4636
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4637 4637
 	}
4638 4638
 
4639
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4639
+	if (strpos($title, '%%pt_plural%%') !== false) {
4640 4640
 		$plural_name = '';
4641
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4642
-			$plural_name = __( $plural_name, 'geodirectory' );
4641
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4642
+			$plural_name = __($plural_name, 'geodirectory');
4643 4643
 		}
4644 4644
 
4645
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4645
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4646 4646
 	}
4647 4647
 
4648
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4648
+	if (strpos($title, '%%category%%') !== false) {
4649 4649
 		$cat_name = '';
4650 4650
 
4651
-		if ( $gd_page == 'detail' ) {
4652
-			if ( $post->default_category ) {
4653
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4654
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4651
+		if ($gd_page == 'detail') {
4652
+			if ($post->default_category) {
4653
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4654
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4655 4655
 			}
4656
-		} else if ( $gd_page == 'listing' ) {
4656
+		} else if ($gd_page == 'listing') {
4657 4657
 			$queried_object = get_queried_object();
4658
-			if ( isset( $queried_object->name ) ) {
4658
+			if (isset($queried_object->name)) {
4659 4659
 				$cat_name = $queried_object->name;
4660 4660
 			}
4661 4661
 		}
4662
-		$title = str_replace( "%%category%%", $cat_name, $title );
4662
+		$title = str_replace("%%category%%", $cat_name, $title);
4663 4663
 	}
4664 4664
 
4665
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4665
+	if (strpos($title, '%%tag%%') !== false) {
4666 4666
 		$cat_name = '';
4667 4667
 
4668
-		if ( $gd_page == 'detail' ) {
4669
-			if ( $post->default_category ) {
4670
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4671
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4668
+		if ($gd_page == 'detail') {
4669
+			if ($post->default_category) {
4670
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4671
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4672 4672
 			}
4673
-		} else if ( $gd_page == 'listing' ) {
4673
+		} else if ($gd_page == 'listing') {
4674 4674
 			$queried_object = get_queried_object();
4675
-			if ( isset( $queried_object->name ) ) {
4675
+			if (isset($queried_object->name)) {
4676 4676
 				$cat_name = $queried_object->name;
4677 4677
 			}
4678 4678
 		}
4679
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4679
+		$title = str_replace("%%tag%%", $cat_name, $title);
4680 4680
 	}
4681 4681
 
4682
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4683
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4684
-		$title = str_replace( "%%id%%", $ID, $title );
4682
+	if (strpos($title, '%%id%%') !== false) {
4683
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4684
+		$title = str_replace("%%id%%", $ID, $title);
4685 4685
 	}
4686 4686
 
4687
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4688
-		$title = str_replace( "%%sep%%", $sep, $title );
4687
+	if (strpos($title, '%%sep%%') !== false) {
4688
+		$title = str_replace("%%sep%%", $sep, $title);
4689 4689
 	}
4690 4690
 
4691 4691
 	// location variables
4692 4692
 	$gd_post_type   = geodir_get_current_posttype();
4693
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4693
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4694 4694
 	/**
4695 4695
 	 * Filter the title variables location variables array
4696 4696
 	 *
@@ -4702,166 +4702,166 @@  discard block
 block discarded – undo
4702 4702
 	 * @param string $gd_page       The page being filtered.
4703 4703
 	 * @param string $sep           The separator, default: `|`.
4704 4704
 	 */
4705
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4705
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4706 4706
 	$location_titles = array();
4707
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4708
-		if ( get_query_var( 'gd_country_full' ) ) {
4709
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4707
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4708
+		if (get_query_var('gd_country_full')) {
4709
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4710 4710
 		}
4711
-		if ( get_query_var( 'gd_region_full' ) ) {
4712
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4711
+		if (get_query_var('gd_region_full')) {
4712
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4713 4713
 		}
4714
-		if ( get_query_var( 'gd_city_full' ) ) {
4715
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4714
+		if (get_query_var('gd_city_full')) {
4715
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4716 4716
 		}
4717 4717
 	}
4718 4718
 	$location_single = '';
4719
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4720
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4721
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4719
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4720
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4721
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4722 4722
 
4723 4723
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4724 4724
 
4725
-	if ( function_exists( 'get_actual_location_name' ) ) {
4726
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4727
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4728
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4725
+	if (function_exists('get_actual_location_name')) {
4726
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4727
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4728
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4729 4729
 	}
4730 4730
 
4731
-	if ( $gd_city != '' ) {
4732
-		if ( $gd_city_actual != '' ) {
4731
+	if ($gd_city != '') {
4732
+		if ($gd_city_actual != '') {
4733 4733
 			$gd_city = $gd_city_actual;
4734 4734
 		} else {
4735
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4736
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4737
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4735
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4736
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4737
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4738 4738
 		}
4739 4739
 		$location_single = $gd_city;
4740 4740
 
4741
-	} else if ( $gd_region != '' ) {
4742
-		if ( $gd_region_actual != '' ) {
4741
+	} else if ($gd_region != '') {
4742
+		if ($gd_region_actual != '') {
4743 4743
 			$gd_region = $gd_region_actual;
4744 4744
 		} else {
4745
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4746
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4747
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4745
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4746
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4747
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4748 4748
 		}
4749 4749
 
4750 4750
 		$location_single = $gd_region;
4751
-	} else if ( $gd_country != '' ) {
4752
-		if ( $gd_country_actual != '' ) {
4751
+	} else if ($gd_country != '') {
4752
+		if ($gd_country_actual != '') {
4753 4753
 			$gd_country = $gd_country_actual;
4754 4754
 		} else {
4755
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4756
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4757
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4755
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4756
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4757
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4758 4758
 		}
4759 4759
 
4760 4760
 		$location_single = $gd_country;
4761 4761
 	}
4762 4762
 
4763
-	if ( ! empty( $location_array ) ) {
4763
+	if (!empty($location_array)) {
4764 4764
 
4765
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4766
-		$location_array       = array_reverse( $location_array );
4765
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4766
+		$location_array       = array_reverse($location_array);
4767 4767
 
4768
-		foreach ( $location_array as $location_type => $location ) {
4769
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4770
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4768
+		foreach ($location_array as $location_type => $location) {
4769
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4770
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4771 4771
 
4772
-			$location_name = geodir_ucwords( $gd_location_link_text );
4773
-			$location_name = __( $location_name, 'geodirectory' );
4772
+			$location_name = geodir_ucwords($gd_location_link_text);
4773
+			$location_name = __($location_name, 'geodirectory');
4774 4774
 
4775
-			if ( $actual_location_name ) {
4776
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4777
-				$location_name = get_actual_location_name( $location_type, $location, true );
4775
+			if ($actual_location_name) {
4776
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4777
+				$location_name = get_actual_location_name($location_type, $location, true);
4778 4778
 			}
4779 4779
 
4780 4780
 			$location_titles[] = $location_name;
4781 4781
 		}
4782
-		if ( ! empty( $location_titles ) ) {
4783
-			$location_titles = array_unique( $location_titles );
4782
+		if (!empty($location_titles)) {
4783
+			$location_titles = array_unique($location_titles);
4784 4784
 		}
4785 4785
 	}
4786 4786
 
4787 4787
 
4788
-	if ( strpos( $title, '%%location%%' ) !== false ) {
4788
+	if (strpos($title, '%%location%%') !== false) {
4789 4789
 		$location = '';
4790
-		if ( $location_titles ) {
4791
-			$location = implode( ", ", $location_titles );
4790
+		if ($location_titles) {
4791
+			$location = implode(", ", $location_titles);
4792 4792
 		}
4793
-		$title = str_replace( "%%location%%", $location, $title );
4793
+		$title = str_replace("%%location%%", $location, $title);
4794 4794
 	}
4795 4795
 
4796
-	if ( strpos( $title, '%%in_location%%' ) !== false ) {
4796
+	if (strpos($title, '%%in_location%%') !== false) {
4797 4797
 		$location = '';
4798
-		if ( $location_titles ) {
4799
-			$location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4798
+		if ($location_titles) {
4799
+			$location = __('in ', 'geodirectory').implode(", ", $location_titles);
4800 4800
 		}
4801
-		$title = str_replace( "%%in_location%%", $location, $title );
4801
+		$title = str_replace("%%in_location%%", $location, $title);
4802 4802
 	}
4803 4803
 
4804
-	if ( strpos( $title, '%%in_location_single%%' ) !== false ) {
4805
-		if ( $location_single ) {
4806
-			$location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4804
+	if (strpos($title, '%%in_location_single%%') !== false) {
4805
+		if ($location_single) {
4806
+			$location_single = __('in', 'geodirectory').' '.$location_single;
4807 4807
 		}
4808
-		$title = str_replace( "%%in_location_single%%", $location_single, $title );
4808
+		$title = str_replace("%%in_location_single%%", $location_single, $title);
4809 4809
 	}
4810 4810
 
4811
-	if ( strpos( $title, '%%location_single%%' ) !== false ) {
4812
-		$title = str_replace( "%%location_single%%", $location_single, $title );
4811
+	if (strpos($title, '%%location_single%%') !== false) {
4812
+		$title = str_replace("%%location_single%%", $location_single, $title);
4813 4813
 	}
4814 4814
 
4815 4815
 
4816
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4816
+	if (strpos($title, '%%search_term%%') !== false) {
4817 4817
 		$search_term = '';
4818
-		if ( isset( $_REQUEST['s'] ) ) {
4819
-			$search_term = esc_attr( $_REQUEST['s'] );
4818
+		if (isset($_REQUEST['s'])) {
4819
+			$search_term = esc_attr($_REQUEST['s']);
4820 4820
 		}
4821
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4821
+		$title = str_replace("%%search_term%%", $search_term, $title);
4822 4822
 	}
4823 4823
 
4824
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4824
+	if (strpos($title, '%%search_near%%') !== false) {
4825 4825
 		$search_term = '';
4826
-		if ( isset( $_REQUEST['snear'] ) ) {
4827
-			$search_term = esc_attr( $_REQUEST['snear'] );
4826
+		if (isset($_REQUEST['snear'])) {
4827
+			$search_term = esc_attr($_REQUEST['snear']);
4828 4828
 		}
4829
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4829
+		$title = str_replace("%%search_near%%", $search_term, $title);
4830 4830
 	}
4831 4831
 
4832
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4833
-		if ( is_author() ) {
4834
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4832
+	if (strpos($title, '%%name%%') !== false) {
4833
+		if (is_author()) {
4834
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4835 4835
 			$author_name = $curauth->display_name;
4836 4836
 		} else {
4837 4837
 			$author_name = get_the_author();
4838 4838
 		}
4839
-		if ( ! $author_name || $author_name === '' ) {
4839
+		if (!$author_name || $author_name === '') {
4840 4840
 			$queried_object = get_queried_object();
4841 4841
 
4842
-			if ( isset( $queried_object->data->user_nicename ) ) {
4842
+			if (isset($queried_object->data->user_nicename)) {
4843 4843
 				$author_name = $queried_object->data->display_name;
4844 4844
 			}
4845 4845
 		}
4846
-		$title = str_replace( "%%name%%", $author_name, $title );
4846
+		$title = str_replace("%%name%%", $author_name, $title);
4847 4847
 	}
4848 4848
 
4849
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4850
-		$page  = geodir_title_meta_page( $sep );
4851
-		$title = str_replace( "%%page%%", $page, $title );
4849
+	if (strpos($title, '%%page%%') !== false) {
4850
+		$page  = geodir_title_meta_page($sep);
4851
+		$title = str_replace("%%page%%", $page, $title);
4852 4852
 	}
4853
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4853
+	if (strpos($title, '%%pagenumber%%') !== false) {
4854 4854
 		$pagenumber = geodir_title_meta_pagenumber();
4855
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4855
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4856 4856
 	}
4857
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4857
+	if (strpos($title, '%%pagetotal%%') !== false) {
4858 4858
 		$pagetotal = geodir_title_meta_pagetotal();
4859
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4859
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4860 4860
 	}
4861 4861
 
4862
-	$title = wptexturize( $title );
4863
-	$title = convert_chars( $title );
4864
-	$title = esc_html( $title );
4862
+	$title = wptexturize($title);
4863
+	$title = convert_chars($title);
4864
+	$title = esc_html($title);
4865 4865
 
4866 4866
 	/**
4867 4867
 	 * Filter the title variables after standard ones have been filtered.
@@ -4875,7 +4875,7 @@  discard block
 block discarded – undo
4875 4875
 	 * @param string $sep           The separator, default: `|`.
4876 4876
 	 */
4877 4877
 
4878
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4878
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4879 4879
 }
4880 4880
 
4881 4881
 /**
@@ -4888,82 +4888,82 @@  discard block
 block discarded – undo
4888 4888
  *
4889 4889
  * @return array Translation texts.
4890 4890
  */
4891
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4892
-	$gd_post_types = geodir_get_posttypes( 'array' );
4891
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4892
+	$gd_post_types = geodir_get_posttypes('array');
4893 4893
 
4894
-	if ( ! empty( $gd_post_types ) ) {
4895
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4896
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4897
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4898
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4894
+	if (!empty($gd_post_types)) {
4895
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4896
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4897
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4898
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4899 4899
 
4900
-			if ( ! empty( $labels ) ) {
4901
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4900
+			if (!empty($labels)) {
4901
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4902 4902
 					$translation_texts[] = $labels['name'];
4903 4903
 				}
4904
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4904
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4905 4905
 					$translation_texts[] = $labels['singular_name'];
4906 4906
 				}
4907
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4907
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4908 4908
 					$translation_texts[] = $labels['add_new'];
4909 4909
 				}
4910
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4910
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4911 4911
 					$translation_texts[] = $labels['add_new_item'];
4912 4912
 				}
4913
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4913
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4914 4914
 					$translation_texts[] = $labels['edit_item'];
4915 4915
 				}
4916
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4916
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4917 4917
 					$translation_texts[] = $labels['new_item'];
4918 4918
 				}
4919
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4919
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4920 4920
 					$translation_texts[] = $labels['view_item'];
4921 4921
 				}
4922
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4922
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4923 4923
 					$translation_texts[] = $labels['search_items'];
4924 4924
 				}
4925
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4925
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4926 4926
 					$translation_texts[] = $labels['not_found'];
4927 4927
 				}
4928
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4928
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4929 4929
 					$translation_texts[] = $labels['not_found_in_trash'];
4930 4930
 				}
4931
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4931
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4932 4932
 					$translation_texts[] = $labels['label_post_profile'];
4933 4933
 				}
4934
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4934
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4935 4935
 					$translation_texts[] = $labels['label_post_info'];
4936 4936
 				}
4937
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4937
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4938 4938
 					$translation_texts[] = $labels['label_post_images'];
4939 4939
 				}
4940
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4940
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4941 4941
 					$translation_texts[] = $labels['label_post_map'];
4942 4942
 				}
4943
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4943
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4944 4944
 					$translation_texts[] = $labels['label_reviews'];
4945 4945
 				}
4946
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4946
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4947 4947
 					$translation_texts[] = $labels['label_related_listing'];
4948 4948
 				}
4949 4949
 			}
4950 4950
 
4951
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
4952
-				$translation_texts[] = normalize_whitespace( $description );
4951
+			if ($description != '' && !in_array($description, $translation_texts)) {
4952
+				$translation_texts[] = normalize_whitespace($description);
4953 4953
 			}
4954 4954
 
4955
-			if ( ! empty( $seo ) ) {
4956
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
4957
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
4955
+			if (!empty($seo)) {
4956
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4957
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4958 4958
 				}
4959 4959
 
4960
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
4961
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
4960
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4961
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4962 4962
 				}
4963 4963
 			}
4964 4964
 		}
4965 4965
 	}
4966
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4966
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4967 4967
 
4968 4968
 	return $translation_texts;
4969 4969
 }
@@ -4978,27 +4978,27 @@  discard block
 block discarded – undo
4978 4978
  *
4979 4979
  * @return array Location terms.
4980 4980
  */
4981
-function geodir_remove_location_terms( $location_terms = array() ) {
4982
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
4981
+function geodir_remove_location_terms($location_terms = array()) {
4982
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4983 4983
 
4984
-	if ( ! empty( $location_terms ) && $location_manager ) {
4985
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
4986
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
4984
+	if (!empty($location_terms) && $location_manager) {
4985
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4986
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
4987 4987
 
4988
-		if ( $hide_region_part && $hide_country_part ) {
4989
-			if ( isset( $location_terms['gd_country'] ) ) {
4990
-				unset( $location_terms['gd_country'] );
4988
+		if ($hide_region_part && $hide_country_part) {
4989
+			if (isset($location_terms['gd_country'])) {
4990
+				unset($location_terms['gd_country']);
4991 4991
 			}
4992
-			if ( isset( $location_terms['gd_region'] ) ) {
4993
-				unset( $location_terms['gd_region'] );
4992
+			if (isset($location_terms['gd_region'])) {
4993
+				unset($location_terms['gd_region']);
4994 4994
 			}
4995
-		} else if ( $hide_region_part && ! $hide_country_part ) {
4996
-			if ( isset( $location_terms['gd_region'] ) ) {
4997
-				unset( $location_terms['gd_region'] );
4995
+		} else if ($hide_region_part && !$hide_country_part) {
4996
+			if (isset($location_terms['gd_region'])) {
4997
+				unset($location_terms['gd_region']);
4998 4998
 			}
4999
-		} else if ( ! $hide_region_part && $hide_country_part ) {
5000
-			if ( isset( $location_terms['gd_country'] ) ) {
5001
-				unset( $location_terms['gd_country'] );
4999
+		} else if (!$hide_region_part && $hide_country_part) {
5000
+			if (isset($location_terms['gd_country'])) {
5001
+				unset($location_terms['gd_country']);
5002 5002
 			}
5003 5003
 		}
5004 5004
 	}
@@ -5016,33 +5016,33 @@  discard block
 block discarded – undo
5016 5016
  * @param WP_Post $post Post object.
5017 5017
  * @param bool $update  Whether this is an existing listing being updated or not.
5018 5018
  */
5019
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
5020
-	if ( ! $update ) {
5019
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
5020
+	if (!$update) {
5021 5021
 		return;
5022 5022
 	}
5023 5023
 
5024
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
5025
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
5024
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
5025
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
5026 5026
 	$inline_save = $action == 'inline-save' ? true : false;
5027 5027
 
5028
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
5028
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
5029 5029
 		return;
5030 5030
 	}
5031 5031
 
5032
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
5032
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
5033 5033
 		return;
5034 5034
 	}
5035 5035
 
5036 5036
 	$user_id = (int) get_current_user_id();
5037 5037
 
5038
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
5039
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
5038
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
5039
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
5040 5040
 
5041
-		if ( $user_id == $author_id && ! is_super_admin() ) {
5042
-			$from_email   = get_option( 'site_email' );
5041
+		if ($user_id == $author_id && !is_super_admin()) {
5042
+			$from_email   = get_option('site_email');
5043 5043
 			$from_name    = get_site_emailName();
5044
-			$to_email     = get_option( 'admin_email' );
5045
-			$to_name      = get_option( 'name' );
5044
+			$to_email     = get_option('admin_email');
5045
+			$to_name      = get_option('name');
5046 5046
 			$message_type = 'listing_edited';
5047 5047
 
5048 5048
 			$notify_edited = true;
@@ -5054,9 +5054,9 @@  discard block
 block discarded – undo
5054 5054
 			 * @param bool $notify_edited Notify on listing edited by author?
5055 5055
 			 * @param object $post        The current post object.
5056 5056
 			 */
5057
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
5057
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
5058 5058
 
5059
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
5059
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
5060 5060
 		}
5061 5061
 	}
5062 5062
 }
@@ -5071,14 +5071,14 @@  discard block
 block discarded – undo
5071 5071
  *
5072 5072
  * @return string|null The current page start & end numbering.
5073 5073
  */
5074
-function geodir_title_meta_page( $sep ) {
5074
+function geodir_title_meta_page($sep) {
5075 5075
 	$replacement = null;
5076 5076
 
5077
-	$max = geodir_title_meta_pagenumbering( 'max' );
5078
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
5077
+	$max = geodir_title_meta_pagenumbering('max');
5078
+	$nr  = geodir_title_meta_pagenumbering('nr');
5079 5079
 
5080
-	if ( $max > 1 && $nr > 1 ) {
5081
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
5080
+	if ($max > 1 && $nr > 1) {
5081
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
5082 5082
 	}
5083 5083
 
5084 5084
 	return $replacement;
@@ -5095,8 +5095,8 @@  discard block
 block discarded – undo
5095 5095
 function geodir_title_meta_pagenumber() {
5096 5096
 	$replacement = null;
5097 5097
 
5098
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5099
-	if ( isset( $nr ) && $nr > 0 ) {
5098
+	$nr = geodir_title_meta_pagenumbering('nr');
5099
+	if (isset($nr) && $nr > 0) {
5100 5100
 		$replacement = (string) $nr;
5101 5101
 	}
5102 5102
 
@@ -5114,8 +5114,8 @@  discard block
 block discarded – undo
5114 5114
 function geodir_title_meta_pagetotal() {
5115 5115
 	$replacement = null;
5116 5116
 
5117
-	$max = geodir_title_meta_pagenumbering( 'max' );
5118
-	if ( isset( $max ) && $max > 0 ) {
5117
+	$max = geodir_title_meta_pagenumbering('max');
5118
+	if (isset($max) && $max > 0) {
5119 5119
 		$replacement = (string) $max;
5120 5120
 	}
5121 5121
 
@@ -5135,36 +5135,36 @@  discard block
 block discarded – undo
5135 5135
  *
5136 5136
  * @return int|null The current page numbering.
5137 5137
  */
5138
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5138
+function geodir_title_meta_pagenumbering($request = 'nr') {
5139 5139
 	global $wp_query, $post;
5140 5140
 	$max_num_pages = null;
5141 5141
 	$page_number   = null;
5142 5142
 
5143 5143
 	$max_num_pages = 1;
5144 5144
 
5145
-	if ( ! is_singular() ) {
5146
-		$page_number = get_query_var( 'paged' );
5147
-		if ( $page_number === 0 || $page_number === '' ) {
5145
+	if (!is_singular()) {
5146
+		$page_number = get_query_var('paged');
5147
+		if ($page_number === 0 || $page_number === '') {
5148 5148
 			$page_number = 1;
5149 5149
 		}
5150 5150
 
5151
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5151
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5152 5152
 			$max_num_pages = $wp_query->max_num_pages;
5153 5153
 		}
5154 5154
 	} else {
5155
-		$page_number = get_query_var( 'page' );
5156
-		if ( $page_number === 0 || $page_number === '' ) {
5155
+		$page_number = get_query_var('page');
5156
+		if ($page_number === 0 || $page_number === '') {
5157 5157
 			$page_number = 1;
5158 5158
 		}
5159 5159
 
5160
-		if ( isset( $post->post_content ) ) {
5161
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5160
+		if (isset($post->post_content)) {
5161
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5162 5162
 		}
5163 5163
 	}
5164 5164
 
5165 5165
 	$return = null;
5166 5166
 
5167
-	switch ( $request ) {
5167
+	switch ($request) {
5168 5168
 		case 'nr':
5169 5169
 			$return = $page_number;
5170 5170
 			break;
@@ -5185,14 +5185,14 @@  discard block
 block discarded – undo
5185 5185
  *
5186 5186
  * @return array Terms.
5187 5187
  */
5188
-function geodir_filter_empty_terms( $terms ) {
5189
-	if ( empty( $terms ) ) {
5188
+function geodir_filter_empty_terms($terms) {
5189
+	if (empty($terms)) {
5190 5190
 		return $terms;
5191 5191
 	}
5192 5192
 
5193 5193
 	$return = array();
5194
-	foreach ( $terms as $term ) {
5195
-		if ( isset( $term->count ) && $term->count > 0 ) {
5194
+	foreach ($terms as $term) {
5195
+		if (isset($term->count) && $term->count > 0) {
5196 5196
 			$return[] = $term;
5197 5197
 		} else {
5198 5198
 			/**
@@ -5203,7 +5203,7 @@  discard block
 block discarded – undo
5203 5203
 			 * @param array $return The array of terms to return.
5204 5204
 			 * @param object $term  The term object.
5205 5205
 			 */
5206
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5206
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5207 5207
 		}
5208 5208
 	}
5209 5209
 
@@ -5220,12 +5220,12 @@  discard block
 block discarded – undo
5220 5220
  *
5221 5221
  * @return array
5222 5222
  */
5223
-function geodir_remove_hentry( $class ) {
5224
-	if ( geodir_is_page( 'detail' ) ) {
5225
-		$class = array_diff( $class, array( 'hentry' ) );
5223
+function geodir_remove_hentry($class) {
5224
+	if (geodir_is_page('detail')) {
5225
+		$class = array_diff($class, array('hentry'));
5226 5226
 	}
5227 5227
 
5228 5228
 	return $class;
5229 5229
 }
5230 5230
 
5231
-add_filter( 'post_class', 'geodir_remove_hentry' );
5232 5231
\ No newline at end of file
5232
+add_filter('post_class', 'geodir_remove_hentry');
5233 5233
\ No newline at end of file
Please login to merge, or discard this patch.