Test Failed
Pull Request — master (#269)
by Viruthagiri
07:34
created
geodirectory-functions/taxonomy_functions.php 1 patch
Indentation   +1186 added lines, -1186 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)) . '
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
+
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
+	}
147 158
 
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 . '">
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,32 +401,32 @@  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 428
 
429
-    return $geodir_post_type;
429
+	return $geodir_post_type;
430 430
 }
431 431
 
432 432
 /**
@@ -440,21 +440,21 @@  discard block
 block discarded – undo
440 440
  */
441 441
 function geodir_get_posttypes($output = 'names')
442 442
 {
443
-    $post_types = array();
444
-    $post_types = get_option('geodir_post_types');
445
-    $post_types = stripslashes_deep($post_types);
446
-    if (!empty($post_types)) {
447
-        switch ($output):
448
-            case 'object':
449
-            case 'Object':
450
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
451
-                break;
452
-            case 'array':
453
-            case 'Array':
454
-                $post_types = (array)$post_types;
455
-                break;
443
+	$post_types = array();
444
+	$post_types = get_option('geodir_post_types');
445
+	$post_types = stripslashes_deep($post_types);
446
+	if (!empty($post_types)) {
447
+		switch ($output):
448
+			case 'object':
449
+			case 'Object':
450
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
451
+				break;
452
+			case 'array':
453
+			case 'Array':
454
+				$post_types = (array)$post_types;
455
+				break;
456 456
 			case 'options':
457
-                $post_types = (array)$post_types;
457
+				$post_types = (array)$post_types;
458 458
 				
459 459
 				$options = array();
460 460
 				if (!empty($post_types)) {
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
 					}
464 464
 				}
465 465
 				$post_types = $options;
466
-                break;
467
-            default:
468
-                $post_types = array_keys($post_types);
469
-                break;
470
-        endswitch;
471
-    }
472
-
473
-    if (!empty($post_types))
474
-        return $post_types;
475
-    else
476
-        return array();
466
+				break;
467
+			default:
468
+				$post_types = array_keys($post_types);
469
+				break;
470
+		endswitch;
471
+	}
472
+
473
+	if (!empty($post_types))
474
+		return $post_types;
475
+	else
476
+		return array();
477 477
 }
478 478
 
479 479
 /**
@@ -486,108 +486,108 @@  discard block
 block discarded – undo
486 486
  */
487 487
 function geodir_get_posttype_info($post_type = '')
488 488
 {
489
-    $post_types = array();
490
-    $post_types = get_option('geodir_post_types');
491
-    $post_types = stripslashes_deep($post_types);
492
-    if (!empty($post_types) && $post_type != '') {
493
-        return $post_types[$post_type];
494
-    } else
495
-        return false;
489
+	$post_types = array();
490
+	$post_types = get_option('geodir_post_types');
491
+	$post_types = stripslashes_deep($post_types);
492
+	if (!empty($post_types) && $post_type != '') {
493
+		return $post_types[$post_type];
494
+	} else
495
+		return false;
496 496
 }
497 497
 
498 498
 if (!function_exists('geodir_get_taxonomies')) {
499
-    /**
500
-     * Get all custom taxonomies.
501
-     *
502
-     * @since 1.0.0
503
-     * @package GeoDirectory
504
-     * @param string $post_type The post type.
505
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
506
-     * @return array|bool Taxonomies on success. false on failure.
507
-     */
508
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
509
-    {
499
+	/**
500
+	 * Get all custom taxonomies.
501
+	 *
502
+	 * @since 1.0.0
503
+	 * @package GeoDirectory
504
+	 * @param string $post_type The post type.
505
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
506
+	 * @return array|bool Taxonomies on success. false on failure.
507
+	 */
508
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
509
+	{
510 510
 
511
-        $taxonomies = array();
512
-        $gd_taxonomies = array();
511
+		$taxonomies = array();
512
+		$gd_taxonomies = array();
513 513
 
514
-        if ($taxonomies = get_option('geodir_taxonomies')) {
514
+		if ($taxonomies = get_option('geodir_taxonomies')) {
515 515
 
516 516
 
517
-            $gd_taxonomies = array_keys($taxonomies);
517
+			$gd_taxonomies = array_keys($taxonomies);
518 518
 
519 519
 
520
-            if ($post_type != '')
521
-                $gd_taxonomies = array();
520
+			if ($post_type != '')
521
+				$gd_taxonomies = array();
522 522
 
523
-            $i = 0;
524
-            foreach ($taxonomies as $taxonomy => $args) {
523
+			$i = 0;
524
+			foreach ($taxonomies as $taxonomy => $args) {
525 525
 
526
-                if ($post_type != '' && $args['object_type'] == $post_type)
527
-                    $gd_taxonomies[] = $taxonomy;
526
+				if ($post_type != '' && $args['object_type'] == $post_type)
527
+					$gd_taxonomies[] = $taxonomy;
528 528
 
529
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
530
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
531
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
532
-                }
529
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
530
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
531
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
532
+				}
533 533
 
534
-            }
534
+			}
535
+
536
+			$gd_taxonomies = array_values($gd_taxonomies);
537
+		}
535 538
 
536
-            $gd_taxonomies = array_values($gd_taxonomies);
537
-        }
538
-
539
-        /**
540
-         * Filter the taxonomies.
541
-         *
542
-         * @since 1.0.0
543
-         * @param array $gd_taxonomies The taxonomy array.
544
-         */
545
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
546
-
547
-        if (!empty($taxonomies)) {
548
-            return $taxonomies;
549
-        } else {
550
-            return false;
551
-        }
552
-    }
539
+		/**
540
+		 * Filter the taxonomies.
541
+		 *
542
+		 * @since 1.0.0
543
+		 * @param array $gd_taxonomies The taxonomy array.
544
+		 */
545
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
546
+
547
+		if (!empty($taxonomies)) {
548
+			return $taxonomies;
549
+		} else {
550
+			return false;
551
+		}
552
+	}
553 553
 }
554 554
 
555 555
 if (!function_exists(' geodir_get_categories_dl')) {
556
-    /**
557
-     * Get categories dropdown HTML.
558
-     *
559
-     * @since 1.0.0
560
-     * @package GeoDirectory
561
-     * @param string $post_type The post type.
562
-     * @param string $selected The selected value.
563
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
564
-     * @param bool $echo Prints the HTML when set to true. Default: true.
565
-     * @return void|string Dropdown HTML.
566
-     */
567
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
568
-    {
569
-
570
-        $html = '';
571
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
572
-
573
-        $categories = get_terms($taxonomies);
574
-
575
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
576
-
577
-        foreach ($categories as $category_obj) {
578
-            $select_opt = '';
579
-            if ($selected == $category_obj->term_id) {
580
-                $select_opt = 'selected="selected"';
581
-            }
582
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
583
-                . ucfirst($category_obj->name) . '</option>';
584
-        }
585
-
586
-        if ($echo)
587
-            echo $html;
588
-        else
589
-            return $html;
590
-    }
556
+	/**
557
+	 * Get categories dropdown HTML.
558
+	 *
559
+	 * @since 1.0.0
560
+	 * @package GeoDirectory
561
+	 * @param string $post_type The post type.
562
+	 * @param string $selected The selected value.
563
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
564
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
565
+	 * @return void|string Dropdown HTML.
566
+	 */
567
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
568
+	{
569
+
570
+		$html = '';
571
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
572
+
573
+		$categories = get_terms($taxonomies);
574
+
575
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
576
+
577
+		foreach ($categories as $category_obj) {
578
+			$select_opt = '';
579
+			if ($selected == $category_obj->term_id) {
580
+				$select_opt = 'selected="selected"';
581
+			}
582
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
583
+				. ucfirst($category_obj->name) . '</option>';
584
+		}
585
+
586
+		if ($echo)
587
+			echo $html;
588
+		else
589
+			return $html;
590
+	}
591 591
 }
592 592
 
593 593
 
@@ -602,28 +602,28 @@  discard block
 block discarded – undo
602 602
 function geodir_get_listing_slug($object_type = '')
603 603
 {
604 604
 
605
-    $listing_slug = '';
605
+	$listing_slug = '';
606 606
 
607
-    $post_types = get_option('geodir_post_types');
608
-    $taxonomies = get_option('geodir_taxonomies');
607
+	$post_types = get_option('geodir_post_types');
608
+	$taxonomies = get_option('geodir_taxonomies');
609 609
 
610 610
 
611
-    if ($object_type != '') {
612
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
611
+	if ($object_type != '') {
612
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
613 613
 
614
-            $object_info = $post_types[$object_type];
615
-            $listing_slug = $object_info['listing_slug'];
616
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
617
-            $object_info = $taxonomies[$object_type];
618
-            $listing_slug = $object_info['listing_slug'];
619
-        }
614
+			$object_info = $post_types[$object_type];
615
+			$listing_slug = $object_info['listing_slug'];
616
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
617
+			$object_info = $taxonomies[$object_type];
618
+			$listing_slug = $object_info['listing_slug'];
619
+		}
620 620
 
621
-    }
621
+	}
622 622
 
623
-    if (!empty($listing_slug))
624
-        return $listing_slug;
625
-    else
626
-        return false;
623
+	if (!empty($listing_slug))
624
+		return $listing_slug;
625
+	else
626
+		return false;
627 627
 }
628 628
 
629 629
 
@@ -638,212 +638,212 @@  discard block
 block discarded – undo
638 638
  */
639 639
 function geodir_get_taxonomy_posttype($taxonomy = '')
640 640
 {
641
-    global $wp_query;
642
-
643
-    $post_type = array();
644
-    $taxonomies = array();
645
-
646
-    if (!empty($taxonomy)) {
647
-        $taxonomies[] = $taxonomy;
648
-    } elseif (isset($wp_query->tax_query->queries)) {
649
-        $tax_arr = $wp_query->tax_query->queries;
650
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
651
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
652
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
653
-    }
654
-
655
-    if (!empty($taxonomies)) {
656
-        foreach (geodir_get_posttypes() as $pt) {
657
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
658
-            if (array_intersect($taxonomies, $object_taxonomies))
659
-                $post_type[] = $pt;
660
-        }
661
-    }
662
-
663
-    if (!empty($post_type))
664
-        return $post_type[0];
665
-    else
666
-        return false;
641
+	global $wp_query;
642
+
643
+	$post_type = array();
644
+	$taxonomies = array();
645
+
646
+	if (!empty($taxonomy)) {
647
+		$taxonomies[] = $taxonomy;
648
+	} elseif (isset($wp_query->tax_query->queries)) {
649
+		$tax_arr = $wp_query->tax_query->queries;
650
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
651
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
652
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
653
+	}
654
+
655
+	if (!empty($taxonomies)) {
656
+		foreach (geodir_get_posttypes() as $pt) {
657
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
658
+			if (array_intersect($taxonomies, $object_taxonomies))
659
+				$post_type[] = $pt;
660
+		}
661
+	}
662
+
663
+	if (!empty($post_type))
664
+		return $post_type[0];
665
+	else
666
+		return false;
667 667
 }
668 668
 
669 669
 if (!function_exists('geodir_custom_taxonomy_walker')) {
670
-    /**
671
-     * Custom taxonomy walker function.
672
-     *
673
-     * @since 1.0.0
674
-     * @package GeoDirectory
675
-     * @param string $cat_taxonomy The taxonomy name.
676
-     * @param int $cat_parent The parent term ID.
677
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
678
-     * @param int $pading CSS padding in pixels.
679
-     * @return string|void taxonomy HTML.
680
-     */
681
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
682
-    {
683
-        global $cat_display, $post_cat, $exclude_cats;
684
-
685
-        $search_terms = trim($post_cat, ",");
686
-
687
-        $search_terms = explode(",", $search_terms);
688
-
689
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
690
-
691
-        $display = '';
692
-        $onchange = '';
693
-        $term_check = '';
694
-        $main_list_class = '';
695
-        $out = '';
696
-        //If there are terms, start displaying
697
-        if (count($cat_terms) > 0) {
698
-            //Displaying as a list
699
-            $p = $pading * 20;
700
-            $pading++;
701
-
702
-
703
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
704
-                if ($cat_parent == 0) {
705
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
706
-                    $main_list_class = 'class="main_list_selecter"';
707
-                } else {
708
-                    //$display = 'display:none';
709
-                    $list_class = 'sub_list gd-sub-cats-list';
710
-                }
711
-            }
670
+	/**
671
+	 * Custom taxonomy walker function.
672
+	 *
673
+	 * @since 1.0.0
674
+	 * @package GeoDirectory
675
+	 * @param string $cat_taxonomy The taxonomy name.
676
+	 * @param int $cat_parent The parent term ID.
677
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
678
+	 * @param int $pading CSS padding in pixels.
679
+	 * @return string|void taxonomy HTML.
680
+	 */
681
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
682
+	{
683
+		global $cat_display, $post_cat, $exclude_cats;
684
+
685
+		$search_terms = trim($post_cat, ",");
686
+
687
+		$search_terms = explode(",", $search_terms);
688
+
689
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
690
+
691
+		$display = '';
692
+		$onchange = '';
693
+		$term_check = '';
694
+		$main_list_class = '';
695
+		$out = '';
696
+		//If there are terms, start displaying
697
+		if (count($cat_terms) > 0) {
698
+			//Displaying as a list
699
+			$p = $pading * 20;
700
+			$pading++;
701
+
702
+
703
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
704
+				if ($cat_parent == 0) {
705
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
706
+					$main_list_class = 'class="main_list_selecter"';
707
+				} else {
708
+					//$display = 'display:none';
709
+					$list_class = 'sub_list gd-sub-cats-list';
710
+				}
711
+			}
712 712
 
713
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
714
-                $p = 0;
715
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
716
-            }
713
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
714
+				$p = 0;
715
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
716
+			}
717 717
 
718
-            foreach ($cat_terms as $cat_term) {
718
+			foreach ($cat_terms as $cat_term) {
719 719
 
720
-                $checked = '';
720
+				$checked = '';
721 721
 
722
-                if (in_array($cat_term->term_id, $search_terms)) {
723
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
724
-                        $checked = 'selected="selected"';
725
-                    else
726
-                        $checked = 'checked="checked"';
727
-                }
722
+				if (in_array($cat_term->term_id, $search_terms)) {
723
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
724
+						$checked = 'selected="selected"';
725
+					else
726
+						$checked = 'checked="checked"';
727
+				}
728 728
 
729
-                if ($cat_display == 'radio')
730
-                    $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>';
731
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
732
-                    $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>';
729
+				if ($cat_display == 'radio')
730
+					$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>';
731
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
732
+					$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>';
733 733
 
734
-                else {
735
-                    $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>';
736
-                }
734
+				else {
735
+					$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>';
736
+				}
737 737
 
738
-                // Call recurson to print sub cats
739
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
738
+				// Call recurson to print sub cats
739
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
740 740
 
741
-            }
741
+			}
742 742
 
743
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
744
-                $out .= '</div>';
743
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
744
+				$out .= '</div>';
745 745
 
746
-            return $out;
747
-        }
748
-        return;
749
-    }
746
+			return $out;
747
+		}
748
+		return;
749
+	}
750 750
 }
751 751
 
752 752
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
753
-    /**
754
-     * Custom taxonomy walker function.
755
-     *
756
-     * @since 1.0.0
757
-     * @package GeoDirectory
758
-     * @global object $post WordPress Post object.
759
-     * @global object $gd_session GeoDirectory Session object.
760
-     * @param string $cat_taxonomy The taxonomy name.
761
-     * @param string $cat_limit Number of categories to display.
762
-     */
763
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
764
-    {
765
-        $post_category = '';
766
-        $post_category_str = '';
767
-        global $exclude_cats, $gd_session;
768
-
769
-        $cat_exclude = '';
770
-        if (is_array($exclude_cats) && !empty($exclude_cats))
771
-            $cat_exclude = serialize($exclude_cats);
772
-
773
-        if (isset($_REQUEST['backandedit'])) {
774
-            $post = (object)$gd_session->get('listing');
775
-
776
-            if (!is_array($post->post_category[$cat_taxonomy]))
777
-                $post_category = $post->post_category[$cat_taxonomy];
778
-
779
-            $post_categories = $post->post_category_str;
780
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
781
-                $post_category_str = $post_categories[$cat_taxonomy];
782
-
783
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
784
-            global $post;
785
-
786
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
787
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
788
-                $post_category = $post->{$cat_taxonomy};
789
-            }
753
+	/**
754
+	 * Custom taxonomy walker function.
755
+	 *
756
+	 * @since 1.0.0
757
+	 * @package GeoDirectory
758
+	 * @global object $post WordPress Post object.
759
+	 * @global object $gd_session GeoDirectory Session object.
760
+	 * @param string $cat_taxonomy The taxonomy name.
761
+	 * @param string $cat_limit Number of categories to display.
762
+	 */
763
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
764
+	{
765
+		$post_category = '';
766
+		$post_category_str = '';
767
+		global $exclude_cats, $gd_session;
768
+
769
+		$cat_exclude = '';
770
+		if (is_array($exclude_cats) && !empty($exclude_cats))
771
+			$cat_exclude = serialize($exclude_cats);
772
+
773
+		if (isset($_REQUEST['backandedit'])) {
774
+			$post = (object)$gd_session->get('listing');
775
+
776
+			if (!is_array($post->post_category[$cat_taxonomy]))
777
+				$post_category = $post->post_category[$cat_taxonomy];
778
+
779
+			$post_categories = $post->post_category_str;
780
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
781
+				$post_category_str = $post_categories[$cat_taxonomy];
782
+
783
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
784
+			global $post;
785
+
786
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
787
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
788
+				$post_category = $post->{$cat_taxonomy};
789
+			}
790 790
 
791
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
791
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
792 792
 
793
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
794
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
795
-                    if (is_numeric($cat_part)) {
796
-                        $cat_part_arr[] = $cat_part;
797
-                    }
798
-                }
799
-                if (is_array($cat_part_arr)) {
800
-                    $post_category = implode(',', $cat_part_arr);
801
-                }
802
-            }
793
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
794
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
795
+					if (is_numeric($cat_part)) {
796
+						$cat_part_arr[] = $cat_part;
797
+					}
798
+				}
799
+				if (is_array($cat_part_arr)) {
800
+					$post_category = implode(',', $cat_part_arr);
801
+				}
802
+			}
803 803
 
804
-            if (!empty($post_category)) {
805
-                $cat1 = array_filter(explode(',', $post_category));
806
-                $post_category = ',' . implode(',', $cat1) . ',';
804
+			if (!empty($post_category)) {
805
+				$cat1 = array_filter(explode(',', $post_category));
806
+				$post_category = ',' . implode(',', $cat1) . ',';
807 807
 
808
-            }
808
+			}
809 809
 
810
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
810
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
811 811
 
812
-                $post_category_upd = explode(',', $post_category);
813
-                $post_category_change = '';
814
-                foreach ($post_category_upd as $cat) {
812
+				$post_category_upd = explode(',', $post_category);
813
+				$post_category_change = '';
814
+				foreach ($post_category_upd as $cat) {
815 815
 
816
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
817
-                        $post_category_change .= ',' . $cat;
818
-                    }
819
-                }
820
-                $post_category = $post_category_change;
821
-            }
816
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
817
+						$post_category_change .= ',' . $cat;
818
+					}
819
+				}
820
+				$post_category = $post_category_change;
821
+			}
822 822
 
823 823
 
824
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
825
-                $post_category_str = $post_categories[$cat_taxonomy];
826
-            }
827
-        }
824
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
825
+				$post_category_str = $post_categories[$cat_taxonomy];
826
+			}
827
+		}
828 828
 
829
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
829
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
830 830
 
831
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
831
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
832 832
 
833
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
833
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
834 834
 
835 835
 
836
-        ?>
836
+		?>
837 837
         <div class="cat_sublist">
838 838
             <?php
839 839
 
840
-            $post_id = isset($post->ID) ? $post->ID : '';
840
+			$post_id = isset($post->ID) ? $post->ID : '';
841 841
 
842
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
842
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
843 843
 
844
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
845
-            }
846
-            ?>
844
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
845
+			}
846
+			?>
847 847
         </div>
848 848
         <script type="text/javascript">
849 849
 
@@ -966,22 +966,22 @@  discard block
 block discarded – undo
966 966
 
967 967
         </script>
968 968
         <?php
969
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
970
-            $post_cat_str = $post_categories[$cat_taxonomy];
971
-            $post_cat_array = explode("#", $post_cat_str);
972
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
973
-                $style = "display:none;";
974
-        }
975
-        ?>
969
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
970
+			$post_cat_str = $post_categories[$cat_taxonomy];
971
+			$post_cat_array = explode("#", $post_cat_str);
972
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
973
+				$style = "display:none;";
974
+		}
975
+		?>
976 976
         <div class="main_cat_list" style=" <?php if (isset($style)) {
977
-            echo $style;
978
-        }?> ">
977
+			echo $style;
978
+		}?> ">
979 979
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
980
-            ?>
980
+			?>
981 981
         </div>
982 982
     <?php
983 983
 
984
-    }
984
+	}
985 985
 }
986 986
 
987 987
 /**
@@ -998,23 +998,23 @@  discard block
 block discarded – undo
998 998
  */
999 999
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1000 1000
 {
1001
-    global $exclude_cats;
1001
+	global $exclude_cats;
1002 1002
 
1003
-    if ($exclude != '') {
1004
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1003
+	if ($exclude != '') {
1004
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1005 1005
 
1006
-        if(is_array( $exclude_cats)){
1007
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1008
-        }else{
1009
-            $exclude_cats = intval($exclude_cats);
1010
-        }
1006
+		if(is_array( $exclude_cats)){
1007
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1008
+		}else{
1009
+			$exclude_cats = intval($exclude_cats);
1010
+		}
1011 1011
 
1012
-    }
1012
+	}
1013 1013
 
1014
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1015
-        (!is_array($exclude_cats) || empty($exclude_cats))
1016
-    ) {
1017
-        ?>
1014
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1015
+		(!is_array($exclude_cats) || empty($exclude_cats))
1016
+	) {
1017
+		?>
1018 1018
 
1019 1019
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1020 1020
 
@@ -1043,8 +1043,8 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
             <br/>
1045 1045
             <?php
1046
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1047
-            if (!empty($cat_terms)) { ?>
1046
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1047
+			if (!empty($cat_terms)) { ?>
1048 1048
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1049 1049
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1050 1050
             <?php } ?>
@@ -1066,53 +1066,53 @@  discard block
 block discarded – undo
1066 1066
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1067 1067
 {
1068 1068
 
1069
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1070
-        $post_cat_str = $post_categories[$request_taxonomy];
1071
-        $post_cat_array = explode("#", $post_cat_str);
1072
-        if (is_array($post_cat_array)) {
1073
-            $post_cat_array = array_unique( $post_cat_array );
1069
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1070
+		$post_cat_str = $post_categories[$request_taxonomy];
1071
+		$post_cat_array = explode("#", $post_cat_str);
1072
+		if (is_array($post_cat_array)) {
1073
+			$post_cat_array = array_unique( $post_cat_array );
1074 1074
 
1075 1075
 			foreach ($post_cat_array as $post_cat_html) {
1076 1076
 
1077
-                $post_cat_info = explode(":", $post_cat_html);
1078
-                $post_maincat_str = $post_cat_info[0];
1077
+				$post_cat_info = explode(":", $post_cat_html);
1078
+				$post_maincat_str = $post_cat_info[0];
1079 1079
 
1080
-                if (!empty($post_maincat_str)) {
1081
-                    $post_maincat_info = explode(",", $post_maincat_str);
1082
-                    $post_maincat_id = $post_maincat_info[0];
1083
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1084
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1085
-                }
1086
-                $post_sub_catid = '';
1087
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1088
-                    $post_sub_catid = (int)$post_cat_info[1];
1089
-                }
1080
+				if (!empty($post_maincat_str)) {
1081
+					$post_maincat_info = explode(",", $post_maincat_str);
1082
+					$post_maincat_id = $post_maincat_info[0];
1083
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1084
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1085
+				}
1086
+				$post_sub_catid = '';
1087
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1088
+					$post_sub_catid = (int)$post_cat_info[1];
1089
+				}
1090 1090
 
1091
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1091
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1092 1092
 
1093
-            }
1094
-        } else {
1093
+			}
1094
+		} else {
1095 1095
 
1096
-            $post_cat_info = explode(":", $post_cat_str);
1097
-            $post_maincat_str = $post_cat_info[0];
1096
+			$post_cat_info = explode(":", $post_cat_str);
1097
+			$post_maincat_str = $post_cat_info[0];
1098 1098
 
1099
-            $post_sub_catid = '';
1099
+			$post_sub_catid = '';
1100 1100
 
1101
-            if (!empty($post_maincat_str)) {
1102
-                $post_maincat_info = explode(",", $post_maincat_str);
1103
-                $post_maincat_id = $post_maincat_info[0];
1104
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1105
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1106
-            }
1101
+			if (!empty($post_maincat_str)) {
1102
+				$post_maincat_info = explode(",", $post_maincat_str);
1103
+				$post_maincat_id = $post_maincat_info[0];
1104
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1105
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1106
+			}
1107 1107
 
1108
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1109
-                $post_sub_catid = (int)$post_cat_info[1];
1110
-            }
1108
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1109
+				$post_sub_catid = (int)$post_cat_info[1];
1110
+			}
1111 1111
 
1112
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1112
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1113 1113
 
1114
-        }
1115
-    }
1114
+		}
1115
+	}
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1126,35 +1126,35 @@  discard block
 block discarded – undo
1126 1126
  */
1127 1127
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1128 1128
 {
1129
-    global $exclude_cats;
1129
+	global $exclude_cats;
1130 1130
 
1131
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1131
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1132 1132
 
1133
-    if (!empty($cat_terms)) {
1134
-        $onchange = '';
1135
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1133
+	if (!empty($cat_terms)) {
1134
+		$onchange = '';
1135
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1136 1136
 
1137
-        $option_selected = '';
1138
-        if (!$selected)
1139
-            $option_slected = ' selected="selected" ';
1137
+		$option_selected = '';
1138
+		if (!$selected)
1139
+			$option_slected = ' selected="selected" ';
1140 1140
 
1141
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1141
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1142 1142
 
1143
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1143
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1144 1144
 
1145
-        foreach ($cat_terms as $cat_term) {
1146
-            $option_selected = '';
1147
-            if ($selected == $cat_term->term_id)
1148
-                $option_selected = ' selected="selected" ';
1145
+		foreach ($cat_terms as $cat_term) {
1146
+			$option_selected = '';
1147
+			if ($selected == $cat_term->term_id)
1148
+				$option_selected = ' selected="selected" ';
1149 1149
 
1150
-            // Count child terms
1151
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1152
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1150
+			// Count child terms
1151
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1152
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1153 1153
 
1154
-            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>';
1155
-        }
1156
-        echo '</select>';
1157
-    }
1154
+			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>';
1155
+		}
1156
+		echo '</select>';
1157
+	}
1158 1158
 }
1159 1159
 
1160 1160
 /**
@@ -1170,28 +1170,28 @@  discard block
 block discarded – undo
1170 1170
  */
1171 1171
 function geodir_custom_update_messages($messages)
1172 1172
 {
1173
-    global $post, $post_ID;
1174
-
1175
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1176
-
1177
-    foreach ($post_types as $post_type => $post_object) {
1178
-
1179
-        $messages[$post_type] = array(
1180
-            0 => '', // Unused. Messages start at index 1.
1181
-            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),
1182
-            2 => __('Custom field updated.', 'geodirectory'),
1183
-            3 => __('Custom field deleted.', 'geodirectory'),
1184
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1185
-            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,
1186
-            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),
1187
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1188
-            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),
1189
-            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),
1190
-            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),
1191
-        );
1192
-    }
1193
-
1194
-    return $messages;
1173
+	global $post, $post_ID;
1174
+
1175
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1176
+
1177
+	foreach ($post_types as $post_type => $post_object) {
1178
+
1179
+		$messages[$post_type] = array(
1180
+			0 => '', // Unused. Messages start at index 1.
1181
+			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),
1182
+			2 => __('Custom field updated.', 'geodirectory'),
1183
+			3 => __('Custom field deleted.', 'geodirectory'),
1184
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1185
+			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,
1186
+			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),
1187
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1188
+			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),
1189
+			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),
1190
+			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),
1191
+		);
1192
+	}
1193
+
1194
+	return $messages;
1195 1195
 }
1196 1196
 
1197 1197
 
@@ -1206,181 +1206,181 @@  discard block
 block discarded – undo
1206 1206
 function geodir_register_defaults()
1207 1207
 {
1208 1208
 
1209
-    global $wpdb;
1210
-
1211
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1212
-
1213
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1214
-        $listing_slug = 'places';
1215
-
1216
-    /**
1217
-     * Taxonomies
1218
-     **/
1219
-    //if ( ! taxonomy_exists('gd_place_tags') )
1220
-    {
1221
-
1222
-        $gd_placetags = array();
1223
-        $gd_placetags['object_type'] = 'gd_place';
1224
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1225
-        $gd_placetags['args'] = array(
1226
-            'public' => true,
1227
-            'hierarchical' => false,
1228
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1229
-            'query_var' => true,
1230
-
1231
-            'labels' => array(
1232
-                'name' => __('Place Tags', 'geodirectory'),
1233
-                'singular_name' => __('Place Tag', 'geodirectory'),
1234
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1235
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1236
-                'all_items' => __('All Place Tags', 'geodirectory'),
1237
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1238
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1239
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1240
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1241
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1242
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1243
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1244
-            ),
1245
-        );
1246
-
1247
-
1248
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1249
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1250
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1251
-
1252
-
1253
-        // Update post types and delete tmp options
1254
-        flush_rewrite_rules();
1255
-
1256
-    }
1257
-
1258
-    //if ( ! taxonomy_exists('gd_placecategory') )
1259
-    {
1260
-
1261
-        $gd_placecategory = array();
1262
-        $gd_placecategory['object_type'] = 'gd_place';
1263
-        $gd_placecategory['listing_slug'] = $listing_slug;
1264
-        $gd_placecategory['args'] = array(
1265
-            'public' => true,
1266
-            'hierarchical' => true,
1267
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1268
-            'query_var' => true,
1269
-            'labels' => array(
1270
-                'name' => __('Place Categories', 'geodirectory'),
1271
-                'singular_name' => __('Place Category', 'geodirectory'),
1272
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1273
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1274
-                'all_items' => __('All Place Categories', 'geodirectory'),
1275
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1276
-                'update_item' => __('Update Place Category', 'geodirectory'),
1277
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1278
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1279
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1280
-            ),
1281
-        );
1282
-
1283
-
1284
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1285
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1286
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1287
-
1288
-
1289
-        flush_rewrite_rules();
1290
-    }
1291
-
1292
-    /**
1293
-     * Post Types
1294
-     **/
1295
-
1296
-    //if ( ! post_type_exists('gd_place') )
1297
-    {
1298
-
1299
-        $labels = array(
1300
-            'name' => __('Places', 'geodirectory'),
1301
-            'singular_name' => __('Place', 'geodirectory'),
1302
-            'add_new' => __('Add New', 'geodirectory'),
1303
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1304
-            'edit_item' => __('Edit Place', 'geodirectory'),
1305
-            'new_item' => __('New Place', 'geodirectory'),
1306
-            'view_item' => __('View Place', 'geodirectory'),
1307
-            'search_items' => __('Search Places', 'geodirectory'),
1308
-            'not_found' => __('No Place Found', 'geodirectory'),
1309
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1310
-
1311
-        $place_default = array(
1312
-            'labels' => $labels,
1313
-            'can_export' => true,
1314
-            'capability_type' => 'post',
1315
-            'description' => 'Place post type.',
1316
-            'has_archive' => $listing_slug,
1317
-            'hierarchical' => false,
1318
-            'map_meta_cap' => true,
1319
-            'menu_icon' => $menu_icon,
1320
-            'public' => true,
1321
-            'query_var' => true,
1322
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1323
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1324
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1325
-
1326
-        //Update custom post types
1327
-        $geodir_post_types = get_option('geodir_post_types');
1328
-        $geodir_post_types['gd_place'] = $place_default;
1329
-        update_option('geodir_post_types', $geodir_post_types);
1330
-
1331
-        // Update post types and delete tmp options
1332
-        flush_rewrite_rules();
1333
-    }
1334
-
1335
-
1336
-    geodir_register_taxonomies();
1337
-    geodir_register_post_types();
1338
-
1339
-    //die;
1209
+	global $wpdb;
1210
+
1211
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1212
+
1213
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1214
+		$listing_slug = 'places';
1215
+
1216
+	/**
1217
+	 * Taxonomies
1218
+	 **/
1219
+	//if ( ! taxonomy_exists('gd_place_tags') )
1220
+	{
1221
+
1222
+		$gd_placetags = array();
1223
+		$gd_placetags['object_type'] = 'gd_place';
1224
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1225
+		$gd_placetags['args'] = array(
1226
+			'public' => true,
1227
+			'hierarchical' => false,
1228
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1229
+			'query_var' => true,
1230
+
1231
+			'labels' => array(
1232
+				'name' => __('Place Tags', 'geodirectory'),
1233
+				'singular_name' => __('Place Tag', 'geodirectory'),
1234
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1235
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1236
+				'all_items' => __('All Place Tags', 'geodirectory'),
1237
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1238
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1239
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1240
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1241
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1242
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1243
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1244
+			),
1245
+		);
1246
+
1247
+
1248
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1249
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1250
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1251
+
1252
+
1253
+		// Update post types and delete tmp options
1254
+		flush_rewrite_rules();
1255
+
1256
+	}
1257
+
1258
+	//if ( ! taxonomy_exists('gd_placecategory') )
1259
+	{
1260
+
1261
+		$gd_placecategory = array();
1262
+		$gd_placecategory['object_type'] = 'gd_place';
1263
+		$gd_placecategory['listing_slug'] = $listing_slug;
1264
+		$gd_placecategory['args'] = array(
1265
+			'public' => true,
1266
+			'hierarchical' => true,
1267
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1268
+			'query_var' => true,
1269
+			'labels' => array(
1270
+				'name' => __('Place Categories', 'geodirectory'),
1271
+				'singular_name' => __('Place Category', 'geodirectory'),
1272
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1273
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1274
+				'all_items' => __('All Place Categories', 'geodirectory'),
1275
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1276
+				'update_item' => __('Update Place Category', 'geodirectory'),
1277
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1278
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1279
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1280
+			),
1281
+		);
1282
+
1283
+
1284
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1285
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1286
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1287
+
1288
+
1289
+		flush_rewrite_rules();
1290
+	}
1291
+
1292
+	/**
1293
+	 * Post Types
1294
+	 **/
1295
+
1296
+	//if ( ! post_type_exists('gd_place') )
1297
+	{
1298
+
1299
+		$labels = array(
1300
+			'name' => __('Places', 'geodirectory'),
1301
+			'singular_name' => __('Place', 'geodirectory'),
1302
+			'add_new' => __('Add New', 'geodirectory'),
1303
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1304
+			'edit_item' => __('Edit Place', 'geodirectory'),
1305
+			'new_item' => __('New Place', 'geodirectory'),
1306
+			'view_item' => __('View Place', 'geodirectory'),
1307
+			'search_items' => __('Search Places', 'geodirectory'),
1308
+			'not_found' => __('No Place Found', 'geodirectory'),
1309
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1310
+
1311
+		$place_default = array(
1312
+			'labels' => $labels,
1313
+			'can_export' => true,
1314
+			'capability_type' => 'post',
1315
+			'description' => 'Place post type.',
1316
+			'has_archive' => $listing_slug,
1317
+			'hierarchical' => false,
1318
+			'map_meta_cap' => true,
1319
+			'menu_icon' => $menu_icon,
1320
+			'public' => true,
1321
+			'query_var' => true,
1322
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1323
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1324
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1325
+
1326
+		//Update custom post types
1327
+		$geodir_post_types = get_option('geodir_post_types');
1328
+		$geodir_post_types['gd_place'] = $place_default;
1329
+		update_option('geodir_post_types', $geodir_post_types);
1330
+
1331
+		// Update post types and delete tmp options
1332
+		flush_rewrite_rules();
1333
+	}
1334
+
1335
+
1336
+	geodir_register_taxonomies();
1337
+	geodir_register_post_types();
1338
+
1339
+	//die;
1340 1340
 
1341 1341
 }
1342 1342
 
1343 1343
 $gd_wpml_get_languages = "";
1344 1344
 function gd_wpml_get_lang_from_url($url){
1345 1345
 
1346
-    global $gd_wpml_get_languages;
1347
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1346
+	global $gd_wpml_get_languages;
1347
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1348 1348
 
1349 1349
 
1350
-    //
1351
-    $url = str_replace(array("http://","https://"),"",$url);
1352
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1350
+	//
1351
+	$url = str_replace(array("http://","https://"),"",$url);
1352
+	$site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1353 1353
 
1354
-    $url = str_replace($site_url,"",$url);
1354
+	$url = str_replace($site_url,"",$url);
1355 1355
 
1356 1356
 
1357
-    $segments = explode('/', trim($url, '/'));
1357
+	$segments = explode('/', trim($url, '/'));
1358 1358
 
1359
-    //print_r( $segments);
1360
-    if($gd_wpml_get_languages){
1361
-        $langs = $gd_wpml_get_languages;
1362
-    }else{
1363
-        global $sitepress;
1364
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1365
-    }
1359
+	//print_r( $segments);
1360
+	if($gd_wpml_get_languages){
1361
+		$langs = $gd_wpml_get_languages;
1362
+	}else{
1363
+		global $sitepress;
1364
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1365
+	}
1366 1366
 
1367
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1368
-        return $segments[0];
1369
-    }
1367
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1368
+		return $segments[0];
1369
+	}
1370 1370
 
1371
-    return false;
1371
+	return false;
1372 1372
 
1373 1373
 
1374 1374
 }
1375 1375
 
1376 1376
 function gd_wpml_slug_translation_turned_on($post_type) {
1377 1377
 
1378
-    global $sitepress;
1379
-    $settings = $sitepress->get_settings();
1380
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1381
-    && $settings['posts_slug_translation']['types'][$post_type]
1382
-    && isset($settings['posts_slug_translation']['on'])
1383
-    && $settings['posts_slug_translation']['on'];
1378
+	global $sitepress;
1379
+	$settings = $sitepress->get_settings();
1380
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1381
+	&& $settings['posts_slug_translation']['types'][$post_type]
1382
+	&& isset($settings['posts_slug_translation']['on'])
1383
+	&& $settings['posts_slug_translation']['on'];
1384 1384
 }
1385 1385
 
1386 1386
 
@@ -1405,150 +1405,150 @@  discard block
 block discarded – undo
1405 1405
  */
1406 1406
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1407 1407
 {
1408
-    //echo $post_link."<br />".$sample ;
1408
+	//echo $post_link."<br />".$sample ;
1409 1409
 
1410 1410
 
1411
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1412
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1413
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1414
-        return $post_link;
1415
-    } else {
1416
-        $orig_post = $post;
1417
-        $post = $post_obj;
1418
-    }
1411
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1412
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1413
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1414
+		return $post_link;
1415
+	} else {
1416
+		$orig_post = $post;
1417
+		$post = $post_obj;
1418
+	}
1419 1419
 
1420
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1420
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1421 1421
 
1422 1422
 
1423
-        $post_types = get_option('geodir_post_types');
1424
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1423
+		$post_types = get_option('geodir_post_types');
1424
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1425 1425
 
1426
-        // Alter the CPT slug if WPML is set to do so
1427
-        if(function_exists('icl_object_id')){
1428
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1426
+		// Alter the CPT slug if WPML is set to do so
1427
+		if(function_exists('icl_object_id')){
1428
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1429 1429
 
1430
-                $org_slug = $slug;
1431
-                $slug = apply_filters( 'wpml_translate_single_string',
1432
-                    $slug,
1433
-                    'WordPress',
1434
-                    'URL slug: ' . $slug,
1435
-                    $language_code);
1430
+				$org_slug = $slug;
1431
+				$slug = apply_filters( 'wpml_translate_single_string',
1432
+					$slug,
1433
+					'WordPress',
1434
+					'URL slug: ' . $slug,
1435
+					$language_code);
1436 1436
 
1437
-                if(!$slug){$slug = $org_slug;}
1437
+				if(!$slug){$slug = $org_slug;}
1438 1438
 
1439
-            }
1440
-        }
1439
+			}
1440
+		}
1441 1441
 
1442
-        if (function_exists('geodir_location_geo_home_link')) {
1443
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1444
-        }
1442
+		if (function_exists('geodir_location_geo_home_link')) {
1443
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1444
+		}
1445 1445
         
1446
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1447
-        $site_url = trailingslashit(get_bloginfo('url'));
1446
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1447
+		$site_url = trailingslashit(get_bloginfo('url'));
1448 1448
         
1449
-        if (function_exists('geodir_location_geo_home_link')) {
1450
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1451
-        }
1452
-
1453
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1454
-        if ($fix_url) {
1455
-            $post_link = str_replace($site_url, '', $post_link);
1456
-        }
1449
+		if (function_exists('geodir_location_geo_home_link')) {
1450
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1451
+		}
1452
+
1453
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1454
+		if ($fix_url) {
1455
+			$post_link = str_replace($site_url, '', $post_link);
1456
+		}
1457 1457
         
1458
-        $post_link = trailingslashit(
1459
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1460
-        );
1461
-
1462
-        if ($fix_url) {
1463
-            $post_link = $site_url . $post_link;
1464
-        }
1465
-
1466
-        if (isset($comment_post_cache[$post->ID])) {
1467
-            $post = $comment_post_cache[$post->ID];
1468
-        }
1469
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1470
-            $post_id = $post->ID;
1471
-            if (isset($orig_post)) {
1472
-                $post = $orig_post;
1473
-            }
1474
-            return $gd_permalink_cache[$post_id];
1475
-        }
1458
+		$post_link = trailingslashit(
1459
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1460
+		);
1476 1461
 
1477
-        if (!isset($post->post_locations)) {
1478
-            $post_type = $post->post_type;
1479
-            $ID = $post->ID;
1480
-            $post2 = $wpdb->get_row(
1481
-                $wpdb->prepare(
1482
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1483
-                    array($post->ID)
1484
-                )
1485
-            );
1462
+		if ($fix_url) {
1463
+			$post_link = $site_url . $post_link;
1464
+		}
1486 1465
 
1487
-            $post = (object)array_merge((array)$post, (array)$post2);
1466
+		if (isset($comment_post_cache[$post->ID])) {
1467
+			$post = $comment_post_cache[$post->ID];
1468
+		}
1469
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1470
+			$post_id = $post->ID;
1471
+			if (isset($orig_post)) {
1472
+				$post = $orig_post;
1473
+			}
1474
+			return $gd_permalink_cache[$post_id];
1475
+		}
1488 1476
 
1489
-            $comment_post_cache[$post->ID] = $post;
1490
-        }
1477
+		if (!isset($post->post_locations)) {
1478
+			$post_type = $post->post_type;
1479
+			$ID = $post->ID;
1480
+			$post2 = $wpdb->get_row(
1481
+				$wpdb->prepare(
1482
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1483
+					array($post->ID)
1484
+				)
1485
+			);
1491 1486
 
1487
+			$post = (object)array_merge((array)$post, (array)$post2);
1492 1488
 
1489
+			$comment_post_cache[$post->ID] = $post;
1490
+		}
1493 1491
 
1494
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1495 1492
 
1496
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1497
-                $location_request = '';
1498 1493
 
1494
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1499 1495
 
1500
-                if (!empty($post->post_locations)) {
1501
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1502
-                    if (count($geodir_arr_locations) == 3) {
1503
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1504
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1505
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1506
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1507
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1508
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1496
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1497
+				$location_request = '';
1509 1498
 
1510
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1511
-                            'region_slug' => $post->region_slug,
1512
-                            'city_slug' => $post->city_slug
1513
-                        );
1514 1499
 
1515
-                    } else
1516
-                        $post_location = geodir_get_location();
1500
+				if (!empty($post->post_locations)) {
1501
+					$geodir_arr_locations = explode(',', $post->post_locations);
1502
+					if (count($geodir_arr_locations) == 3) {
1503
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1504
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1505
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1506
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1507
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1508
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1517 1509
 
1510
+						$post_location = (object)array('country_slug' => $post->country_slug,
1511
+							'region_slug' => $post->region_slug,
1512
+							'city_slug' => $post->city_slug
1513
+						);
1518 1514
 
1519
-                } else {
1515
+					} else
1516
+						$post_location = geodir_get_location();
1520 1517
 
1521
-                    $post_location_sql = $wpdb->get_results(
1522
-                        $wpdb->prepare(
1523
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1524
-                            array($post->ID)
1525
-                        )
1526
-                    );
1527
-
1528
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1529
-
1530
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1531
-                        if (count($geodir_arr_locations) == 3) {
1532
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1533
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1534
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1535
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1536
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1537
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1538
-
1539
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1540
-                                'region_slug' => $post->region_slug,
1541
-                                'city_slug' => $post->city_slug
1542
-                            );
1543 1518
 
1544
-                        }
1545
-                    } else
1546
-                        $post_location = geodir_get_location();
1547
-                }
1519
+				} else {
1548 1520
 
1521
+					$post_location_sql = $wpdb->get_results(
1522
+						$wpdb->prepare(
1523
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1524
+							array($post->ID)
1525
+						)
1526
+					);
1527
+
1528
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1529
+
1530
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1531
+						if (count($geodir_arr_locations) == 3) {
1532
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1533
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1534
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1535
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1536
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1537
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1538
+
1539
+							$post_location = (object)array('country_slug' => $post->country_slug,
1540
+								'region_slug' => $post->region_slug,
1541
+								'city_slug' => $post->city_slug
1542
+							);
1543
+
1544
+						}
1545
+					} else
1546
+						$post_location = geodir_get_location();
1547
+				}
1549 1548
 
1550
-                if (!empty($post_location)) {
1551
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1549
+
1550
+				if (!empty($post_location)) {
1551
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1552 1552
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1553 1553
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1554 1554
 					
@@ -1566,78 +1566,78 @@  discard block
 block discarded – undo
1566 1566
 					$location_slug[] = $city_slug;
1567 1567
 					
1568 1568
 					$location_request .= implode('/', $location_slug) . '/';
1569
-                }
1570
-            }
1569
+				}
1570
+			}
1571 1571
 
1572
-            if (get_option('geodir_add_categories_url')) {
1572
+			if (get_option('geodir_add_categories_url')) {
1573 1573
 
1574
-                $term_request = '';
1575
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1574
+				$term_request = '';
1575
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1576 1576
 
1577
-                $taxonomies = end($taxonomies);
1577
+				$taxonomies = end($taxonomies);
1578 1578
 
1579
-                if (!empty($post->default_category)) {
1580
-                    $post_terms = $post->default_category;
1581
-                } else {
1582
-                    $post_terms = '';
1579
+				if (!empty($post->default_category)) {
1580
+					$post_terms = $post->default_category;
1581
+				} else {
1582
+					$post_terms = '';
1583 1583
 
1584
-                    if (isset($post->{$taxonomies})) {
1585
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1586
-                        $post_terms = $post_terms[0];
1587
-                    }
1584
+					if (isset($post->{$taxonomies})) {
1585
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1586
+						$post_terms = $post_terms[0];
1587
+					}
1588 1588
 
1589
-                    if (!$post_terms)
1590
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1589
+					if (!$post_terms)
1590
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1591 1591
 
1592
-                    if (!$post_terms) {
1593
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1592
+					if (!$post_terms) {
1593
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1594 1594
 
1595
-                        if ($post_terms) {
1596
-                            $post_terms = explode(",", trim($post_terms, ","));
1597
-                            $post_terms = $post_terms[0];
1598
-                        }
1599
-                    }
1600
-                }
1595
+						if ($post_terms) {
1596
+							$post_terms = explode(",", trim($post_terms, ","));
1597
+							$post_terms = $post_terms[0];
1598
+						}
1599
+					}
1600
+				}
1601 1601
 
1602
-                $term = get_term_by('id', $post_terms, $taxonomies);
1602
+				$term = get_term_by('id', $post_terms, $taxonomies);
1603 1603
 
1604
-                if (!empty($term))
1605
-                    $term_request = $term->slug;
1606
-                //$term_request = $term->slug.'/';
1607
-            }
1604
+				if (!empty($term))
1605
+					$term_request = $term->slug;
1606
+				//$term_request = $term->slug.'/';
1607
+			}
1608 1608
 
1609
-            $request_term = '';
1610
-            $listingurl_separator = '';
1611
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1612
-            $detailurl_separator = '';
1613
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1614
-                $request_term = $location_request;
1615
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1616
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1617
-                $request_term .= $term_request;
1609
+			$request_term = '';
1610
+			$listingurl_separator = '';
1611
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1612
+			$detailurl_separator = '';
1613
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1614
+				$request_term = $location_request;
1615
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1616
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1617
+				$request_term .= $term_request;
1618 1618
 
1619
-            } else {
1620
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1619
+			} else {
1620
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1621 1621
 
1622
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1623
-            }
1624
-            $request_term = trim($request_term, '/');
1625
-            if (!empty($request_term))
1626
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1627
-            else
1628
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1629
-            //echo $post_link ;
1630
-        }
1631
-        // temp cache the permalink
1632
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1633
-            $gd_permalink_cache[$post->ID] = $post_link;
1634
-        }
1635
-    }
1636
-    if (isset($orig_post)) {
1637
-        $post = $orig_post;
1638
-    }
1639
-    //echo $post_link ;
1640
-    return $post_link;
1622
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1623
+			}
1624
+			$request_term = trim($request_term, '/');
1625
+			if (!empty($request_term))
1626
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1627
+			else
1628
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1629
+			//echo $post_link ;
1630
+		}
1631
+		// temp cache the permalink
1632
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1633
+			$gd_permalink_cache[$post->ID] = $post_link;
1634
+		}
1635
+	}
1636
+	if (isset($orig_post)) {
1637
+		$post = $orig_post;
1638
+	}
1639
+	//echo $post_link ;
1640
+	return $post_link;
1641 1641
 
1642 1642
 }
1643 1643
 
@@ -1654,103 +1654,103 @@  discard block
 block discarded – undo
1654 1654
  * @return string The term link.
1655 1655
  */
1656 1656
 function geodir_term_link($termlink, $term, $taxonomy) {
1657
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1657
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1658 1658
 
1659
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1660
-        global $geodir_add_location_url, $gd_session;
1661
-        $include_location = false;
1662
-        $request_term = array();
1659
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1660
+		global $geodir_add_location_url, $gd_session;
1661
+		$include_location = false;
1662
+		$request_term = array();
1663 1663
 
1664
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1664
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1665 1665
 
1666
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1667
-            if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1668
-                $include_location = true;
1669
-            }
1670
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1671
-            $include_location = true;
1666
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1667
+			if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1668
+				$include_location = true;
1669
+			}
1670
+		} elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1671
+			$include_location = true;
1672 1672
 
1673
-        if ($include_location) {
1674
-            global $post;
1673
+		if ($include_location) {
1674
+			global $post;
1675 1675
 			
1676 1676
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1677 1677
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1678 1678
             
1679 1679
 			if(geodir_is_page('detail') && isset($post->country_slug)){
1680
-                $location_terms = array(
1681
-                    'gd_country' => $post->country_slug,
1682
-                    'gd_region' => $post->region_slug,
1683
-                    'gd_city' => $post->city_slug
1684
-                );
1680
+				$location_terms = array(
1681
+					'gd_country' => $post->country_slug,
1682
+					'gd_region' => $post->region_slug,
1683
+					'gd_city' => $post->city_slug
1684
+				);
1685 1685
 				
1686 1686
 				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1687 1687
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1688 1688
 				}
1689
-            } else {
1690
-                $location_terms = geodir_get_current_location_terms('query_vars');
1691
-            }
1689
+			} else {
1690
+				$location_terms = geodir_get_current_location_terms('query_vars');
1691
+			}
1692 1692
 
1693
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1694
-            $location_terms = geodir_remove_location_terms($location_terms);
1693
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1694
+			$location_terms = geodir_remove_location_terms($location_terms);
1695 1695
 
1696
-            if (!empty($location_terms)) {
1696
+			if (!empty($location_terms)) {
1697 1697
 
1698
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1698
+				$url_separator = '';//get_option('geodir_listingurl_separator');
1699 1699
 
1700
-                if (get_option('permalink_structure') != '') {
1701
-                    $old_listing_slug = '/' . $listing_slug . '/';
1702
-                    $request_term = implode("/", $location_terms);
1703
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1700
+				if (get_option('permalink_structure') != '') {
1701
+					$old_listing_slug = '/' . $listing_slug . '/';
1702
+					$request_term = implode("/", $location_terms);
1703
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1704 1704
 
1705
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1706
-                } else {
1707
-                    $termlink = geodir_getlink($termlink, $request_term);
1708
-                }
1709
-            }
1710
-        }
1705
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1706
+				} else {
1707
+					$termlink = geodir_getlink($termlink, $request_term);
1708
+				}
1709
+			}
1710
+		}
1711 1711
 
1712
-        // Alter the CPT slug is WPML is set to do so
1713
-        /* we can replace this with the below function
1712
+		// Alter the CPT slug is WPML is set to do so
1713
+		/* we can replace this with the below function
1714 1714
         if(function_exists('icl_object_id')){
1715 1715
             global $sitepress;
1716 1716
             $post_type = str_replace("category","",$taxonomy);
1717 1717
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1718 1718
         }*/
1719 1719
 
1720
-        // Alter the CPT slug if WPML is set to do so
1721
-        if(function_exists('icl_object_id')){
1722
-            $post_types = get_option('geodir_post_types');
1723
-            $post_type = str_replace("category","",$taxonomy);
1720
+		// Alter the CPT slug if WPML is set to do so
1721
+		if(function_exists('icl_object_id')){
1722
+			$post_types = get_option('geodir_post_types');
1723
+			$post_type = str_replace("category","",$taxonomy);
1724 1724
 			$post_type = str_replace("_tags","",$post_type);
1725
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1726
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1725
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1726
+			if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1727 1727
 
1728
-                global $sitepress;
1729
-                $default_lang = $sitepress->get_default_language();
1730
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1731
-                if(!$language_code ){$language_code  = $default_lang;}
1728
+				global $sitepress;
1729
+				$default_lang = $sitepress->get_default_language();
1730
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1731
+				if(!$language_code ){$language_code  = $default_lang;}
1732 1732
 
1733
-                $org_slug = $slug;
1734
-                $slug = apply_filters( 'wpml_translate_single_string',
1735
-                    $slug,
1736
-                    'WordPress',
1737
-                    'URL slug: ' . $slug,
1738
-                    $language_code);
1733
+				$org_slug = $slug;
1734
+				$slug = apply_filters( 'wpml_translate_single_string',
1735
+					$slug,
1736
+					'WordPress',
1737
+					'URL slug: ' . $slug,
1738
+					$language_code);
1739 1739
 
1740 1740
 
1741
-                if(!$slug){$slug = $org_slug;}
1741
+				if(!$slug){$slug = $org_slug;}
1742 1742
 
1743
-                $termlink = trailingslashit(
1743
+				$termlink = trailingslashit(
1744 1744
 
1745
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1746
-                );
1745
+					preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1746
+				);
1747 1747
 
1748
-            }
1749
-        }
1748
+			}
1749
+		}
1750 1750
 
1751
-    }
1751
+	}
1752 1752
 	
1753
-    return $termlink;
1753
+	return $termlink;
1754 1754
 }
1755 1755
 
1756 1756
 /**
@@ -1776,14 +1776,14 @@  discard block
 block discarded – undo
1776 1776
 	if (in_array($post_type, geodir_get_posttypes())) {
1777 1777
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1778 1778
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1779
-                $location_terms = array(
1780
-                    'gd_country' => $post->country_slug,
1781
-                    'gd_region' => $post->region_slug,
1782
-                    'gd_city' => $post->city_slug
1783
-                );
1784
-            } else {
1785
-                $location_terms = geodir_get_current_location_terms('query_vars');
1786
-            }
1779
+				$location_terms = array(
1780
+					'gd_country' => $post->country_slug,
1781
+					'gd_region' => $post->region_slug,
1782
+					'gd_city' => $post->city_slug
1783
+				);
1784
+			} else {
1785
+				$location_terms = geodir_get_current_location_terms('query_vars');
1786
+			}
1787 1787
 			
1788 1788
 			$location_terms = geodir_remove_location_terms($location_terms);
1789 1789
 			
@@ -1814,14 +1814,14 @@  discard block
 block discarded – undo
1814 1814
  */
1815 1815
 function get_post_type_singular_label($post_type, $echo = false)
1816 1816
 {
1817
-    $obj_post_type = get_post_type_object($post_type);
1818
-    if (!is_object($obj_post_type)) {
1819
-        return;
1820
-    }
1821
-    if ($echo)
1822
-        echo $obj_post_type->labels->singular_name;
1823
-    else
1824
-        return $obj_post_type->labels->singular_name;
1817
+	$obj_post_type = get_post_type_object($post_type);
1818
+	if (!is_object($obj_post_type)) {
1819
+		return;
1820
+	}
1821
+	if ($echo)
1822
+		echo $obj_post_type->labels->singular_name;
1823
+	else
1824
+		return $obj_post_type->labels->singular_name;
1825 1825
 
1826 1826
 }
1827 1827
 
@@ -1836,16 +1836,16 @@  discard block
 block discarded – undo
1836 1836
  */
1837 1837
 function get_post_type_plural_label($post_type, $echo = false)
1838 1838
 {
1839
-    $all_postypes = geodir_get_posttypes();
1839
+	$all_postypes = geodir_get_posttypes();
1840 1840
 
1841
-    if (!in_array($post_type, $all_postypes))
1842
-        return false;
1841
+	if (!in_array($post_type, $all_postypes))
1842
+		return false;
1843 1843
 
1844
-    $obj_post_type = get_post_type_object($post_type);
1845
-    if ($echo)
1846
-        echo $obj_post_type->labels->name;
1847
-    else
1848
-        return $obj_post_type->labels->name;
1844
+	$obj_post_type = get_post_type_object($post_type);
1845
+	if ($echo)
1846
+		echo $obj_post_type->labels->name;
1847
+	else
1848
+		return $obj_post_type->labels->name;
1849 1849
 
1850 1850
 }
1851 1851
 
@@ -1864,51 +1864,51 @@  discard block
 block discarded – undo
1864 1864
  */
1865 1865
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1866 1866
 {
1867
-    global $wpdb;
1868
-
1869
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1870
-    $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 ";
1871
-
1872
-    if (is_int($term)) {
1873
-        if (0 == $term)
1874
-            return 0;
1875
-        $where = 't.term_id = %d';
1876
-        if (!empty($taxonomy))
1877
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1878
-        else
1879
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1880
-    }
1867
+	global $wpdb;
1868
+
1869
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1870
+	$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 ";
1871
+
1872
+	if (is_int($term)) {
1873
+		if (0 == $term)
1874
+			return 0;
1875
+		$where = 't.term_id = %d';
1876
+		if (!empty($taxonomy))
1877
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1878
+		else
1879
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1880
+	}
1881 1881
 
1882
-    $term = trim(wp_unslash($term));
1882
+	$term = trim(wp_unslash($term));
1883 1883
 
1884
-    if ('' === $slug = sanitize_title($term))
1885
-        return 0;
1884
+	if ('' === $slug = sanitize_title($term))
1885
+		return 0;
1886 1886
 
1887
-    $where = 't.slug = %s';
1887
+	$where = 't.slug = %s';
1888 1888
 
1889
-    $where_fields = array($slug);
1890
-    if (!empty($taxonomy)) {
1891
-        $parent = (int)$parent;
1892
-        if ($parent > 0) {
1893
-            $where_fields[] = $parent;
1894
-            $else_where_fields[] = $parent;
1895
-            $where .= ' AND tt.parent = %d';
1889
+	$where_fields = array($slug);
1890
+	if (!empty($taxonomy)) {
1891
+		$parent = (int)$parent;
1892
+		if ($parent > 0) {
1893
+			$where_fields[] = $parent;
1894
+			$else_where_fields[] = $parent;
1895
+			$where .= ' AND tt.parent = %d';
1896 1896
 
1897
-        }
1897
+		}
1898 1898
 
1899
-        $where_fields[] = $taxonomy;
1899
+		$where_fields[] = $taxonomy;
1900 1900
 
1901 1901
 
1902
-        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))
1903
-            return $result;
1902
+		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))
1903
+			return $result;
1904 1904
 
1905
-        return false;
1906
-    }
1905
+		return false;
1906
+	}
1907 1907
 
1908
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1909
-        return $result;
1908
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1909
+		return $result;
1910 1910
 
1911
-    return false;
1911
+	return false;
1912 1912
 }
1913 1913
 
1914 1914
 /**
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
 function geodir_get_term_icon_rebuild()
1921 1921
 {
1922 1922
 
1923
-    update_option('gd_term_icons', '');
1923
+	update_option('gd_term_icons', '');
1924 1924
 
1925 1925
 }
1926 1926
 
@@ -1938,60 +1938,60 @@  discard block
 block discarded – undo
1938 1938
  */
1939 1939
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1940 1940
 {
1941
-    global $wpdb;
1942
-    if (!$rebuild) {
1943
-        $terms_icons = get_option('gd_term_icons');
1944
-    } else {
1945
-        $terms_icons = '';
1946
-    }
1947
-
1948
-    if (empty($terms_icons)) {
1949
-        $default_icon_url = get_option('geodir_default_marker_icon');
1950
-        $taxonomy = geodir_get_taxonomies();
1951
-        $post_types = geodir_get_posttypes();
1952
-        $tax_arr = array();
1953
-        foreach ($post_types as $post_type) {
1954
-            $tax_arr[] = "'" . $post_type . "category'";
1955
-        }
1956
-        $tax_c = implode(',', $tax_arr);
1957
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1958
-        //$terms = get_terms( $taxonomy );
1959
-
1960
-        if($terms) {
1961
-            foreach ($terms as $term) {
1962
-                $post_type = str_replace("category", "", $term->taxonomy);
1963
-                $a_terms[$post_type][] = $term;
1941
+	global $wpdb;
1942
+	if (!$rebuild) {
1943
+		$terms_icons = get_option('gd_term_icons');
1944
+	} else {
1945
+		$terms_icons = '';
1946
+	}
1964 1947
 
1965
-            }
1966
-        }
1948
+	if (empty($terms_icons)) {
1949
+		$default_icon_url = get_option('geodir_default_marker_icon');
1950
+		$taxonomy = geodir_get_taxonomies();
1951
+		$post_types = geodir_get_posttypes();
1952
+		$tax_arr = array();
1953
+		foreach ($post_types as $post_type) {
1954
+			$tax_arr[] = "'" . $post_type . "category'";
1955
+		}
1956
+		$tax_c = implode(',', $tax_arr);
1957
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1958
+		//$terms = get_terms( $taxonomy );
1967 1959
 
1968
-        if($a_terms) {
1969
-            foreach ($a_terms as $pt => $t2) {
1960
+		if($terms) {
1961
+			foreach ($terms as $term) {
1962
+				$post_type = str_replace("category", "", $term->taxonomy);
1963
+				$a_terms[$post_type][] = $term;
1970 1964
 
1971
-                foreach ($t2 as $term) {
1972
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1973
-                    if ($term_icon) {
1974
-                        $term_icon_url = $term_icon["src"];
1975
-                    } else {
1976
-                        $term_icon_url = $default_icon_url;
1977
-                    }
1978
-                    $terms_icons[$term->term_id] = $term_icon_url;
1979
-                }
1980
-            }
1981
-        }
1965
+			}
1966
+		}
1982 1967
 
1983
-        update_option('gd_term_icons', $terms_icons);
1984
-    }
1968
+		if($a_terms) {
1969
+			foreach ($a_terms as $pt => $t2) {
1985 1970
 
1986
-    if ($term_id && isset($terms_icons[$term_id])) {
1987
-        return $terms_icons[$term_id];
1988
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
1989
-        return get_option('geodir_default_marker_icon');
1990
-    }
1971
+				foreach ($t2 as $term) {
1972
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1973
+					if ($term_icon) {
1974
+						$term_icon_url = $term_icon["src"];
1975
+					} else {
1976
+						$term_icon_url = $default_icon_url;
1977
+					}
1978
+					$terms_icons[$term->term_id] = $term_icon_url;
1979
+				}
1980
+			}
1981
+		}
1982
+
1983
+		update_option('gd_term_icons', $terms_icons);
1984
+	}
1991 1985
 
1992
-    if (is_ssl()) {
1993
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1994
-    }
1986
+	if ($term_id && isset($terms_icons[$term_id])) {
1987
+		return $terms_icons[$term_id];
1988
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
1989
+		return get_option('geodir_default_marker_icon');
1990
+	}
1991
+
1992
+	if (is_ssl()) {
1993
+		$terms_icons = str_replace("http:","https:",$terms_icons );
1994
+	}
1995 1995
 
1996
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
1996
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
1997 1997
 }
1998 1998
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 1 patch
Indentation   +1441 added lines, -1441 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * @global object $gd_session GeoDirectory Session object.
18 18
  */
19 19
 function geodir_list_view_select() {
20
-    global $gd_session;
20
+	global $gd_session;
21 21
 	?>
22 22
     <script type="text/javascript">
23 23
 	function geodir_list_view_select(list) {
@@ -86,63 +86,63 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function geodir_max_excerpt($charlength)
88 88
 {
89
-    global $post;
90
-    if ($charlength == '0') {
91
-        return;
92
-    }
93
-    $out = '';
89
+	global $post;
90
+	if ($charlength == '0') {
91
+		return;
92
+	}
93
+	$out = '';
94 94
 	
95 95
 	$temp_post = $post;
96 96
 	$excerpt = get_the_excerpt();
97 97
 
98
-    $charlength++;
99
-    $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
100
-    if (mb_strlen($excerpt) > $charlength) {
101
-        if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
102
-            $excut = -(mb_strlen($excerpt_more));
103
-            $subex = mb_substr($excerpt, 0, $excut);
104
-            if ($charlength > 0 && mb_strlen($subex) > $charlength) {
105
-                $subex = mb_substr($subex, 0, $charlength);
106
-            }
107
-            $out .= $subex;
108
-        } else {
109
-            $subex = mb_substr($excerpt, 0, $charlength - 5);
110
-            $exwords = explode(' ', $subex);
111
-            $excut = -(mb_strlen($exwords[count($exwords) - 1]));
112
-            if ($excut < 0) {
113
-                $out .= mb_substr($subex, 0, $excut);
114
-            } else {
115
-                $out .= $subex;
116
-            }
117
-        }
118
-        $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
119
-        /**
120
-         * Filter excerpt read more text.
121
-         *
122
-         * @since 1.0.0
123
-         */
124
-        $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
125
-        $out .= '</a>';
126
-
127
-    } else {
128
-        if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
129
-            $excut = -(mb_strlen($excerpt_more));
130
-            $out .= mb_substr($excerpt, 0, $excut);
131
-            $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
132
-            /**
133
-             * Filter excerpt read more text.
134
-             *
135
-             * @since 1.0.0
136
-             */
137
-            $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
138
-            $out .= '</a>';
139
-        } else {
140
-            $out .= $excerpt;
141
-        }
142
-    }
98
+	$charlength++;
99
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
100
+	if (mb_strlen($excerpt) > $charlength) {
101
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
102
+			$excut = -(mb_strlen($excerpt_more));
103
+			$subex = mb_substr($excerpt, 0, $excut);
104
+			if ($charlength > 0 && mb_strlen($subex) > $charlength) {
105
+				$subex = mb_substr($subex, 0, $charlength);
106
+			}
107
+			$out .= $subex;
108
+		} else {
109
+			$subex = mb_substr($excerpt, 0, $charlength - 5);
110
+			$exwords = explode(' ', $subex);
111
+			$excut = -(mb_strlen($exwords[count($exwords) - 1]));
112
+			if ($excut < 0) {
113
+				$out .= mb_substr($subex, 0, $excut);
114
+			} else {
115
+				$out .= $subex;
116
+			}
117
+		}
118
+		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
119
+		/**
120
+		 * Filter excerpt read more text.
121
+		 *
122
+		 * @since 1.0.0
123
+		 */
124
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
125
+		$out .= '</a>';
126
+
127
+	} else {
128
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
129
+			$excut = -(mb_strlen($excerpt_more));
130
+			$out .= mb_substr($excerpt, 0, $excut);
131
+			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
132
+			/**
133
+			 * Filter excerpt read more text.
134
+			 *
135
+			 * @since 1.0.0
136
+			 */
137
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
138
+			$out .= '</a>';
139
+		} else {
140
+			$out .= $excerpt;
141
+		}
142
+	}
143 143
 	$post = $temp_post;
144 144
 
145
-    return $out;
145
+	return $out;
146 146
 }
147 147
 
148 148
 /**
@@ -157,34 +157,34 @@  discard block
 block discarded – undo
157 157
  */
158 158
 function geodir_post_package_info($package_info, $post = '', $post_type = '')
159 159
 {
160
-    $package_info['pid'] = 0;
161
-    $package_info['days'] = 0;
162
-    $package_info['amount'] = 0;
163
-    $package_info['is_featured'] = 0;
164
-    $package_info['image_limit'] = '';
165
-    $package_info['google_analytics'] = 1;
166
-    $package_info['sendtofriend'] = 1;
167
-
168
-    /**
169
-     * Filter listing package info.
170
-     *
171
-     * @since 1.0.0
172
-     * @param array $package_info {
173
-     *    Attributes of the package_info.
174
-     *
175
-     *    @type int $pid Package ID. Default 0.
176
-     *    @type int $days Package validity in Days. Default 0.
177
-     *    @type int $amount Package amount. Default 0.
178
-     *    @type int $is_featured Is this featured package? Default 0.
179
-     *    @type string $image_limit Image limit for this package. Default "".
180
-     *    @type int $google_analytics Add analytics to this package. Default 1.
181
-     *    @type int $sendtofriend Send to friend. Default 1.
182
-     *
183
-     * }
184
-     * @param object|string $post The post object.
185
-     * @param string $post_type The post type.
186
-     */
187
-    return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
160
+	$package_info['pid'] = 0;
161
+	$package_info['days'] = 0;
162
+	$package_info['amount'] = 0;
163
+	$package_info['is_featured'] = 0;
164
+	$package_info['image_limit'] = '';
165
+	$package_info['google_analytics'] = 1;
166
+	$package_info['sendtofriend'] = 1;
167
+
168
+	/**
169
+	 * Filter listing package info.
170
+	 *
171
+	 * @since 1.0.0
172
+	 * @param array $package_info {
173
+	 *    Attributes of the package_info.
174
+	 *
175
+	 *    @type int $pid Package ID. Default 0.
176
+	 *    @type int $days Package validity in Days. Default 0.
177
+	 *    @type int $amount Package amount. Default 0.
178
+	 *    @type int $is_featured Is this featured package? Default 0.
179
+	 *    @type string $image_limit Image limit for this package. Default "".
180
+	 *    @type int $google_analytics Add analytics to this package. Default 1.
181
+	 *    @type int $sendtofriend Send to friend. Default 1.
182
+	 *
183
+	 * }
184
+	 * @param object|string $post The post object.
185
+	 * @param string $post_type The post type.
186
+	 */
187
+	return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
188 188
 
189 189
 }
190 190
 
@@ -212,127 +212,127 @@  discard block
 block discarded – undo
212 212
  */
213 213
 function geodir_send_inquiry($request)
214 214
 {
215
-    global $wpdb;
216
-
217
-    // strip slashes from text
218
-    $request = !empty($request) ? stripslashes_deep($request) : $request;
219
-
220
-    $yourname = $request['inq_name'];
221
-    $youremail = $request['inq_email'];
222
-    $inq_phone = $request['inq_phone'];
223
-    $frnd_comments = $request['inq_msg'];
224
-    $pid = $request['pid'];
225
-
226
-    $author_id = '';
227
-    $post_title = '';
228
-
229
-    if ($request['pid']) {
230
-
231
-        $productinfosql = $wpdb->prepare(
232
-            "select ID,post_author,post_title from $wpdb->posts where ID =%d",
233
-            array($request['pid'])
234
-        );
235
-        $productinfo = $wpdb->get_row($productinfosql);
236
-
237
-        $author_id = $productinfo->post_author;
238
-        $post_title = $productinfo->post_title;
239
-    }
240
-
241
-    $post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>';
242
-
243
-    $user_info = get_userdata($author_id);
244
-    $to_email = geodir_get_post_meta($pid, 'geodir_email', true);
245
-    $to_name = geodir_get_client_name($author_id);
246
-
247
-    if ($to_email == '') {
248
-        $to_email = get_option('admin_email');
249
-    }
250
-
251
-    /**
252
-     * Called after the send enquiry var have been set but before the email has been sent.
253
-     *
254
-     * @since 1.0.0
255
-     * @param array $request {
256
-     *    The submitted form fields as an array.
257
-     *
258
-     *    @type string $sendact Enquiry type. Default "send_inqury".
259
-     *    @type string $pid Post ID.
260
-     *    @type string $inq_name Sender name.
261
-     *    @type string $inq_email Sender mail.
262
-     *    @type string $inq_phone Sender phone.
263
-     *    @type string $inq_msg Email message.
264
-     *
265
-     * }
266
-     * @param string $type The form type, default: `Enquiry`.
267
-     */
268
-    do_action('geodir_after_send_enquiry', $request, 'Enquiry');
269
-
270
-    $client_message = $frnd_comments;
271
-    $client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
272
-    /**
273
-     * Filter client message text.
274
-     *
275
-     * @since 1.0.0
276
-     * @param string $client_message Client message text.
277
-     */
278
-    $client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
279
-
280
-    /**
281
-     * Called before the send enquiry email is sent.
282
-     *
283
-     * @since 1.0.0
284
-     * @param array $request {
285
-     *    The submitted form fields as an array.
286
-     *
287
-     *    @type string $sendact Enquiry type. Default "send_inqury".
288
-     *    @type string $pid Post ID.
289
-     *    @type string $inq_name Sender name.
290
-     *    @type string $inq_email Sender mail.
291
-     *    @type string $inq_phone Sender phone.
292
-     *    @type string $inq_msg Email message.
293
-     *
294
-     * }
295
-     */
296
-    do_action('geodir_before_send_enquiry_email', $request);
297
-    if ($to_email) {
298
-        // strip slashes message
299
-        $client_message = stripslashes_deep($client_message);
300
-
301
-        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
302
-    }
303
-
304
-    /**
305
-     * Called after the send enquiry email is sent.
306
-     *
307
-     * @since 1.0.0
308
-     * @param array $request {
309
-     *    The submitted form fields as an array.
310
-     *
311
-     *    @type string $sendact Enquiry type. Default "send_inqury".
312
-     *    @type string $pid Post ID.
313
-     *    @type string $inq_name Sender name.
314
-     *    @type string $inq_email Sender mail.
315
-     *    @type string $inq_phone Sender phone.
316
-     *    @type string $inq_msg Email message.
317
-     *
318
-     * }
319
-     */
320
-    do_action('geodir_after_send_enquiry_email', $request);
321
-    $url = get_permalink($pid);
322
-    if (strstr($url, '?')) {
323
-        $url = $url . "&send_inquiry=success";
324
-    } else {
325
-        $url = $url . "?send_inquiry=success";
326
-    }
327
-    /**
328
-     * Filter redirect url after the send enquiry email is sent.
329
-     *
330
-     * @since 1.0.0
331
-     * @param string $url Redirect url.
332
-     */
333
-    $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
334
-    wp_redirect($url);
335
-    gd_die();
215
+	global $wpdb;
216
+
217
+	// strip slashes from text
218
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
219
+
220
+	$yourname = $request['inq_name'];
221
+	$youremail = $request['inq_email'];
222
+	$inq_phone = $request['inq_phone'];
223
+	$frnd_comments = $request['inq_msg'];
224
+	$pid = $request['pid'];
225
+
226
+	$author_id = '';
227
+	$post_title = '';
228
+
229
+	if ($request['pid']) {
230
+
231
+		$productinfosql = $wpdb->prepare(
232
+			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
233
+			array($request['pid'])
234
+		);
235
+		$productinfo = $wpdb->get_row($productinfosql);
236
+
237
+		$author_id = $productinfo->post_author;
238
+		$post_title = $productinfo->post_title;
239
+	}
240
+
241
+	$post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>';
242
+
243
+	$user_info = get_userdata($author_id);
244
+	$to_email = geodir_get_post_meta($pid, 'geodir_email', true);
245
+	$to_name = geodir_get_client_name($author_id);
246
+
247
+	if ($to_email == '') {
248
+		$to_email = get_option('admin_email');
249
+	}
250
+
251
+	/**
252
+	 * Called after the send enquiry var have been set but before the email has been sent.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @param array $request {
256
+	 *    The submitted form fields as an array.
257
+	 *
258
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
259
+	 *    @type string $pid Post ID.
260
+	 *    @type string $inq_name Sender name.
261
+	 *    @type string $inq_email Sender mail.
262
+	 *    @type string $inq_phone Sender phone.
263
+	 *    @type string $inq_msg Email message.
264
+	 *
265
+	 * }
266
+	 * @param string $type The form type, default: `Enquiry`.
267
+	 */
268
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
269
+
270
+	$client_message = $frnd_comments;
271
+	$client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
272
+	/**
273
+	 * Filter client message text.
274
+	 *
275
+	 * @since 1.0.0
276
+	 * @param string $client_message Client message text.
277
+	 */
278
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
279
+
280
+	/**
281
+	 * Called before the send enquiry email is sent.
282
+	 *
283
+	 * @since 1.0.0
284
+	 * @param array $request {
285
+	 *    The submitted form fields as an array.
286
+	 *
287
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
288
+	 *    @type string $pid Post ID.
289
+	 *    @type string $inq_name Sender name.
290
+	 *    @type string $inq_email Sender mail.
291
+	 *    @type string $inq_phone Sender phone.
292
+	 *    @type string $inq_msg Email message.
293
+	 *
294
+	 * }
295
+	 */
296
+	do_action('geodir_before_send_enquiry_email', $request);
297
+	if ($to_email) {
298
+		// strip slashes message
299
+		$client_message = stripslashes_deep($client_message);
300
+
301
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
302
+	}
303
+
304
+	/**
305
+	 * Called after the send enquiry email is sent.
306
+	 *
307
+	 * @since 1.0.0
308
+	 * @param array $request {
309
+	 *    The submitted form fields as an array.
310
+	 *
311
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
312
+	 *    @type string $pid Post ID.
313
+	 *    @type string $inq_name Sender name.
314
+	 *    @type string $inq_email Sender mail.
315
+	 *    @type string $inq_phone Sender phone.
316
+	 *    @type string $inq_msg Email message.
317
+	 *
318
+	 * }
319
+	 */
320
+	do_action('geodir_after_send_enquiry_email', $request);
321
+	$url = get_permalink($pid);
322
+	if (strstr($url, '?')) {
323
+		$url = $url . "&send_inquiry=success";
324
+	} else {
325
+		$url = $url . "?send_inquiry=success";
326
+	}
327
+	/**
328
+	 * Filter redirect url after the send enquiry email is sent.
329
+	 *
330
+	 * @since 1.0.0
331
+	 * @param string $url Redirect url.
332
+	 */
333
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
334
+	wp_redirect($url);
335
+	gd_die();
336 336
 
337 337
 }
338 338
 
@@ -361,85 +361,85 @@  discard block
 block discarded – undo
361 361
  */
362 362
 function geodir_send_friend($request)
363 363
 {
364
-    global $wpdb;
365
-
366
-    // strip slashes from text
367
-    $request = !empty($request) ? stripslashes_deep($request) : $request;
368
-
369
-    $yourname = $request['yourname'];
370
-    $youremail = $request['youremail'];
371
-    $frnd_subject = $request['frnd_subject'];
372
-    $frnd_comments = $request['frnd_comments'];
373
-    $pid = $request['pid'];
374
-    $to_email = $request['to_email'];
375
-    $to_name = $request['to_name'];
376
-    if ($request['pid']) {
377
-        $productinfosql = $wpdb->prepare(
378
-            "select ID,post_title from $wpdb->posts where ID =%d",
379
-            array($request['pid'])
380
-        );
381
-        $productinfo = $wpdb->get_results($productinfosql);
382
-        foreach ($productinfo as $productinfoObj) {
383
-            $post_title = $productinfoObj->post_title;
384
-        }
385
-    }
386
-
387
-    /**
388
-     * Called before the send to friend email is sent.
389
-     *
390
-     * @since 1.0.0
391
-     * @param array $request {
392
-     *    The submitted form fields as an array.
393
-     *
394
-     *    @type string $sendact Enquiry type. Default "email_frnd".
395
-     *    @type string $pid Post ID.
396
-     *    @type string $to_name Friend name.
397
-     *    @type string $to_email Friend email.
398
-     *    @type string $yourname Sender name.
399
-     *    @type string $youremail Sender email.
400
-     *    @type string $frnd_subject Email subject.
401
-     *    @type string $frnd_comments Email Message.
402
-     *
403
-     * }
404
-     */
405
-    do_action('geodir_before_send_to_friend_email', $request);
406
-    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
407
-
408
-    /**
409
-     * Called after the send to friend email is sent.
410
-     *
411
-     * @since 1.0.0
412
-     * @param array $request {
413
-     *    The submitted form fields as an array.
414
-     *
415
-     *    @type string $sendact Enquiry type. Default "email_frnd".
416
-     *    @type string $pid Post ID.
417
-     *    @type string $to_name Friend name.
418
-     *    @type string $to_email Friend email.
419
-     *    @type string $yourname Sender name.
420
-     *    @type string $youremail Sender email.
421
-     *    @type string $frnd_subject Email subject.
422
-     *    @type string $frnd_comments Email Message.
423
-     *
424
-     * }
425
-     */
426
-    do_action('geodir_after_send_to_friend_email', $request);
427
-
428
-    $url = get_permalink($pid);
429
-    if (strstr($url, '?')) {
430
-        $url = $url . "&sendtofrnd=success";
431
-    } else {
432
-        $url = $url . "?sendtofrnd=success";
433
-    }
434
-    /**
435
-     * Filter redirect url after the send to friend email is sent.
436
-     *
437
-     * @since 1.0.0
438
-     * @param string $url Redirect url.
439
-     */
440
-    $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
441
-    wp_redirect($url);
442
-    gd_die();
364
+	global $wpdb;
365
+
366
+	// strip slashes from text
367
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
368
+
369
+	$yourname = $request['yourname'];
370
+	$youremail = $request['youremail'];
371
+	$frnd_subject = $request['frnd_subject'];
372
+	$frnd_comments = $request['frnd_comments'];
373
+	$pid = $request['pid'];
374
+	$to_email = $request['to_email'];
375
+	$to_name = $request['to_name'];
376
+	if ($request['pid']) {
377
+		$productinfosql = $wpdb->prepare(
378
+			"select ID,post_title from $wpdb->posts where ID =%d",
379
+			array($request['pid'])
380
+		);
381
+		$productinfo = $wpdb->get_results($productinfosql);
382
+		foreach ($productinfo as $productinfoObj) {
383
+			$post_title = $productinfoObj->post_title;
384
+		}
385
+	}
386
+
387
+	/**
388
+	 * Called before the send to friend email is sent.
389
+	 *
390
+	 * @since 1.0.0
391
+	 * @param array $request {
392
+	 *    The submitted form fields as an array.
393
+	 *
394
+	 *    @type string $sendact Enquiry type. Default "email_frnd".
395
+	 *    @type string $pid Post ID.
396
+	 *    @type string $to_name Friend name.
397
+	 *    @type string $to_email Friend email.
398
+	 *    @type string $yourname Sender name.
399
+	 *    @type string $youremail Sender email.
400
+	 *    @type string $frnd_subject Email subject.
401
+	 *    @type string $frnd_comments Email Message.
402
+	 *
403
+	 * }
404
+	 */
405
+	do_action('geodir_before_send_to_friend_email', $request);
406
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
407
+
408
+	/**
409
+	 * Called after the send to friend email is sent.
410
+	 *
411
+	 * @since 1.0.0
412
+	 * @param array $request {
413
+	 *    The submitted form fields as an array.
414
+	 *
415
+	 *    @type string $sendact Enquiry type. Default "email_frnd".
416
+	 *    @type string $pid Post ID.
417
+	 *    @type string $to_name Friend name.
418
+	 *    @type string $to_email Friend email.
419
+	 *    @type string $yourname Sender name.
420
+	 *    @type string $youremail Sender email.
421
+	 *    @type string $frnd_subject Email subject.
422
+	 *    @type string $frnd_comments Email Message.
423
+	 *
424
+	 * }
425
+	 */
426
+	do_action('geodir_after_send_to_friend_email', $request);
427
+
428
+	$url = get_permalink($pid);
429
+	if (strstr($url, '?')) {
430
+		$url = $url . "&sendtofrnd=success";
431
+	} else {
432
+		$url = $url . "?sendtofrnd=success";
433
+	}
434
+	/**
435
+	 * Filter redirect url after the send to friend email is sent.
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @param string $url Redirect url.
439
+	 */
440
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
441
+	wp_redirect($url);
442
+	gd_die();
443 443
 }
444 444
 
445 445
 /**
@@ -453,28 +453,28 @@  discard block
 block discarded – undo
453 453
  */
454 454
 function geodir_before_tab_content($hash_key)
455 455
 {
456
-    switch ($hash_key) {
457
-        case 'post_info' :
458
-            echo '<div class="geodir-company_info field-group">';
459
-            break;
460
-        case 'post_images' :
461
-            /**
462
-             * Filter post gallery HTML id.
463
-             *
464
-             * @since 1.0.0
465
-             */
466
-            echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
467
-            break;
468
-        case 'reviews' :
469
-            echo '<div id="reviews-wrap" class="clearfix"> ';
470
-            break;
471
-        case 'post_video':
472
-            echo ' <div id="post_video-wrap" class="clearfix">';
473
-            break;
474
-        case 'special_offers':
475
-            echo '<div id="special_offers-wrap" class="clearfix">';
476
-            break;
477
-    }
456
+	switch ($hash_key) {
457
+		case 'post_info' :
458
+			echo '<div class="geodir-company_info field-group">';
459
+			break;
460
+		case 'post_images' :
461
+			/**
462
+			 * Filter post gallery HTML id.
463
+			 *
464
+			 * @since 1.0.0
465
+			 */
466
+			echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
467
+			break;
468
+		case 'reviews' :
469
+			echo '<div id="reviews-wrap" class="clearfix"> ';
470
+			break;
471
+		case 'post_video':
472
+			echo ' <div id="post_video-wrap" class="clearfix">';
473
+			break;
474
+		case 'special_offers':
475
+			echo '<div id="special_offers-wrap" class="clearfix">';
476
+			break;
477
+	}
478 478
 }
479 479
 
480 480
 /**
@@ -488,23 +488,23 @@  discard block
 block discarded – undo
488 488
  */
489 489
 function geodir_after_tab_content($hash_key)
490 490
 {
491
-    switch ($hash_key) {
492
-        case 'post_info' :
493
-            echo '</div>';
494
-            break;
495
-        case 'post_images' :
496
-            echo '</div>';
497
-            break;
498
-        case 'reviews' :
499
-            echo '</div>';
500
-            break;
501
-        case 'post_video':
502
-            echo '</div>';
503
-            break;
504
-        case 'special_offers':
505
-            echo '</div>';
506
-            break;
507
-    }
491
+	switch ($hash_key) {
492
+		case 'post_info' :
493
+			echo '</div>';
494
+			break;
495
+		case 'post_images' :
496
+			echo '</div>';
497
+			break;
498
+		case 'reviews' :
499
+			echo '</div>';
500
+			break;
501
+		case 'post_video':
502
+			echo '</div>';
503
+			break;
504
+		case 'special_offers':
505
+			echo '</div>';
506
+			break;
507
+	}
508 508
 }
509 509
 
510 510
 
@@ -520,21 +520,21 @@  discard block
 block discarded – undo
520 520
 function geodir_get_posts_default_sort($post_type)
521 521
 {
522 522
 
523
-    global $wpdb;
523
+	global $wpdb;
524 524
 
525
-    if ($post_type != '') {
525
+	if ($post_type != '') {
526 526
 
527
-        $all_postypes = geodir_get_posttypes();
527
+		$all_postypes = geodir_get_posttypes();
528 528
 
529
-        if (!in_array($post_type, $all_postypes))
530
-            return false;
529
+		if (!in_array($post_type, $all_postypes))
530
+			return false;
531 531
 
532
-        $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
532
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
533 533
 
534
-        if (!empty($sort_field_info))
535
-            return $sort_field_info;
534
+		if (!empty($sort_field_info))
535
+			return $sort_field_info;
536 536
 
537
-    }
537
+	}
538 538
 
539 539
 }
540 540
 
@@ -549,24 +549,24 @@  discard block
 block discarded – undo
549 549
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
550 550
  */
551 551
 function geodir_get_sort_options($post_type) {
552
-    global $wpdb;
553
-
554
-    if ($post_type != '') {
555
-        $all_postypes = geodir_get_posttypes();
556
-
557
-        if (!in_array($post_type, $all_postypes))
558
-            return false;
559
-
560
-        $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561
-        /**
562
-         * Filter post sort options.
563
-         *
564
-         * @since 1.0.0
565
-         * @param array $sort_field_info Unfiltered sort field array.
566
-         * @param string $post_type Post type.
567
-         */
568
-        return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
569
-    }
552
+	global $wpdb;
553
+
554
+	if ($post_type != '') {
555
+		$all_postypes = geodir_get_posttypes();
556
+
557
+		if (!in_array($post_type, $all_postypes))
558
+			return false;
559
+
560
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561
+		/**
562
+		 * Filter post sort options.
563
+		 *
564
+		 * @since 1.0.0
565
+		 * @param array $sort_field_info Unfiltered sort field array.
566
+		 * @param string $post_type Post type.
567
+		 */
568
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
569
+	}
570 570
 
571 571
 }
572 572
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
  */
581 581
 function geodir_display_sort_options()
582 582
 {
583
-    global $wp_query;
583
+	global $wp_query;
584 584
 	
585 585
 	/**
586 586
 	 * On search pages there should be no sort options, sorting is done by search criteria.
@@ -591,57 +591,57 @@  discard block
 block discarded – undo
591 591
 		return;
592 592
 	}
593 593
 
594
-    $sort_by = '';
594
+	$sort_by = '';
595 595
 
596
-    if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
596
+	if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
597 597
 
598
-    $gd_post_type = geodir_get_current_posttype();
598
+	$gd_post_type = geodir_get_current_posttype();
599 599
 
600
-    $sort_options = geodir_get_sort_options($gd_post_type);
600
+	$sort_options = geodir_get_sort_options($gd_post_type);
601 601
 
602 602
 
603
-    $sort_field_options = '';
603
+	$sort_field_options = '';
604 604
 
605
-    if (!empty($sort_options)) {
606
-        foreach ($sort_options as $sort) {
605
+	if (!empty($sort_options)) {
606
+		foreach ($sort_options as $sort) {
607 607
 			$sort = stripslashes_deep($sort); // strip slashes
608 608
 
609
-            $label = __($sort->site_title, 'geodirectory');
609
+			$label = __($sort->site_title, 'geodirectory');
610 610
 
611
-            if ($sort->field_type == 'random') {
612
-                $key = $sort->field_type;
613
-                ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
615
-            }
611
+			if ($sort->field_type == 'random') {
612
+				$key = $sort->field_type;
613
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
615
+			}
616 616
 
617
-            if ($sort->htmlvar_name == 'comment_count') {
618
-                $sort->htmlvar_name = 'rating_count';
619
-            }
617
+			if ($sort->htmlvar_name == 'comment_count') {
618
+				$sort->htmlvar_name = 'rating_count';
619
+			}
620 620
 
621
-            if ($sort->sort_asc) {
622
-                $key = $sort->htmlvar_name . '_asc';
623
-                $label = $sort->site_title;
624
-                if ($sort->asc_title)
625
-                    $label = $sort->asc_title;
626
-                ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628
-            }
621
+			if ($sort->sort_asc) {
622
+				$key = $sort->htmlvar_name . '_asc';
623
+				$label = $sort->site_title;
624
+				if ($sort->asc_title)
625
+					$label = $sort->asc_title;
626
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628
+			}
629 629
 
630
-            if ($sort->sort_desc) {
631
-                $key = $sort->htmlvar_name . '_desc';
632
-                $label = $sort->site_title;
633
-                if ($sort->desc_title)
634
-                    $label = $sort->desc_title;
635
-                ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637
-            }
630
+			if ($sort->sort_desc) {
631
+				$key = $sort->htmlvar_name . '_desc';
632
+				$label = $sort->site_title;
633
+				if ($sort->desc_title)
634
+					$label = $sort->desc_title;
635
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637
+			}
638 638
 
639
-        }
640
-    }
639
+		}
640
+	}
641 641
 
642
-    if ($sort_field_options != '') {
642
+	if ($sort_field_options != '') {
643 643
 
644
-        ?>
644
+		?>
645 645
 
646 646
         <div class="geodir-tax-sort">
647 647
 
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
                 <option
651 651
                     value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
652 652
 
653
-                echo $sort_field_options;?>
653
+				echo $sort_field_options;?>
654 654
 
655 655
             </select>
656 656
 
657 657
         </div>
658 658
     <?php
659 659
 
660
-    }
660
+	}
661 661
 
662 662
 }
663 663
 
@@ -677,10 +677,10 @@  discard block
 block discarded – undo
677 677
 function geodir_advance_customfields_heading($title, $field_type)
678 678
 {
679 679
 
680
-    if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
681
-        $title = '';
682
-    }
683
-    return $title;
680
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
681
+		$title = '';
682
+	}
683
+	return $title;
684 684
 }
685 685
 
686 686
 
@@ -697,81 +697,81 @@  discard block
 block discarded – undo
697 697
  * @return string Returns related posts html.
698 698
  */
699 699
 function geodir_related_posts_display($request) {
700
-    if (!empty($request)) {
701
-        $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
702
-        $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
703
-
704
-        $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
705
-        $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
706
-        $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
707
-        $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
708
-        $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
709
-        $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
710
-        $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
711
-        $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
712
-
713
-        global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
714
-        $related_parent_lat = $post->post_latitude;
715
-        $related_parent_lon = $post->post_longitude;
716
-        $arr_detail_page_tabs = geodir_detail_page_tabs_list();
717
-
718
-        $related_listing_array = array();
719
-        if (get_option('geodir_add_related_listing_posttypes'))
720
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
721
-        if (in_array($post->post_type, $related_listing_array)) {
722
-            $arr_detail_page_tabs['related_listing']['is_display'] = true;
723
-        }
700
+	if (!empty($request)) {
701
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
702
+		$after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
703
+
704
+		$title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
705
+		$post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
706
+		$relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
707
+		$layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
708
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
709
+		$listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
710
+		$list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
711
+		$character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
712
+
713
+		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
714
+		$related_parent_lat = $post->post_latitude;
715
+		$related_parent_lon = $post->post_longitude;
716
+		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
717
+
718
+		$related_listing_array = array();
719
+		if (get_option('geodir_add_related_listing_posttypes'))
720
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
721
+		if (in_array($post->post_type, $related_listing_array)) {
722
+			$arr_detail_page_tabs['related_listing']['is_display'] = true;
723
+		}
724 724
 
725
-        $is_display = $arr_detail_page_tabs['related_listing']['is_display'];
726
-        $origi_post = $post;
727
-        $post_type = '';
728
-        $post_id = '';
729
-        $category_taxonomy = '';
730
-        $tax_field = 'id';
731
-        $category = array();
732
-
733
-        if (isset($_REQUEST['backandedit'])) {
734
-            $post = (object)$gd_session->get('listing');
735
-            $post_type = $post->listing_type;
736
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
737
-                $post_id = $_REQUEST['pid'];
738
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
739
-            $post = geodir_get_post_info($_REQUEST['pid']);
740
-            $post_type = $post->post_type;
741
-            $post_id = $_REQUEST['pid'];
742
-        } elseif (isset($post->post_type) && $post->post_type != '') {
743
-            $post_type = $post->post_type;
744
-            $post_id = $post->ID;
745
-        }
725
+		$is_display = $arr_detail_page_tabs['related_listing']['is_display'];
726
+		$origi_post = $post;
727
+		$post_type = '';
728
+		$post_id = '';
729
+		$category_taxonomy = '';
730
+		$tax_field = 'id';
731
+		$category = array();
732
+
733
+		if (isset($_REQUEST['backandedit'])) {
734
+			$post = (object)$gd_session->get('listing');
735
+			$post_type = $post->listing_type;
736
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
737
+				$post_id = $_REQUEST['pid'];
738
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
739
+			$post = geodir_get_post_info($_REQUEST['pid']);
740
+			$post_type = $post->post_type;
741
+			$post_id = $_REQUEST['pid'];
742
+		} elseif (isset($post->post_type) && $post->post_type != '') {
743
+			$post_type = $post->post_type;
744
+			$post_id = $post->ID;
745
+		}
746 746
 
747
-        if ($relate_to == 'category') {
747
+		if ($relate_to == 'category') {
748 748
 
749
-            $category_taxonomy = $post_type . $relate_to;
750
-            if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
751
-                $category = explode(',', trim($post->{$category_taxonomy}, ','));
749
+			$category_taxonomy = $post_type . $relate_to;
750
+			if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
751
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
752 752
 
753
-        } elseif ($relate_to == 'tags') {
753
+		} elseif ($relate_to == 'tags') {
754 754
 
755
-            $category_taxonomy = $post_type . '_' . $relate_to;
756
-            if ($post->post_tags != '')
757
-                $category = explode(',', trim($post->post_tags, ','));
758
-            $tax_field = 'name';
759
-        }
755
+			$category_taxonomy = $post_type . '_' . $relate_to;
756
+			if ($post->post_tags != '')
757
+				$category = explode(',', trim($post->post_tags, ','));
758
+			$tax_field = 'name';
759
+		}
760 760
 
761
-        /* --- return false in invalid request --- */
762
-        if (empty($category))
763
-            return false;
761
+		/* --- return false in invalid request --- */
762
+		if (empty($category))
763
+			return false;
764 764
 
765
-        $all_postypes = geodir_get_posttypes();
765
+		$all_postypes = geodir_get_posttypes();
766 766
 
767
-        if (!in_array($post_type, $all_postypes))
768
-            return false;
767
+		if (!in_array($post_type, $all_postypes))
768
+			return false;
769 769
 
770
-        /* --- return false in invalid request --- */
770
+		/* --- return false in invalid request --- */
771 771
 
772
-       $location_url = '';
773
-        if ($add_location_filter != '0') {
774
-            $location_url = array();
772
+	   $location_url = '';
773
+		if ($add_location_filter != '0') {
774
+			$location_url = array();
775 775
 			$geodir_show_location_url = get_option('geodir_show_location_url');
776 776
 			
777 777
 			$gd_city = get_query_var('gd_city');
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
 			if ($gd_city) {
780 780
 				$gd_country = get_query_var('gd_country');
781 781
 				$gd_region = get_query_var('gd_region');
782
-            } else {
783
-                $location = geodir_get_default_location();
782
+			} else {
783
+				$location = geodir_get_default_location();
784 784
 				
785 785
 				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
786 786
 				$gd_region = isset($location->region_slug) ? $location->region_slug : '';
787 787
 				$gd_city = isset($location->city_slug) ? $location->city_slug : '';
788
-            }
788
+			}
789 789
 			
790 790
 			if ($geodir_show_location_url == 'all') {
791 791
 				$location_url[] = $gd_country;
@@ -798,99 +798,99 @@  discard block
 block discarded – undo
798 798
 			
799 799
 			$location_url[] = $gd_city;
800 800
 
801
-            $location_url = implode('/', $location_url);
802
-        }
801
+			$location_url = implode('/', $location_url);
802
+		}
803 803
 
804 804
 
805
-        if (!empty($category)) {
806
-            global $geodir_add_location_url;
807
-            $geodir_add_location_url = '0';
808
-            if ($add_location_filter != '0') {
809
-                $geodir_add_location_url = '1';
810
-            }
811
-            $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
812
-            $geodir_add_location_url = NULL;
813
-        }
814
-        ob_start();
815
-        ?>
805
+		if (!empty($category)) {
806
+			global $geodir_add_location_url;
807
+			$geodir_add_location_url = '0';
808
+			if ($add_location_filter != '0') {
809
+				$geodir_add_location_url = '1';
810
+			}
811
+			$viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
812
+			$geodir_add_location_url = NULL;
813
+		}
814
+		ob_start();
815
+		?>
816 816
 
817 817
 
818 818
         <div class="geodir_locations geodir_location_listing">
819 819
 
820 820
             <?php
821
-            if (isset($request['is_widget']) && $request['is_widget'] == '1') {
822
-                /** geodir_before_title filter Documented in geodirectory_widgets.php */
823
-                $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
824
-                /** geodir_after_title filter Documented in geodirectory_widgets.php */
825
-                $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
826
-                ?>
821
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
822
+				/** geodir_before_title filter Documented in geodirectory_widgets.php */
823
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
824
+				/** geodir_after_title filter Documented in geodirectory_widgets.php */
825
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
826
+				?>
827 827
                 <div class="location_list_heading clearfix">
828 828
                     <?php echo $before_title . $title . $after_title; ?>
829 829
                 </div>
830 830
             <?php
831
-            }
832
-            $query_args = array(
833
-                'posts_per_page' => $post_number,
834
-                'is_geodir_loop' => true,
835
-                'gd_location' => ($add_location_filter) ? true : false,
836
-                'post_type' => $post_type,
837
-                'order_by' => $list_sort,
838
-                'post__not_in' => array($post_id),
839
-                'excerpt_length' => $character_count,
840
-                'related_listings' => $is_display
841
-            );
842
-
843
-            $tax_query = array('taxonomy' => $category_taxonomy,
844
-                'field' => $tax_field,
845
-                'terms' => $category
846
-            );
847
-
848
-            $query_args['tax_query'] = array($tax_query);
849
-
850
-            global $gridview_columns, $post;
851
-
852
-
853
-            query_posts($query_args);
854
-
855
-            if (strstr($layout, 'gridview')) {
856
-                $listing_view_exp = explode('_', $layout);
857
-                $gridview_columns = $layout;
858
-                $layout = $listing_view_exp[0];
859
-            } else if ($layout == 'list') {
860
-                $gridview_columns = '';
861
-            }
862
-            $related_posts = true;
831
+			}
832
+			$query_args = array(
833
+				'posts_per_page' => $post_number,
834
+				'is_geodir_loop' => true,
835
+				'gd_location' => ($add_location_filter) ? true : false,
836
+				'post_type' => $post_type,
837
+				'order_by' => $list_sort,
838
+				'post__not_in' => array($post_id),
839
+				'excerpt_length' => $character_count,
840
+				'related_listings' => $is_display
841
+			);
842
+
843
+			$tax_query = array('taxonomy' => $category_taxonomy,
844
+				'field' => $tax_field,
845
+				'terms' => $category
846
+			);
847
+
848
+			$query_args['tax_query'] = array($tax_query);
849
+
850
+			global $gridview_columns, $post;
851
+
852
+
853
+			query_posts($query_args);
854
+
855
+			if (strstr($layout, 'gridview')) {
856
+				$listing_view_exp = explode('_', $layout);
857
+				$gridview_columns = $layout;
858
+				$layout = $listing_view_exp[0];
859
+			} else if ($layout == 'list') {
860
+				$gridview_columns = '';
861
+			}
862
+			$related_posts = true;
863 863
 
864
-            $related_nearest = false;
865
-            if ($list_sort == 'nearest') {
866
-                $related_nearest = true;
867
-            }
864
+			$related_nearest = false;
865
+			if ($list_sort == 'nearest') {
866
+				$related_nearest = true;
867
+			}
868 868
 
869 869
 
870
-            /**
871
-             * Filters related listing listview template.
872
-             *
873
-             * @since 1.0.0
874
-             */
875
-            $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
870
+			/**
871
+			 * Filters related listing listview template.
872
+			 *
873
+			 * @since 1.0.0
874
+			 */
875
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
876 876
 
877
-            /**
878
-             * Includes related listing listview template.
879
-             *
880
-             * @since 1.0.0
881
-             */
882
-            include($template);
877
+			/**
878
+			 * Includes related listing listview template.
879
+			 *
880
+			 * @since 1.0.0
881
+			 */
882
+			include($template);
883 883
 
884
-            wp_reset_query();
885
-            $post = $origi_post;
886
-            $related_nearest = false;
887
-            ?>
884
+			wp_reset_query();
885
+			$post = $origi_post;
886
+			$related_nearest = false;
887
+			?>
888 888
 
889 889
         </div>
890 890
         <?php
891
-        return $html = ob_get_clean();
891
+		return $html = ob_get_clean();
892 892
 
893
-    }
893
+	}
894 894
 
895 895
 }
896 896
 
@@ -906,17 +906,17 @@  discard block
 block discarded – undo
906 906
  */
907 907
 function geodir_category_count_script()
908 908
 {
909
-    global $geodir_post_category_str;
909
+	global $geodir_post_category_str;
910 910
 
911
-    if (!empty($geodir_post_category_str)) {
912
-        $geodir_post_category_str = serialize($geodir_post_category_str);
913
-    }
911
+	if (!empty($geodir_post_category_str)) {
912
+		$geodir_post_category_str = serialize($geodir_post_category_str);
913
+	}
914 914
 
915
-    $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
916
-    $script = "var post_category_array = " . json_encode($all_var) . ';';
917
-    echo '<script>';
918
-    echo $script;
919
-    echo '</script>';
915
+	$all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
916
+	$script = "var post_category_array = " . json_encode($all_var) . ';';
917
+	echo '<script>';
918
+	echo $script;
919
+	echo '</script>';
920 920
 
921 921
 }
922 922
 
@@ -929,16 +929,16 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_map_default_language()
931 931
 {
932
-    $geodir_default_map_language = get_option('geodir_default_map_language');
933
-    if (empty($geodir_default_map_language))
934
-        $geodir_default_map_language = 'en';
935
-    /**
936
-     * Filter default map language.
937
-     *
938
-     * @since 1.0.0
939
-     * @param string $geodir_default_map_language Default map language.
940
-     */
941
-    return apply_filters('geodir_default_map_language', $geodir_default_map_language);
932
+	$geodir_default_map_language = get_option('geodir_default_map_language');
933
+	if (empty($geodir_default_map_language))
934
+		$geodir_default_map_language = 'en';
935
+	/**
936
+	 * Filter default map language.
937
+	 *
938
+	 * @since 1.0.0
939
+	 * @param string $geodir_default_map_language Default map language.
940
+	 */
941
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
942 942
 }
943 943
 
944 944
 /**
@@ -950,14 +950,14 @@  discard block
 block discarded – undo
950 950
  */
951 951
 function geodir_get_map_api_key()
952 952
 {
953
-    $key = get_option('geodir_google_api_key');
954
-    /**
955
-     * Filter Google maps api key.
956
-     *
957
-     * @since 1.6.4
958
-     * @param string $key Google maps api key.
959
-     */
960
-    return apply_filters('geodir_google_api_key', $key);
953
+	$key = get_option('geodir_google_api_key');
954
+	/**
955
+	 * Filter Google maps api key.
956
+	 *
957
+	 * @since 1.6.4
958
+	 * @param string $key Google maps api key.
959
+	 */
960
+	return apply_filters('geodir_google_api_key', $key);
961 961
 }
962 962
 
963 963
 
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
  */
975 975
 function geodir_add_meta_keywords()
976 976
 {
977
-    global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
977
+	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
978 978
 
979
-    $is_geodir_page = geodir_is_geodir_page();
980
-    if (!$is_geodir_page) {
981
-        return;
982
-    }// if non GD page, bail
979
+	$is_geodir_page = geodir_is_geodir_page();
980
+	if (!$is_geodir_page) {
981
+		return;
982
+	}// if non GD page, bail
983 983
 
984 984
 	$use_gd_meta = true;
985 985
 	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
@@ -994,249 +994,249 @@  discard block
 block discarded – undo
994 994
 		return;
995 995
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
996 996
 
997
-    $current_term = $wp_query->get_queried_object();
998
-
999
-    $all_postypes = geodir_get_posttypes();
1000
-
1001
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1002
-
1003
-    $meta_desc = '';
1004
-    $meta_key = '';
1005
-    if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1006
-        /**
1007
-         * Filter SEO meta location description.
1008
-         *
1009
-         * @since 1.0.0
1010
-         */
1011
-        $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1012
-        $meta_desc .= '';
1013
-    }
1014
-    if (have_posts() && is_single() OR is_page()) {
1015
-        while (have_posts()) {
1016
-            the_post();
1017
-
1018
-            if (has_excerpt()) {
1019
-                $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1020
-                if (empty($out_excerpt)) {
1021
-                    $out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1022
-                }
1023
-                $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1024
-            } else {
1025
-                $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1026
-                $out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1027
-                if (empty($out_excerpt)) {
1028
-                    $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1029
-                }
1030
-                $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1031
-            }
997
+	$current_term = $wp_query->get_queried_object();
1032 998
 
1033
-            $meta_desc .= $out_excerpt;
1034
-        }
1035
-    } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1036
-        if (is_category()) {
1037
-            $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
1038
-        } elseif (is_tag()) {
1039
-            $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
1040
-        }
1041
-    } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1042
-        $meta_desc .= isset($current_term->description) ? $current_term->description : '';
1043
-    }
1044
-
1045
-
1046
-    $geodir_post_type = geodir_get_current_posttype();
1047
-    $geodir_post_type_info = get_post_type_object($geodir_post_type);
1048
-    $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1049
-
1050
-    $category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1051
-    $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true);
1052
-
1053
-    $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1054
-    $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1055
-
1056
-    $geodir_is_search = geodir_is_page('search') ? true : false;
1057
-    $geodir_is_location = geodir_is_page('location') ? true : false;
1058
-    $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1059
-    $godir_location_terms = geodir_get_current_location_terms('query_vars');
1060
-    $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL;
1061
-    $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL;
1062
-    $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL;
1063
-    $replace_location = __('Everywhere', 'geodirectory');
1064
-    $location_id = NULL;
1065
-    if ($geodir_location_manager) {
1066
-        $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1067
-        $location_id = (int)$wpdb->get_var($sql);
1068
-        $location_type = geodir_what_is_current_location();
1069
-        if ($location_type == 'city') {
1070
-            $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1071
-        } elseif ($location_type == 'region') {
1072
-            $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1073
-        } elseif ($location_type == 'country') {
1074
-            $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1075
-            $replace_location = __($replace_location, 'geodirectory');
1076
-        }
1077
-        $country = get_query_var('gd_country');
1078
-        $region = get_query_var('gd_region');
1079
-        $city = get_query_var('gd_city');
1080
-        $current_location = '';
1081
-        if ($country != '') {
1082
-            $current_location = get_actual_location_name('country', $country, true);
1083
-        }
1084
-        if ($region != '') {
1085
-            $current_location = get_actual_location_name('region', $region);
1086
-        }
1087
-        if ($city != '') {
1088
-            $current_location = get_actual_location_name('city', $city);
1089
-        }
1090
-        $replace_location = $current_location != '' ? $current_location : $replace_location;
1091
-    }
1092
-
1093
-    $geodir_meta_keys = '';
1094
-    $geodir_meta_desc = '';
1095
-    if ($is_geodir_page && !empty($geodir_post_type_info)) {
1096
-        if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1097
-            $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1098
-
1099
-            $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1100
-            $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1101
-
1102
-            if ($geodir_is_category) {
1103
-                $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
1104
-                if (isset($category->term_id) && !empty($category->term_id)) {
1105
-                    $category_id = $category->term_id;
1106
-                    $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1107
-                    if ($location_id) {
1108
-                        $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1109
-                        $cat_loc_option = get_option($option_name);
1110
-
1111
-                        $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1112
-                        if (!$gd_cat_loc_default) {
1113
-                            $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1114
-                            $option = get_option($option_name);
1115
-                            $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1116
-                        }
1117
-                    }
1118
-                    $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
1119
-                }
1120
-            } else if ($geodir_is_tag) {
1121
-                $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
1122
-            }
1123
-        }
1124
-    }
1125
-
1126
-
1127
-    $gd_page = '';
1128
-    if(geodir_is_page('home')){
1129
-        $gd_page = 'home';
1130
-        $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1131
-    }
1132
-    elseif(geodir_is_page('detail')){
1133
-        $gd_page = 'detail';
1134
-        $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1135
-    }
1136
-    elseif(geodir_is_page('pt')){
1137
-        $gd_page = 'pt';
1138
-        $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1139
-    }
1140
-    elseif(geodir_is_page('listing')){
1141
-        $gd_page = 'listing';
1142
-        $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1143
-    }
1144
-    elseif(geodir_is_page('location')){
1145
-        $gd_page = 'location';
1146
-        $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1147
-        $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1148
-
1149
-    }
1150
-    elseif(geodir_is_page('search')){
1151
-        $gd_page = 'search';
1152
-        $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1153
-    }
1154
-    elseif(geodir_is_page('add-listing')){
1155
-        $gd_page = 'add-listing';
1156
-        $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1157
-    }
1158
-    elseif(geodir_is_page('author')){
1159
-        $gd_page = 'author';
1160
-        $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1161
-    }
1162
-    elseif(geodir_is_page('login')){
1163
-        $gd_page = 'login';
1164
-        $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1165
-    }
1166
-    elseif(geodir_is_page('listing-success')){
1167
-        $gd_page = 'listing-success';
1168
-        $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1169
-    }
1170
-
1171
-
1172
-    if ($meta_desc) {
1173
-        $meta_desc = stripslashes_deep($meta_desc);
1174
-        /**
1175
-         * Filter page description to replace variables.
1176
-         *
1177
-         * @since 1.5.4
1178
-         * @param string $title The page description including variables.
1179
-         * @param string $gd_page The GeoDirectory page type if any.
1180
-         */
1181
-        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1182
-
1183
-        /**
1184
-         * Filter SEO meta description.
1185
-         *
1186
-         * @since 1.0.0
1187
-         * @param string $meta_desc Meta description content.
1188
-         */
1189
-        echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
1190
-    }
1191
-
1192
-    // meta keywords
1193
-    if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1194
-        $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1195
-        $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1196
-
1197
-        $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1198
-    } else {
1199
-        $posttags = get_the_tags();
1200
-        if ($posttags) {
1201
-            foreach ($posttags as $tag) {
1202
-                $meta_key .= $tag->name . ' ';
1203
-            }
1204
-        } else {
1205
-            $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1206
-            $xt = 1;
999
+	$all_postypes = geodir_get_posttypes();
1207 1000
 
1208
-            foreach ($tags as $tag) {
1209
-                if ($xt <= 20) {
1210
-                    $meta_key .= $tag->name . ", ";
1211
-                }
1001
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1212 1002
 
1213
-                $xt++;
1214
-            }
1215
-        }
1216
-    }
1217
-
1218
-    $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1219
-    $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1220
-    if ($geodir_meta_keys != '') {
1221
-        $geodir_meta_keys = strip_tags($geodir_meta_keys);
1222
-        $geodir_meta_keys = esc_html($geodir_meta_keys);
1223
-        $geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1224
-        $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1225
-        $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1226
-
1227
-        $meta_key = rtrim(trim($geodir_meta_keys), ",");
1228
-    }
1229
-
1230
-    if ($meta_key) {
1231
-        $meta_key = stripslashes_deep($meta_key);
1232
-        /**
1233
-         * Filter SEO meta keywords.
1234
-         *
1235
-         * @since 1.0.0
1236
-         * @param string $meta_desc Meta keywords.
1237
-         */
1238
-        echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
1239
-    }
1003
+	$meta_desc = '';
1004
+	$meta_key = '';
1005
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1006
+		/**
1007
+		 * Filter SEO meta location description.
1008
+		 *
1009
+		 * @since 1.0.0
1010
+		 */
1011
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1012
+		$meta_desc .= '';
1013
+	}
1014
+	if (have_posts() && is_single() OR is_page()) {
1015
+		while (have_posts()) {
1016
+			the_post();
1017
+
1018
+			if (has_excerpt()) {
1019
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1020
+				if (empty($out_excerpt)) {
1021
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1022
+				}
1023
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1024
+			} else {
1025
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1026
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1027
+				if (empty($out_excerpt)) {
1028
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1029
+				}
1030
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1031
+			}
1032
+
1033
+			$meta_desc .= $out_excerpt;
1034
+		}
1035
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1036
+		if (is_category()) {
1037
+			$meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
1038
+		} elseif (is_tag()) {
1039
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
1040
+		}
1041
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1042
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1043
+	}
1044
+
1045
+
1046
+	$geodir_post_type = geodir_get_current_posttype();
1047
+	$geodir_post_type_info = get_post_type_object($geodir_post_type);
1048
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1049
+
1050
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1051
+	$tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true);
1052
+
1053
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1054
+	$geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1055
+
1056
+	$geodir_is_search = geodir_is_page('search') ? true : false;
1057
+	$geodir_is_location = geodir_is_page('location') ? true : false;
1058
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1059
+	$godir_location_terms = geodir_get_current_location_terms('query_vars');
1060
+	$gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL;
1061
+	$gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL;
1062
+	$gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL;
1063
+	$replace_location = __('Everywhere', 'geodirectory');
1064
+	$location_id = NULL;
1065
+	if ($geodir_location_manager) {
1066
+		$sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1067
+		$location_id = (int)$wpdb->get_var($sql);
1068
+		$location_type = geodir_what_is_current_location();
1069
+		if ($location_type == 'city') {
1070
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1071
+		} elseif ($location_type == 'region') {
1072
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1073
+		} elseif ($location_type == 'country') {
1074
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1075
+			$replace_location = __($replace_location, 'geodirectory');
1076
+		}
1077
+		$country = get_query_var('gd_country');
1078
+		$region = get_query_var('gd_region');
1079
+		$city = get_query_var('gd_city');
1080
+		$current_location = '';
1081
+		if ($country != '') {
1082
+			$current_location = get_actual_location_name('country', $country, true);
1083
+		}
1084
+		if ($region != '') {
1085
+			$current_location = get_actual_location_name('region', $region);
1086
+		}
1087
+		if ($city != '') {
1088
+			$current_location = get_actual_location_name('city', $city);
1089
+		}
1090
+		$replace_location = $current_location != '' ? $current_location : $replace_location;
1091
+	}
1092
+
1093
+	$geodir_meta_keys = '';
1094
+	$geodir_meta_desc = '';
1095
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1096
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1097
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1098
+
1099
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1100
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1101
+
1102
+			if ($geodir_is_category) {
1103
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
1104
+				if (isset($category->term_id) && !empty($category->term_id)) {
1105
+					$category_id = $category->term_id;
1106
+					$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1107
+					if ($location_id) {
1108
+						$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1109
+						$cat_loc_option = get_option($option_name);
1110
+
1111
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1112
+						if (!$gd_cat_loc_default) {
1113
+							$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1114
+							$option = get_option($option_name);
1115
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1116
+						}
1117
+					}
1118
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
1119
+				}
1120
+			} else if ($geodir_is_tag) {
1121
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
1122
+			}
1123
+		}
1124
+	}
1125
+
1126
+
1127
+	$gd_page = '';
1128
+	if(geodir_is_page('home')){
1129
+		$gd_page = 'home';
1130
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1131
+	}
1132
+	elseif(geodir_is_page('detail')){
1133
+		$gd_page = 'detail';
1134
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1135
+	}
1136
+	elseif(geodir_is_page('pt')){
1137
+		$gd_page = 'pt';
1138
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1139
+	}
1140
+	elseif(geodir_is_page('listing')){
1141
+		$gd_page = 'listing';
1142
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1143
+	}
1144
+	elseif(geodir_is_page('location')){
1145
+		$gd_page = 'location';
1146
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1147
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1148
+
1149
+	}
1150
+	elseif(geodir_is_page('search')){
1151
+		$gd_page = 'search';
1152
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1153
+	}
1154
+	elseif(geodir_is_page('add-listing')){
1155
+		$gd_page = 'add-listing';
1156
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1157
+	}
1158
+	elseif(geodir_is_page('author')){
1159
+		$gd_page = 'author';
1160
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1161
+	}
1162
+	elseif(geodir_is_page('login')){
1163
+		$gd_page = 'login';
1164
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1165
+	}
1166
+	elseif(geodir_is_page('listing-success')){
1167
+		$gd_page = 'listing-success';
1168
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1169
+	}
1170
+
1171
+
1172
+	if ($meta_desc) {
1173
+		$meta_desc = stripslashes_deep($meta_desc);
1174
+		/**
1175
+		 * Filter page description to replace variables.
1176
+		 *
1177
+		 * @since 1.5.4
1178
+		 * @param string $title The page description including variables.
1179
+		 * @param string $gd_page The GeoDirectory page type if any.
1180
+		 */
1181
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1182
+
1183
+		/**
1184
+		 * Filter SEO meta description.
1185
+		 *
1186
+		 * @since 1.0.0
1187
+		 * @param string $meta_desc Meta description content.
1188
+		 */
1189
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
1190
+	}
1191
+
1192
+	// meta keywords
1193
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1194
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1195
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1196
+
1197
+		$meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1198
+	} else {
1199
+		$posttags = get_the_tags();
1200
+		if ($posttags) {
1201
+			foreach ($posttags as $tag) {
1202
+				$meta_key .= $tag->name . ' ';
1203
+			}
1204
+		} else {
1205
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1206
+			$xt = 1;
1207
+
1208
+			foreach ($tags as $tag) {
1209
+				if ($xt <= 20) {
1210
+					$meta_key .= $tag->name . ", ";
1211
+				}
1212
+
1213
+				$xt++;
1214
+			}
1215
+		}
1216
+	}
1217
+
1218
+	$meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1219
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1220
+	if ($geodir_meta_keys != '') {
1221
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1222
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1223
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1224
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1225
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1226
+
1227
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1228
+	}
1229
+
1230
+	if ($meta_key) {
1231
+		$meta_key = stripslashes_deep($meta_key);
1232
+		/**
1233
+		 * Filter SEO meta keywords.
1234
+		 *
1235
+		 * @since 1.0.0
1236
+		 * @param string $meta_desc Meta keywords.
1237
+		 */
1238
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
1239
+	}
1240 1240
 
1241 1241
 }
1242 1242
 
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
  */
1252 1252
 function geodir_detail_page_tabs_key_value_array()
1253 1253
 {
1254
-    $geodir_detail_page_tabs_key_value_array = array();
1254
+	$geodir_detail_page_tabs_key_value_array = array();
1255 1255
 
1256
-    $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1256
+	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1257 1257
 
1258
-    foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1259
-        $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1260
-    }
1261
-    return $geodir_detail_page_tabs_key_value_array;
1258
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1259
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1260
+	}
1261
+	return $geodir_detail_page_tabs_key_value_array;
1262 1262
 }
1263 1263
 
1264 1264
 /**
@@ -1271,73 +1271,73 @@  discard block
 block discarded – undo
1271 1271
 function geodir_detail_page_tabs_array()
1272 1272
 {
1273 1273
 
1274
-    $arr_tabs = array();
1275
-    /**
1276
-     * Filter detail page tab display.
1277
-     *
1278
-     * @since 1.0.0
1279
-     */
1280
-    $arr_tabs['post_profile'] = array(
1281
-        'heading_text' => __('Profile', 'geodirectory'),
1282
-        'is_active_tab' => true,
1283
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1284
-        'tab_content' => ''
1285
-    );
1286
-    $arr_tabs['post_info'] = array(
1287
-        'heading_text' => __('More Info', 'geodirectory'),
1288
-        'is_active_tab' => false,
1289
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1290
-        'tab_content' => ''
1291
-    );
1292
-
1293
-    $arr_tabs['post_images'] = array(
1294
-        'heading_text' => __('Photo', 'geodirectory'),
1295
-        'is_active_tab' => false,
1296
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1297
-        'tab_content' => ''
1298
-    );
1299
-
1300
-    $arr_tabs['post_video'] = array(
1301
-        'heading_text' => __('Video', 'geodirectory'),
1302
-        'is_active_tab' => false,
1303
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1304
-        'tab_content' => ''
1305
-    );
1306
-
1307
-    $arr_tabs['special_offers'] = array(
1308
-        'heading_text' => __('Special Offers', 'geodirectory'),
1309
-        'is_active_tab' => false,
1310
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1311
-        'tab_content' => ''
1312
-    );
1313
-
1314
-    $arr_tabs['post_map'] = array(
1315
-        'heading_text' => __('Map', 'geodirectory'),
1316
-        'is_active_tab' => false,
1317
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1318
-        'tab_content' => ''
1319
-    );
1320
-
1321
-    $arr_tabs['reviews'] = array(
1322
-        'heading_text' => __('Reviews', 'geodirectory'),
1323
-        'is_active_tab' => false,
1324
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1325
-        'tab_content' => 'review display'
1326
-    );
1327
-
1328
-    $arr_tabs['related_listing'] = array(
1329
-        'heading_text' => __('Related Listing', 'geodirectory'),
1330
-        'is_active_tab' => false,
1331
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1332
-        'tab_content' => ''
1333
-    );
1334
-
1335
-    /**
1336
-     * Filter the tabs array.
1337
-     *
1338
-     * @since 1.0.0
1339
-     */
1340
-    return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1274
+	$arr_tabs = array();
1275
+	/**
1276
+	 * Filter detail page tab display.
1277
+	 *
1278
+	 * @since 1.0.0
1279
+	 */
1280
+	$arr_tabs['post_profile'] = array(
1281
+		'heading_text' => __('Profile', 'geodirectory'),
1282
+		'is_active_tab' => true,
1283
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1284
+		'tab_content' => ''
1285
+	);
1286
+	$arr_tabs['post_info'] = array(
1287
+		'heading_text' => __('More Info', 'geodirectory'),
1288
+		'is_active_tab' => false,
1289
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1290
+		'tab_content' => ''
1291
+	);
1292
+
1293
+	$arr_tabs['post_images'] = array(
1294
+		'heading_text' => __('Photo', 'geodirectory'),
1295
+		'is_active_tab' => false,
1296
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1297
+		'tab_content' => ''
1298
+	);
1299
+
1300
+	$arr_tabs['post_video'] = array(
1301
+		'heading_text' => __('Video', 'geodirectory'),
1302
+		'is_active_tab' => false,
1303
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1304
+		'tab_content' => ''
1305
+	);
1306
+
1307
+	$arr_tabs['special_offers'] = array(
1308
+		'heading_text' => __('Special Offers', 'geodirectory'),
1309
+		'is_active_tab' => false,
1310
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1311
+		'tab_content' => ''
1312
+	);
1313
+
1314
+	$arr_tabs['post_map'] = array(
1315
+		'heading_text' => __('Map', 'geodirectory'),
1316
+		'is_active_tab' => false,
1317
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1318
+		'tab_content' => ''
1319
+	);
1320
+
1321
+	$arr_tabs['reviews'] = array(
1322
+		'heading_text' => __('Reviews', 'geodirectory'),
1323
+		'is_active_tab' => false,
1324
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1325
+		'tab_content' => 'review display'
1326
+	);
1327
+
1328
+	$arr_tabs['related_listing'] = array(
1329
+		'heading_text' => __('Related Listing', 'geodirectory'),
1330
+		'is_active_tab' => false,
1331
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1332
+		'tab_content' => ''
1333
+	);
1334
+
1335
+	/**
1336
+	 * Filter the tabs array.
1337
+	 *
1338
+	 * @since 1.0.0
1339
+	 */
1340
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1341 1341
 
1342 1342
 
1343 1343
 }
@@ -1352,15 +1352,15 @@  discard block
 block discarded – undo
1352 1352
  */
1353 1353
 function geodir_detail_page_tabs_list()
1354 1354
 {
1355
-    $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1356
-    $tabs_array = geodir_detail_page_tabs_array();
1357
-    if (!empty($tabs_excluded)) {
1358
-        foreach ($tabs_excluded as $tab) {
1359
-            if (array_key_exists($tab, $tabs_array))
1360
-                unset($tabs_array[$tab]);
1361
-        }
1362
-    }
1363
-    return $tabs_array;
1355
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1356
+	$tabs_array = geodir_detail_page_tabs_array();
1357
+	if (!empty($tabs_excluded)) {
1358
+		foreach ($tabs_excluded as $tab) {
1359
+			if (array_key_exists($tab, $tabs_array))
1360
+				unset($tabs_array[$tab]);
1361
+		}
1362
+	}
1363
+	return $tabs_array;
1364 1364
 }
1365 1365
 
1366 1366
 
@@ -1378,161 +1378,161 @@  discard block
 block discarded – undo
1378 1378
  */
1379 1379
 function geodir_show_detail_page_tabs()
1380 1380
 {
1381
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1381
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1382 1382
 
1383
-    $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1384
-    $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1385
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1383
+	$post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1384
+	$request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1385
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1386 1386
 
1387
-    if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1388
-        $post = geodir_get_post_info($request_post_id);
1389
-        setup_postdata($post);
1390
-    }
1387
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1388
+		$post = geodir_get_post_info($request_post_id);
1389
+		setup_postdata($post);
1390
+	}
1391 1391
 
1392
-    $geodir_post_detail_fields = geodir_show_listing_info('detail');
1392
+	$geodir_post_detail_fields = geodir_show_listing_info('detail');
1393 1393
 
1394 1394
 
1395
-    if (geodir_is_page('detail')) {
1396
-        $video = geodir_get_video($post->ID);
1397
-        $special_offers = geodir_get_special_offers($post->ID);
1398
-        $related_listing_array = array();
1399
-        if (get_option('geodir_add_related_listing_posttypes'))
1400
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1395
+	if (geodir_is_page('detail')) {
1396
+		$video = geodir_get_video($post->ID);
1397
+		$special_offers = geodir_get_special_offers($post->ID);
1398
+		$related_listing_array = array();
1399
+		if (get_option('geodir_add_related_listing_posttypes'))
1400
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1401 1401
 
1402 1402
 
1403
-        $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1404
-        if(!$excluded_tabs){$excluded_tabs = array();}
1403
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1404
+		if(!$excluded_tabs){$excluded_tabs = array();}
1405 1405
 
1406
-        $related_listing = '';
1407
-        if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1408
-            $request = array('post_number' => get_option('geodir_related_post_count'),
1409
-                'relate_to' => get_option('geodir_related_post_relate_to'),
1410
-                'layout' => get_option('geodir_related_post_listing_view'),
1411
-                'add_location_filter' => get_option('geodir_related_post_location_filter'),
1412
-                'list_sort' => get_option('geodir_related_post_sortby'),
1413
-                'character_count' => get_option('geodir_related_post_excerpt'));
1406
+		$related_listing = '';
1407
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1408
+			$request = array('post_number' => get_option('geodir_related_post_count'),
1409
+				'relate_to' => get_option('geodir_related_post_relate_to'),
1410
+				'layout' => get_option('geodir_related_post_listing_view'),
1411
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1412
+				'list_sort' => get_option('geodir_related_post_sortby'),
1413
+				'character_count' => get_option('geodir_related_post_excerpt'));
1414 1414
 
1415
-            if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1416
-                $related_listing = geodir_get_detail_page_related_events($request);
1417
-            } else {
1418
-                $related_listing = geodir_related_posts_display($request);
1419
-            }
1415
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1416
+				$related_listing = geodir_get_detail_page_related_events($request);
1417
+			} else {
1418
+				$related_listing = geodir_related_posts_display($request);
1419
+			}
1420 1420
 
1421
-        }
1421
+		}
1422 1422
 
1423
-        $post_images = geodir_get_images($post->ID, 'thumbnail');
1424
-        $thumb_image = '';
1425
-        if (!empty($post_images)) {
1426
-            foreach ($post_images as $image) {
1427
-                $caption = (!empty($image->caption)) ? $image->caption : '';
1428
-                $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1429
-                $thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1430
-                $thumb_image .= '</a>';
1431
-            }
1432
-        }
1423
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1424
+		$thumb_image = '';
1425
+		if (!empty($post_images)) {
1426
+			foreach ($post_images as $image) {
1427
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1428
+				$thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1429
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1430
+				$thumb_image .= '</a>';
1431
+			}
1432
+		}
1433 1433
 
1434
-        $map_args = array();
1435
-        $map_args['map_canvas_name'] = 'detail_page_map_canvas';
1436
-        $map_args['width'] = '600';
1437
-        $map_args['height'] = '300';
1438
-        if ($post->post_mapzoom) {
1439
-            $map_args['zoom'] = '' . $post->post_mapzoom . '';
1440
-        }
1441
-        $map_args['autozoom'] = false;
1442
-        $map_args['child_collapse'] = '0';
1443
-        $map_args['enable_cat_filters'] = false;
1444
-        $map_args['enable_text_search'] = false;
1445
-        $map_args['enable_post_type_filters'] = false;
1446
-        $map_args['enable_location_filters'] = false;
1447
-        $map_args['enable_jason_on_load'] = true;
1448
-        $map_args['enable_map_direction'] = true;
1449
-        $map_args['map_class_name'] = 'geodir-map-detail-page';
1450
-        $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1451
-    } else if (geodir_is_page('preview')) {
1452
-        $video = isset($post->geodir_video) ? $post->geodir_video : '';
1453
-        $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1454
-
1455
-        if (isset($post->post_images))
1456
-            $post->post_images = trim($post->post_images, ",");
1457
-
1458
-        if (isset($post->post_images) && !empty($post->post_images))
1459
-            $post_images = explode(",", $post->post_images);
1460
-
1461
-        $thumb_image = '';
1462
-        if (!empty($post_images)) {
1463
-            foreach ($post_images as $image) {
1464
-                if ($image != '') {
1465
-                    $thumb_image .= '<a href="' . $image . '">';
1466
-                    $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1467
-                    $thumb_image .= '</a>';
1468
-                }
1469
-            }
1470
-        }
1434
+		$map_args = array();
1435
+		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1436
+		$map_args['width'] = '600';
1437
+		$map_args['height'] = '300';
1438
+		if ($post->post_mapzoom) {
1439
+			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1440
+		}
1441
+		$map_args['autozoom'] = false;
1442
+		$map_args['child_collapse'] = '0';
1443
+		$map_args['enable_cat_filters'] = false;
1444
+		$map_args['enable_text_search'] = false;
1445
+		$map_args['enable_post_type_filters'] = false;
1446
+		$map_args['enable_location_filters'] = false;
1447
+		$map_args['enable_jason_on_load'] = true;
1448
+		$map_args['enable_map_direction'] = true;
1449
+		$map_args['map_class_name'] = 'geodir-map-detail-page';
1450
+		$map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1451
+	} else if (geodir_is_page('preview')) {
1452
+		$video = isset($post->geodir_video) ? $post->geodir_video : '';
1453
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1454
+
1455
+		if (isset($post->post_images))
1456
+			$post->post_images = trim($post->post_images, ",");
1457
+
1458
+		if (isset($post->post_images) && !empty($post->post_images))
1459
+			$post_images = explode(",", $post->post_images);
1460
+
1461
+		$thumb_image = '';
1462
+		if (!empty($post_images)) {
1463
+			foreach ($post_images as $image) {
1464
+				if ($image != '') {
1465
+					$thumb_image .= '<a href="' . $image . '">';
1466
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1467
+					$thumb_image .= '</a>';
1468
+				}
1469
+			}
1470
+		}
1471 1471
 
1472
-        global $map_jason;
1473
-        $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1474
-        $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1475
-        $icon_size = geodir_get_marker_size($marker_icon);
1476
-        $marker_json['w'] = $icon_size['w'];
1477
-        $marker_json['h'] = $icon_size['h'];
1478
-        $map_jason[] = json_encode($marker_json);
1479
-
1480
-        $address_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
1481
-        $address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1482
-        $mapview = isset($post->post_mapview) ? $post->post_mapview : '';
1483
-        $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1484
-        if (!$mapzoom) {
1485
-            $mapzoom = 12;
1486
-        }
1472
+		global $map_jason;
1473
+		$marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1474
+		$marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1475
+		$icon_size = geodir_get_marker_size($marker_icon);
1476
+		$marker_json['w'] = $icon_size['w'];
1477
+		$marker_json['h'] = $icon_size['h'];
1478
+		$map_jason[] = json_encode($marker_json);
1479
+
1480
+		$address_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
1481
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1482
+		$mapview = isset($post->post_mapview) ? $post->post_mapview : '';
1483
+		$mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1484
+		if (!$mapzoom) {
1485
+			$mapzoom = 12;
1486
+		}
1487 1487
 
1488
-        $map_args = array();
1489
-        $map_args['map_canvas_name'] = 'preview_map_canvas';
1490
-        $map_args['width'] = '950';
1491
-        $map_args['height'] = '300';
1492
-        $map_args['child_collapse'] = '0';
1493
-        $map_args['maptype'] = $mapview;
1494
-        $map_args['autozoom'] = false;
1495
-        $map_args['zoom'] = "$mapzoom";
1496
-        $map_args['latitude'] = $address_latitude;
1497
-        $map_args['longitude'] = $address_longitude;
1498
-        $map_args['enable_cat_filters'] = false;
1499
-        $map_args['enable_text_search'] = false;
1500
-        $map_args['enable_post_type_filters'] = false;
1501
-        $map_args['enable_location_filters'] = false;
1502
-        $map_args['enable_jason_on_load'] = true;
1503
-        $map_args['enable_map_direction'] = true;
1504
-        $map_args['map_class_name'] = 'geodir-map-preview-page';
1505
-    }
1506
-
1507
-    $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1508
-
1509
-    $active_tab = '';
1510
-    $active_tab_name = '';
1511
-    $default_tab = '';
1512
-    $default_tab_name = '';
1513
-    foreach($arr_detail_page_tabs as $tab_index => $tabs){
1514
-        if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1515
-            $active_tab = $tab_index;
1516
-            $active_tab_name = __($tabs['heading_text'], 'geodirectory');
1517
-        }
1488
+		$map_args = array();
1489
+		$map_args['map_canvas_name'] = 'preview_map_canvas';
1490
+		$map_args['width'] = '950';
1491
+		$map_args['height'] = '300';
1492
+		$map_args['child_collapse'] = '0';
1493
+		$map_args['maptype'] = $mapview;
1494
+		$map_args['autozoom'] = false;
1495
+		$map_args['zoom'] = "$mapzoom";
1496
+		$map_args['latitude'] = $address_latitude;
1497
+		$map_args['longitude'] = $address_longitude;
1498
+		$map_args['enable_cat_filters'] = false;
1499
+		$map_args['enable_text_search'] = false;
1500
+		$map_args['enable_post_type_filters'] = false;
1501
+		$map_args['enable_location_filters'] = false;
1502
+		$map_args['enable_jason_on_load'] = true;
1503
+		$map_args['enable_map_direction'] = true;
1504
+		$map_args['map_class_name'] = 'geodir-map-preview-page';
1505
+	}
1506
+
1507
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1508
+
1509
+	$active_tab = '';
1510
+	$active_tab_name = '';
1511
+	$default_tab = '';
1512
+	$default_tab_name = '';
1513
+	foreach($arr_detail_page_tabs as $tab_index => $tabs){
1514
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1515
+			$active_tab = $tab_index;
1516
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1517
+		}
1518 1518
         
1519
-        if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1520
-            $default_tab = $tab_index;
1521
-            $default_tab_name = __($tabs['heading_text'], 'geodirectory');
1522
-        }
1523
-    }
1519
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1520
+			$default_tab = $tab_index;
1521
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1522
+		}
1523
+	}
1524 1524
     
1525
-    if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1526
-        if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1527
-            $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1528
-        }
1525
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1526
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1527
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1528
+		}
1529 1529
         
1530
-        $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1531
-        $active_tab = $default_tab;
1532
-        $active_tab_name = $default_tab_name;
1533
-    }
1534
-    $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
1535
-    ?>
1530
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1531
+		$active_tab = $default_tab;
1532
+		$active_tab_name = $default_tab_name;
1533
+	}
1534
+	$tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
1535
+	?>
1536 1536
     <div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1537 1537
         <?php if(!$tab_list){ ?>
1538 1538
         <div id="geodir-tab-mobile-menu">
@@ -1542,166 +1542,166 @@  discard block
 block discarded – undo
1542 1542
         </div>
1543 1543
         <dl class="geodir-tab-head">
1544 1544
             <?php
1545
-            }
1546
-            /**
1547
-             * Called before the details page tab list headings, inside the `dl` tag.
1548
-             *
1549
-             * @since 1.0.0
1550
-             * @see 'geodir_after_tab_list'
1551
-             */
1552
-            do_action('geodir_before_tab_list'); ?>
1545
+			}
1546
+			/**
1547
+			 * Called before the details page tab list headings, inside the `dl` tag.
1548
+			 *
1549
+			 * @since 1.0.0
1550
+			 * @see 'geodir_after_tab_list'
1551
+			 */
1552
+			do_action('geodir_before_tab_list'); ?>
1553 1553
             <?php
1554 1554
 
1555
-            foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1556
-                if ($detail_page_tab['is_display']) {
1555
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1556
+				if ($detail_page_tab['is_display']) {
1557 1557
 
1558
-                    if(!$tab_list) {
1559
-                        ?>
1558
+					if(!$tab_list) {
1559
+						?>
1560 1560
                         <dt></dt> <!-- added to comply with validation -->
1561 1561
                         <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php } ?> ><a
1562 1562
                                 data-tab="#<?php echo $tab_index; ?>"
1563 1563
                                 data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1564 1564
                         </dd>
1565 1565
                         <?php
1566
-                    }
1567
-                    ob_start() // start tab content buffering
1568
-                    ?>
1566
+					}
1567
+					ob_start() // start tab content buffering
1568
+					?>
1569 1569
                     <li id="<?php echo $tab_index;?>Tab">
1570 1570
                         <?php if($tab_list){
1571
-                            $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />';
1572
-                            /**
1573
-                             * Filter the tab list title html.
1574
-                             *
1575
-                             * @since 1.6.1
1576
-                             * @param string $tab_title The html for the tab title.
1577
-                             * @param string $tab_index The tab index type.
1578
-                             * @param array $detail_page_tab The array of values including title text.
1579
-                             */
1580
-                            echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
1581
-                        }?>
1571
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />';
1572
+							/**
1573
+							 * Filter the tab list title html.
1574
+							 *
1575
+							 * @since 1.6.1
1576
+							 * @param string $tab_title The html for the tab title.
1577
+							 * @param string $tab_index The tab index type.
1578
+							 * @param array $detail_page_tab The array of values including title text.
1579
+							 */
1580
+							echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
1581
+						}?>
1582 1582
                         <div id="<?php echo $tab_index;?>" class="hash-offset"></div>
1583 1583
                         <?php
1584
-                        /**
1585
-                         * Called before the details tab content is output per tab.
1586
-                         *
1587
-                         * @since 1.0.0
1588
-                         * @param string $tab_index The tab name ID.
1589
-                         */
1590
-                        do_action('geodir_before_tab_content', $tab_index);
1591
-
1592
-                        /**
1593
-                         * Called before the details tab content is output per tab.
1594
-                         *
1595
-                         * Uses dynamic hook name: geodir_before_$tab_index_tab_content
1596
-                         *
1597
-                         * @since 1.0.0
1598
-                         * @todo do we need this if we have the hook above? 'geodir_before_tab_content'
1599
-                         */
1600
-                        do_action('geodir_before_' . $tab_index . '_tab_content');
1601
-                        /// write a code to generate content of each tab
1602
-                        switch ($tab_index) {
1603
-                            case 'post_profile':
1604
-                                /**
1605
-                                 * Called before the listing description content on the details page tab.
1606
-                                 *
1607
-                                 * @since 1.0.0
1608
-                                 */
1609
-                                do_action('geodir_before_description_on_listing_detail');
1610
-                                if (geodir_is_page('detail')) {
1611
-                                    the_content();
1612
-                                } else {
1613
-                                    /** This action is documented in geodirectory_template_actions.php */
1614
-                                    echo apply_filters('the_content', stripslashes($post->post_desc));
1615
-                                }
1616
-
1617
-                                /**
1618
-                                 * Called after the listing description content on the details page tab.
1619
-                                 *
1620
-                                 * @since 1.0.0
1621
-                                 */
1622
-                                do_action('geodir_after_description_on_listing_detail');
1623
-                                break;
1624
-                            case 'post_info':
1625
-                                echo $geodir_post_detail_fields;
1626
-                                break;
1627
-                            case 'post_images':
1628
-                                echo $thumb_image;
1629
-                                break;
1630
-                            case 'post_video':
1631
-                                /** This action is documented in geodirectory_template_actions.php */
1632
-                                echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1633
-                                break;
1634
-                            case 'special_offers':
1635
-                                echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1636
-
1637
-                                break;
1638
-                            case 'post_map':
1639
-                                geodir_draw_map($map_args);
1640
-                                break;
1641
-                            case 'reviews':
1642
-                                comments_template();
1643
-                                break;
1644
-                            case 'related_listing':
1645
-                                echo $related_listing;
1646
-                                break;
1647
-                            default: {
1648
-                                if ((isset($post->{$tab_index}) || (!isset($post->{$tab_index}) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1649
-                                    echo $detail_page_tab['tab_content'];
1650
-                                }
1651
-                            }
1652
-                                break;
1653
-                        }
1654
-
1655
-                        /**
1656
-                         * Called after the details tab content is output per tab.
1657
-                         *
1658
-                         * @since 1.0.0
1659
-                         */
1660
-                        do_action('geodir_after_tab_content', $tab_index);
1661
-
1662
-                        /**
1663
-                         * Called after the details tab content is output per tab.
1664
-                         *
1665
-                         * Uses dynamic hook name: geodir_after_$tab_index_tab_content
1666
-                         *
1667
-                         * @since 1.0.0
1668
-                         * @todo do we need this if we have the hook above? 'geodir_after_tab_content'
1669
-                         */
1670
-                        do_action('geodir_after_' . $tab_index . '_tab_content');
1671
-                        ?> </li>
1584
+						/**
1585
+						 * Called before the details tab content is output per tab.
1586
+						 *
1587
+						 * @since 1.0.0
1588
+						 * @param string $tab_index The tab name ID.
1589
+						 */
1590
+						do_action('geodir_before_tab_content', $tab_index);
1591
+
1592
+						/**
1593
+						 * Called before the details tab content is output per tab.
1594
+						 *
1595
+						 * Uses dynamic hook name: geodir_before_$tab_index_tab_content
1596
+						 *
1597
+						 * @since 1.0.0
1598
+						 * @todo do we need this if we have the hook above? 'geodir_before_tab_content'
1599
+						 */
1600
+						do_action('geodir_before_' . $tab_index . '_tab_content');
1601
+						/// write a code to generate content of each tab
1602
+						switch ($tab_index) {
1603
+							case 'post_profile':
1604
+								/**
1605
+								 * Called before the listing description content on the details page tab.
1606
+								 *
1607
+								 * @since 1.0.0
1608
+								 */
1609
+								do_action('geodir_before_description_on_listing_detail');
1610
+								if (geodir_is_page('detail')) {
1611
+									the_content();
1612
+								} else {
1613
+									/** This action is documented in geodirectory_template_actions.php */
1614
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1615
+								}
1616
+
1617
+								/**
1618
+								 * Called after the listing description content on the details page tab.
1619
+								 *
1620
+								 * @since 1.0.0
1621
+								 */
1622
+								do_action('geodir_after_description_on_listing_detail');
1623
+								break;
1624
+							case 'post_info':
1625
+								echo $geodir_post_detail_fields;
1626
+								break;
1627
+							case 'post_images':
1628
+								echo $thumb_image;
1629
+								break;
1630
+							case 'post_video':
1631
+								/** This action is documented in geodirectory_template_actions.php */
1632
+								echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1633
+								break;
1634
+							case 'special_offers':
1635
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1636
+
1637
+								break;
1638
+							case 'post_map':
1639
+								geodir_draw_map($map_args);
1640
+								break;
1641
+							case 'reviews':
1642
+								comments_template();
1643
+								break;
1644
+							case 'related_listing':
1645
+								echo $related_listing;
1646
+								break;
1647
+							default: {
1648
+								if ((isset($post->{$tab_index}) || (!isset($post->{$tab_index}) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1649
+									echo $detail_page_tab['tab_content'];
1650
+								}
1651
+							}
1652
+								break;
1653
+						}
1654
+
1655
+						/**
1656
+						 * Called after the details tab content is output per tab.
1657
+						 *
1658
+						 * @since 1.0.0
1659
+						 */
1660
+						do_action('geodir_after_tab_content', $tab_index);
1661
+
1662
+						/**
1663
+						 * Called after the details tab content is output per tab.
1664
+						 *
1665
+						 * Uses dynamic hook name: geodir_after_$tab_index_tab_content
1666
+						 *
1667
+						 * @since 1.0.0
1668
+						 * @todo do we need this if we have the hook above? 'geodir_after_tab_content'
1669
+						 */
1670
+						do_action('geodir_after_' . $tab_index . '_tab_content');
1671
+						?> </li>
1672 1672
                     <?php
1673
-                    /**
1674
-                     * Filter the current tab content.
1675
-                     *
1676
-                     * @since 1.0.0
1677
-                     */
1678
-                    $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
1679
-                } // end of if for is_display
1680
-            }// end of foreach
1681
-
1682
-            /**
1683
-             * Called after the details page tab list headings, inside the `dl` tag.
1684
-             *
1685
-             * @since 1.0.0
1686
-             * @see 'geodir_before_tab_list'
1687
-             */
1688
-            do_action('geodir_after_tab_list');
1689
-            ?>
1673
+					/**
1674
+					 * Filter the current tab content.
1675
+					 *
1676
+					 * @since 1.0.0
1677
+					 */
1678
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
1679
+				} // end of if for is_display
1680
+			}// end of foreach
1681
+
1682
+			/**
1683
+			 * Called after the details page tab list headings, inside the `dl` tag.
1684
+			 *
1685
+			 * @since 1.0.0
1686
+			 * @see 'geodir_before_tab_list'
1687
+			 */
1688
+			do_action('geodir_after_tab_list');
1689
+			?>
1690 1690
             <?php if(!$tab_list){?></dl><?php }?>
1691 1691
         <ul class="geodir-tabs-content entry-content <?php if($tab_list){?>geodir-tabs-list<?php }?>" style="position:relative;">
1692 1692
             <?php
1693
-            foreach ($arr_detail_page_tabs as $detail_page_tab) {
1694
-                if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1695
-                    echo $detail_page_tab['tab_content'];
1696
-                }// end of if
1697
-            }// end of foreach
1698
-
1699
-            /**
1700
-             * Called after all the tab content is output in `li` tags, called before the closing `ul` tag.
1701
-             *
1702
-             * @since 1.0.0
1703
-             */
1704
-            do_action('geodir_add_tab_content'); ?>
1693
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1694
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1695
+					echo $detail_page_tab['tab_content'];
1696
+				}// end of if
1697
+			}// end of foreach
1698
+
1699
+			/**
1700
+			 * Called after all the tab content is output in `li` tags, called before the closing `ul` tag.
1701
+			 *
1702
+			 * @since 1.0.0
1703
+			 */
1704
+			do_action('geodir_add_tab_content'); ?>
1705 1705
         </ul>
1706 1706
         <!--gd-tabs-content ul end-->
1707 1707
     </div>
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
         });
1725 1725
     </script>
1726 1726
     <?php
1727
-    }
1727
+	}
1728 1728
 }
1729 1729
 
1730 1730
 /**
@@ -1737,127 +1737,127 @@  discard block
 block discarded – undo
1737 1737
  */
1738 1738
 function geodir_exif($file)
1739 1739
 {
1740
-    if (empty($file) || !is_array($file)) {
1741
-        return $file;
1742
-    }
1740
+	if (empty($file) || !is_array($file)) {
1741
+		return $file;
1742
+	}
1743 1743
     
1744
-    $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1745
-    if (!($file_path && file_exists($file_path))) {
1746
-        return $file;
1747
-    }
1748
-    $file['file'] = $file_path;
1744
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1745
+	if (!($file_path && file_exists($file_path))) {
1746
+		return $file;
1747
+	}
1748
+	$file['file'] = $file_path;
1749 1749
     
1750
-    if (!file_is_valid_image($file_path)) {
1751
-        return $file; // Bail if file is not an image.
1752
-    }
1750
+	if (!file_is_valid_image($file_path)) {
1751
+		return $file; // Bail if file is not an image.
1752
+	}
1753 1753
     
1754
-    if (!function_exists('wp_get_image_editor')) {
1755
-        return $file;
1756
-    }
1754
+	if (!function_exists('wp_get_image_editor')) {
1755
+		return $file;
1756
+	}
1757 1757
    
1758
-    $mime_type = $file['type'];
1759
-    $exif = array();
1760
-    if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1761
-        try {
1762
-            $exif = exif_read_data($file_path);
1763
-        } catch(Exception $e) {
1764
-            $exif = array();
1765
-        }
1766
-    }
1758
+	$mime_type = $file['type'];
1759
+	$exif = array();
1760
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1761
+		try {
1762
+			$exif = exif_read_data($file_path);
1763
+		} catch(Exception $e) {
1764
+			$exif = array();
1765
+		}
1766
+	}
1767 1767
     
1768
-    $rotate = false;
1769
-    $flip = false;
1770
-    $modify = false;
1771
-    $orientation = 0;
1772
-    if (!empty($exif) && isset($exif['Orientation'])) {
1773
-        switch ((int)$exif['Orientation']) {
1774
-            case 1:
1775
-                // do nothing
1776
-                break;
1777
-            case 2:
1778
-                $flip = array(false, true);
1779
-                $modify = true;
1780
-                break;
1781
-            case 3:
1782
-                $orientation = -180;
1783
-                $rotate = true;
1784
-                $modify = true;
1785
-                break;
1786
-            case 4:
1787
-                $flip = array(true, false);
1788
-                $modify = true;
1789
-                break;
1790
-            case 5:
1791
-                $orientation = -90;
1792
-                $rotate = true;
1793
-                $flip = array(false, true);
1794
-                $modify = true;
1795
-                break;
1796
-            case 6:
1797
-                $orientation = -90;
1798
-                $rotate = true;
1799
-                $modify = true;
1800
-                break;
1801
-            case 7:
1802
-                $orientation = -270;
1803
-                $rotate = true;
1804
-                $flip = array(false, true);
1805
-                $modify = true;
1806
-                break;
1807
-            case 8:
1808
-            case 9:
1809
-                $orientation = -270;
1810
-                $rotate = true;
1811
-                $modify = true;
1812
-                break;
1813
-            default:
1814
-                $orientation = 0;
1815
-                $rotate = true;
1816
-                $modify = true;
1817
-                break;
1818
-        }
1819
-    }
1768
+	$rotate = false;
1769
+	$flip = false;
1770
+	$modify = false;
1771
+	$orientation = 0;
1772
+	if (!empty($exif) && isset($exif['Orientation'])) {
1773
+		switch ((int)$exif['Orientation']) {
1774
+			case 1:
1775
+				// do nothing
1776
+				break;
1777
+			case 2:
1778
+				$flip = array(false, true);
1779
+				$modify = true;
1780
+				break;
1781
+			case 3:
1782
+				$orientation = -180;
1783
+				$rotate = true;
1784
+				$modify = true;
1785
+				break;
1786
+			case 4:
1787
+				$flip = array(true, false);
1788
+				$modify = true;
1789
+				break;
1790
+			case 5:
1791
+				$orientation = -90;
1792
+				$rotate = true;
1793
+				$flip = array(false, true);
1794
+				$modify = true;
1795
+				break;
1796
+			case 6:
1797
+				$orientation = -90;
1798
+				$rotate = true;
1799
+				$modify = true;
1800
+				break;
1801
+			case 7:
1802
+				$orientation = -270;
1803
+				$rotate = true;
1804
+				$flip = array(false, true);
1805
+				$modify = true;
1806
+				break;
1807
+			case 8:
1808
+			case 9:
1809
+				$orientation = -270;
1810
+				$rotate = true;
1811
+				$modify = true;
1812
+				break;
1813
+			default:
1814
+				$orientation = 0;
1815
+				$rotate = true;
1816
+				$modify = true;
1817
+				break;
1818
+		}
1819
+	}
1820 1820
     
1821
-    $quality = null;
1822
-    /**
1823
-     * Filter the image quality.
1824
-     *
1825
-     * @since 1.5.7
1826
-     * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1827
-     * @param string $quality Image mime type.
1828
-     */
1829
-    $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1830
-    if ($quality !== null) {
1831
-        $modify = true;
1832
-    }
1833
-
1834
-    if (!$modify) {
1835
-        return $file; // no change
1836
-    }
1837
-
1838
-    $image = wp_get_image_editor($file_path);
1839
-    if (!is_wp_error($image)) {
1840
-        if ($rotate) {
1841
-            $image->rotate($orientation);
1842
-        }
1821
+	$quality = null;
1822
+	/**
1823
+	 * Filter the image quality.
1824
+	 *
1825
+	 * @since 1.5.7
1826
+	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1827
+	 * @param string $quality Image mime type.
1828
+	 */
1829
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1830
+	if ($quality !== null) {
1831
+		$modify = true;
1832
+	}
1833
+
1834
+	if (!$modify) {
1835
+		return $file; // no change
1836
+	}
1837
+
1838
+	$image = wp_get_image_editor($file_path);
1839
+	if (!is_wp_error($image)) {
1840
+		if ($rotate) {
1841
+			$image->rotate($orientation);
1842
+		}
1843 1843
         
1844
-        if (!empty($flip)) {
1845
-            $image->flip($flip[0], $flip[1]);
1846
-        }
1844
+		if (!empty($flip)) {
1845
+			$image->flip($flip[0], $flip[1]);
1846
+		}
1847 1847
         
1848
-        if ($quality !== null) {
1849
-            $image->set_quality((int)$quality);
1850
-        }
1848
+		if ($quality !== null) {
1849
+			$image->set_quality((int)$quality);
1850
+		}
1851 1851
         
1852
-       $result = $image->save($file_path);
1853
-       if (!is_wp_error($result)) {
1854
-           $file['file'] = $result['path'];
1855
-           $file['tmp_name'] = $result['path'];
1856
-       }
1857
-    }
1852
+	   $result = $image->save($file_path);
1853
+	   if (!is_wp_error($result)) {
1854
+		   $file['file'] = $result['path'];
1855
+		   $file['tmp_name'] = $result['path'];
1856
+	   }
1857
+	}
1858 1858
     
1859
-    // The image orientation is fixed, pass it back for further processing
1860
-    return $file;
1859
+	// The image orientation is fixed, pass it back for further processing
1860
+	return $file;
1861 1861
 }
1862 1862
 
1863 1863
 /**
@@ -1876,138 +1876,138 @@  discard block
 block discarded – undo
1876 1876
  * @return string Returns the recent reviews html.
1877 1877
  */
1878 1878
 function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1879
-    global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1880
-    $tablecomments = $wpdb->comments;
1881
-    $tableposts = $wpdb->posts;
1882
-
1883
-    $comments_echo = '';
1884
-    $city_filter = '';
1885
-    $region_filter = '';
1886
-    $country_filter = '';
1887
-
1888
-    if ($gd_session->get('gd_multi_location')) {
1889
-        if ($gd_ses_country = $gd_session->get('gd_country')) {
1890
-            $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1891
-        }
1879
+	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1880
+	$tablecomments = $wpdb->comments;
1881
+	$tableposts = $wpdb->posts;
1882
+
1883
+	$comments_echo = '';
1884
+	$city_filter = '';
1885
+	$region_filter = '';
1886
+	$country_filter = '';
1887
+
1888
+	if ($gd_session->get('gd_multi_location')) {
1889
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1890
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1891
+		}
1892 1892
 
1893
-        if ($gd_ses_region = $gd_session->get('gd_region')) {
1894
-            $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1895
-        }
1893
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1894
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1895
+		}
1896 1896
 
1897
-        if ($gd_ses_city = $gd_session->get('gd_city')) {
1898
-            $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1899
-        }
1900
-    }
1897
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1898
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1899
+		}
1900
+	}
1901 1901
 	
1902
-    $review_table = GEODIR_REVIEW_TABLE;
1903
-    $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1904
-
1905
-    $comments = $wpdb->get_results($request);
1906
-
1907
-    foreach ($comments as $comment) {
1908
-        // Set the extra comment info needed.
1909
-        $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1910
-        //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1911
-        $comment->comment_content = $comment_extra->comment_content;
1912
-        $comment->comment_author = $comment_extra->comment_author;
1913
-        $comment->comment_author_email = $comment_extra->comment_author_email;
1914
-
1915
-        $comment_id = '';
1916
-        $comment_id = $comment->comment_ID;
1917
-        $comment_content = strip_tags($comment->comment_content);
1918
-
1919
-        $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1920
-
1921
-        $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
1922
-        $comment_author_email = $comment->comment_author_email;
1923
-        $comment_post_ID = $comment->post_id;
1924
-
1925
-        $na = true;
1926
-        if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
1927
-            $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
1928
-            if ($comment_post_ID == $comment_post_ID2) {
1929
-            } else {
1930
-                $na = false;
1931
-            }
1932
-        }
1902
+	$review_table = GEODIR_REVIEW_TABLE;
1903
+	$request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1904
+
1905
+	$comments = $wpdb->get_results($request);
1906
+
1907
+	foreach ($comments as $comment) {
1908
+		// Set the extra comment info needed.
1909
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1910
+		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1911
+		$comment->comment_content = $comment_extra->comment_content;
1912
+		$comment->comment_author = $comment_extra->comment_author;
1913
+		$comment->comment_author_email = $comment_extra->comment_author_email;
1914
+
1915
+		$comment_id = '';
1916
+		$comment_id = $comment->comment_ID;
1917
+		$comment_content = strip_tags($comment->comment_content);
1918
+
1919
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1920
+
1921
+		$permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
1922
+		$comment_author_email = $comment->comment_author_email;
1923
+		$comment_post_ID = $comment->post_id;
1924
+
1925
+		$na = true;
1926
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
1927
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
1928
+			if ($comment_post_ID == $comment_post_ID2) {
1929
+			} else {
1930
+				$na = false;
1931
+			}
1932
+		}
1933 1933
 
1934
-        $post_title = get_the_title($comment_post_ID);
1935
-        $permalink = get_permalink($comment_post_ID);
1936
-        $comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
1937
-        $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
1934
+		$post_title = get_the_title($comment_post_ID);
1935
+		$permalink = get_permalink($comment_post_ID);
1936
+		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
1937
+		$read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
1938 1938
 
1939
-        $comment_content_length = strlen($comment_content);
1940
-        if ($comment_content_length > $comment_lenth) {
1941
-            $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
1942
-        } else {
1943
-            $comment_excerpt = $comment_content;
1944
-        }
1939
+		$comment_content_length = strlen($comment_content);
1940
+		if ($comment_content_length > $comment_lenth) {
1941
+			$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
1942
+		} else {
1943
+			$comment_excerpt = $comment_content;
1944
+		}
1945 1945
 
1946
-        if ($comment->user_id) {
1947
-            $user_profile_url = get_author_posts_url($comment->user_id);
1948
-        } else {
1949
-            $user_profile_url = '';
1950
-        }
1946
+		if ($comment->user_id) {
1947
+			$user_profile_url = get_author_posts_url($comment->user_id);
1948
+		} else {
1949
+			$user_profile_url = '';
1950
+		}
1951 1951
 
1952
-        if ($comment_id && $na) {
1953
-            $comments_echo .= '<li class="clearfix">';
1954
-            $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
1955
-            if (function_exists('get_avatar')) {
1956
-                if (!isset($comment->comment_type)) {
1957
-                    if ($user_profile_url) {
1958
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1959
-                    }
1960
-                    $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1961
-                    if ($user_profile_url) {
1962
-                        $comments_echo .= '</a>';
1963
-                    }
1964
-                } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
1965
-                    if ($user_profile_url) {
1966
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1967
-                    }
1968
-                    $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1969
-                }
1970
-            } elseif (function_exists('gravatar')) {
1971
-                if ($user_profile_url) {
1972
-                    $comments_echo .= '<a href="' . $user_profile_url . '">';
1973
-                }
1974
-                $comments_echo .= "<img src=\"";
1975
-                if ('' == $comment->comment_type) {
1976
-                    $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1977
-                    if ($user_profile_url) {
1978
-                        $comments_echo .= '</a>';
1979
-                    }
1980
-                } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
1981
-                    if ($user_profile_url) {
1982
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1983
-                    }
1984
-                    $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1985
-                    if ($user_profile_url) {
1986
-                        $comments_echo .= '</a>';
1987
-                    }
1988
-                }
1989
-                $comments_echo .= "\" alt=\"\" class=\"avatar\" />";
1990
-            }
1952
+		if ($comment_id && $na) {
1953
+			$comments_echo .= '<li class="clearfix">';
1954
+			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
1955
+			if (function_exists('get_avatar')) {
1956
+				if (!isset($comment->comment_type)) {
1957
+					if ($user_profile_url) {
1958
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1959
+					}
1960
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1961
+					if ($user_profile_url) {
1962
+						$comments_echo .= '</a>';
1963
+					}
1964
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
1965
+					if ($user_profile_url) {
1966
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1967
+					}
1968
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1969
+				}
1970
+			} elseif (function_exists('gravatar')) {
1971
+				if ($user_profile_url) {
1972
+					$comments_echo .= '<a href="' . $user_profile_url . '">';
1973
+				}
1974
+				$comments_echo .= "<img src=\"";
1975
+				if ('' == $comment->comment_type) {
1976
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1977
+					if ($user_profile_url) {
1978
+						$comments_echo .= '</a>';
1979
+					}
1980
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
1981
+					if ($user_profile_url) {
1982
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1983
+					}
1984
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1985
+					if ($user_profile_url) {
1986
+						$comments_echo .= '</a>';
1987
+					}
1988
+				}
1989
+				$comments_echo .= "\" alt=\"\" class=\"avatar\" />";
1990
+			}
1991 1991
 
1992
-            $comments_echo .= "</span>\n";
1993
-
1994
-            $comments_echo .= '<span class="geodir_reviewer_content">';
1995
-            if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1996
-            $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1997
-            if($comment->user_id){$comments_echo .= '</a>';}
1998
-            $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
1999
-            $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2000
-            $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2001
-            $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2002
-            //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2003
-            $comments_echo .= '</p>';
2004
-
2005
-            $comments_echo .= "</span>\n";
2006
-            $comments_echo .= '</li>';
2007
-        }
2008
-    }
1992
+			$comments_echo .= "</span>\n";
1993
+
1994
+			$comments_echo .= '<span class="geodir_reviewer_content">';
1995
+			if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1996
+			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1997
+			if($comment->user_id){$comments_echo .= '</a>';}
1998
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
1999
+			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2000
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2001
+			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2002
+			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2003
+			$comments_echo .= '</p>';
2004
+
2005
+			$comments_echo .= "</span>\n";
2006
+			$comments_echo .= '</li>';
2007
+		}
2008
+	}
2009 2009
 
2010
-    return $comments_echo;
2010
+	return $comments_echo;
2011 2011
 }
2012 2012
 
2013 2013
 /**
@@ -2019,29 +2019,29 @@  discard block
 block discarded – undo
2019 2019
  */
2020 2020
 function geodir_home_map_cats_key_value_array()
2021 2021
 {
2022
-    $post_types = geodir_get_posttypes('object');
2023
-
2024
-    $return = array();
2025
-    if (!empty($post_types)) {
2026
-        foreach ($post_types as $key => $post_type) {
2027
-            $cpt_name = __($post_type->labels->singular_name, 'geodirectory');
2028
-            $post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
2029
-            $taxonomies = geodir_get_taxonomies($key);
2030
-            $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
2031
-            $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
2032
-
2033
-            if (!empty($cat_terms)) {
2034
-                $return['optgroup_start-' . $key] = $post_type_name;
2035
-
2036
-                foreach ($cat_terms as $cat_term) {
2037
-                    $return[$key . '_' . $cat_term->term_id] = $cat_term->name;
2038
-                }
2022
+	$post_types = geodir_get_posttypes('object');
2039 2023
 
2040
-                $return['optgroup_end-' . $key] = $post_type_name;
2041
-            }
2042
-        }
2043
-    }
2044
-    return $return;
2024
+	$return = array();
2025
+	if (!empty($post_types)) {
2026
+		foreach ($post_types as $key => $post_type) {
2027
+			$cpt_name = __($post_type->labels->singular_name, 'geodirectory');
2028
+			$post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
2029
+			$taxonomies = geodir_get_taxonomies($key);
2030
+			$cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
2031
+			$cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
2032
+
2033
+			if (!empty($cat_terms)) {
2034
+				$return['optgroup_start-' . $key] = $post_type_name;
2035
+
2036
+				foreach ($cat_terms as $cat_term) {
2037
+					$return[$key . '_' . $cat_term->term_id] = $cat_term->name;
2038
+				}
2039
+
2040
+				$return['optgroup_end-' . $key] = $post_type_name;
2041
+			}
2042
+		}
2043
+	}
2044
+	return $return;
2045 2045
 }
2046 2046
 
2047 2047
 /**
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
  */
2054 2054
 function geodir_twitter_tweet_button()
2055 2055
 {
2056
-    ?>
2056
+	?>
2057 2057
     <a href="http://twitter.com/share"
2058 2058
        class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2059 2059
     <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
@@ -2070,11 +2070,11 @@  discard block
 block discarded – undo
2070 2070
  * @global object $post The current post object.
2071 2071
  */
2072 2072
 function geodir_fb_like_button() {
2073
-    global $post;
2074
-    ?>
2073
+	global $post;
2074
+	?>
2075 2075
     <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2076
-        echo 'allowtransparency="true"';
2077
-    } ?> class="facebook"
2076
+		echo 'allowtransparency="true"';
2077
+	} ?> class="facebook"
2078 2078
          src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2079 2079
          style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2080 2080
     <?php
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
  * @package GeoDirectory
2090 2090
  */
2091 2091
 function geodir_google_plus_button() {
2092
-    ?>
2092
+	?>
2093 2093
     <div id="plusone-div" class="g-plusone" data-size="medium"></div>
2094 2094
     <script type="text/javascript">
2095 2095
         (function () {
@@ -2114,8 +2114,8 @@  discard block
 block discarded – undo
2114 2114
  * @global object $post The current post object.
2115 2115
  */
2116 2116
 function geodir_share_this_button_code() {
2117
-    global $post;
2118
-    ?>
2117
+	global $post;
2118
+	?>
2119 2119
     <div class="addthis_toolbox addthis_default_style">
2120 2120
         <span id='st_sharethis'></span>
2121 2121
         <script type="text/javascript">var switchTo5x = false;</script>
@@ -2140,8 +2140,8 @@  discard block
 block discarded – undo
2140 2140
 }
2141 2141
 
2142 2142
 function geodir_listing_bounce_map_pin_on_hover() {
2143
-    if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
2144
-        ?>
2143
+	if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
2144
+		?>
2145 2145
         <script>
2146 2146
             jQuery(function ($) {
2147 2147
                 if (typeof(animate_marker) == 'function') {
@@ -2158,27 +2158,27 @@  discard block
 block discarded – undo
2158 2158
             });
2159 2159
         </script>
2160 2160
         <?php
2161
-    }
2161
+	}
2162 2162
 }
2163 2163
 add_action('geodir_after_listing_listview','geodir_listing_bounce_map_pin_on_hover',10);
2164 2164
 
2165 2165
 add_action('geodir_after_favorite_html','geodir_output_favourite_html_listings',1,1);
2166 2166
 function geodir_output_favourite_html_listings( $post_id){
2167
-    geodir_favourite_html('', $post_id);
2167
+	geodir_favourite_html('', $post_id);
2168 2168
 }
2169 2169
 
2170 2170
 add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2171 2171
 function geodir_output_pinpoint_html_listings( $post_id, $post){
2172
-    global $wp_query;
2172
+	global $wp_query;
2173 2173
 
2174
-    $show_pin_point = $wp_query->is_main_query();
2174
+	$show_pin_point = $wp_query->is_main_query();
2175 2175
     
2176
-    if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2177
-        $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2178
-        $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2179
-        ?>
2176
+	if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2177
+		$term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2178
+		$marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2179
+		?>
2180 2180
         <span class="geodir-pinpoint" style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2181 2181
         <a class="geodir-pinpoint-link" href="javascript:void(0)" onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2182 2182
         <?php
2183
-    }
2183
+	}
2184 2184
 }
2185 2185
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_shortcodes.php 1 patch
Indentation   +672 added lines, -672 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,43 +32,43 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-       // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
-    }
67
-    $output = ob_get_contents();
68
-
69
-    ob_end_clean();
70
-
71
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+	   // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
+	}
67
+	$output = ob_get_contents();
68
+
69
+	ob_end_clean();
70
+
71
+	return $output;
72 72
 }
73 73
 
74 74
 /**
@@ -96,136 +96,136 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function geodir_sc_home_map($atts)
98 98
 {
99
-    ob_start();
100
-    $defaults = array(
101
-        'width' => '960',
102
-        'height' => '425',
103
-        'maptype' => 'ROADMAP',
104
-        'zoom' => '13',
105
-        'autozoom' => '',
106
-        'child_collapse' => '0',
107
-        'scrollwheel' => '0',
99
+	ob_start();
100
+	$defaults = array(
101
+		'width' => '960',
102
+		'height' => '425',
103
+		'maptype' => 'ROADMAP',
104
+		'zoom' => '13',
105
+		'autozoom' => '',
106
+		'child_collapse' => '0',
107
+		'scrollwheel' => '0',
108 108
 		'marker_cluster' => false,
109
-        'latitude' => '',
110
-        'longitude' => ''
111
-    );
112
-
113
-    $params = shortcode_atts($defaults, $atts);
114
-
115
-    $params = gdsc_validate_map_args($params);
116
-
117
-    $map_args = array(
118
-        'map_canvas_name' => 'gd_home_map',
119
-        'latitude' => $params['latitude'],
120
-        'longitude' => $params['longitude'],
121
-
122
-        /**
123
-         * Filter the widget width of the map on home/listings page.
124
-         *
125
-         * @since 1.0.0
126
-         * @param mixed(string|int|float) $params['width'] The map width.
127
-         */
128
-        'width' => apply_filters('widget_width', $params['width']),
129
-        /**
130
-         * Filter the widget height of the map on home/listings page.
131
-         *
132
-         * @since 1.0.0
133
-         * @param mixed(string|int|float) $params['height'] The map height.
134
-         */
135
-        'height' => apply_filters('widget_heigh', $params['height']),
136
-        /**
137
-         * Filter the widget maptype of the map on home/listings page.
138
-         *
139
-         * @since 1.0.0
109
+		'latitude' => '',
110
+		'longitude' => ''
111
+	);
112
+
113
+	$params = shortcode_atts($defaults, $atts);
114
+
115
+	$params = gdsc_validate_map_args($params);
116
+
117
+	$map_args = array(
118
+		'map_canvas_name' => 'gd_home_map',
119
+		'latitude' => $params['latitude'],
120
+		'longitude' => $params['longitude'],
121
+
122
+		/**
123
+		 * Filter the widget width of the map on home/listings page.
124
+		 *
125
+		 * @since 1.0.0
126
+		 * @param mixed(string|int|float) $params['width'] The map width.
127
+		 */
128
+		'width' => apply_filters('widget_width', $params['width']),
129
+		/**
130
+		 * Filter the widget height of the map on home/listings page.
131
+		 *
132
+		 * @since 1.0.0
133
+		 * @param mixed(string|int|float) $params['height'] The map height.
134
+		 */
135
+		'height' => apply_filters('widget_heigh', $params['height']),
136
+		/**
137
+		 * Filter the widget maptype of the map on home/listings page.
138
+		 *
139
+		 * @since 1.0.0
140 140
 		 * @since 1.5.2 Added TERRAIN map type.
141
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
-         */
143
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
-        /**
145
-         * Filter the widget scrollwheel value of the map on home/listings page.
146
-         *
147
-         * Should the scrollwheel zoom the map or not.
148
-         *
149
-         * @since 1.0.0
150
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
-         */
152
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
-        /**
154
-         * Filter the widget zoom level of the map on home/listings page.
155
-         *
156
-         * @since 1.0.0
157
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
-         */
159
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
-        /**
161
-         * Filter the widget auto zoom value of the map on home/listings page.
162
-         *
163
-         * If the map should autozoom to fit the markers shown.
164
-         *
165
-         * @since 1.0.0
166
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
-         */
168
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
-        /**
170
-         * Filter the widget child_collapse value of the map on home/listings page.
171
-         *
172
-         * If the map should auto collapse the child categories if the category bar is present.
173
-         *
174
-         * @since 1.0.0
175
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
-         */
177
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
-        'enable_cat_filters' => true,
179
-        'enable_text_search' => true,
180
-        'enable_post_type_filters' => true,
181
-        /**
182
-         * Filter the widget enable_location_filters value of the map on home/listings page.
183
-         *
184
-         * This is used when the location addon is used.
185
-         *
186
-         * @since 1.0.0
187
-         * @param bool $val True if location filters should be used, false if not.
188
-         */
189
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
-        'enable_jason_on_load' => false,
191
-        'enable_marker_cluster' => false,
192
-        'enable_map_resize_button' => true,
193
-        'map_class_name' => 'geodir-map-home-page',
194
-        'is_geodir_home_map_widget' => true,
195
-    );
141
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
+		 */
143
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
+		/**
145
+		 * Filter the widget scrollwheel value of the map on home/listings page.
146
+		 *
147
+		 * Should the scrollwheel zoom the map or not.
148
+		 *
149
+		 * @since 1.0.0
150
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
+		 */
152
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
+		/**
154
+		 * Filter the widget zoom level of the map on home/listings page.
155
+		 *
156
+		 * @since 1.0.0
157
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
+		 */
159
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
+		/**
161
+		 * Filter the widget auto zoom value of the map on home/listings page.
162
+		 *
163
+		 * If the map should autozoom to fit the markers shown.
164
+		 *
165
+		 * @since 1.0.0
166
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
+		 */
168
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
+		/**
170
+		 * Filter the widget child_collapse value of the map on home/listings page.
171
+		 *
172
+		 * If the map should auto collapse the child categories if the category bar is present.
173
+		 *
174
+		 * @since 1.0.0
175
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
+		 */
177
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
+		'enable_cat_filters' => true,
179
+		'enable_text_search' => true,
180
+		'enable_post_type_filters' => true,
181
+		/**
182
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
183
+		 *
184
+		 * This is used when the location addon is used.
185
+		 *
186
+		 * @since 1.0.0
187
+		 * @param bool $val True if location filters should be used, false if not.
188
+		 */
189
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
+		'enable_jason_on_load' => false,
191
+		'enable_marker_cluster' => false,
192
+		'enable_map_resize_button' => true,
193
+		'map_class_name' => 'geodir-map-home-page',
194
+		'is_geodir_home_map_widget' => true,
195
+	);
196 196
 
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199
-        $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
201
-            if ($map_args['autozoom']) {
202
-                $map_args['enable_marker_cluster_no_reposition'] = false;
203
-            } else {
204
-                $map_args['enable_marker_cluster_no_reposition'] = true;
205
-            }
199
+		$map_args['enable_marker_cluster'] = true;
200
+		if(get_option('geodir_marker_cluster_type')) {
201
+			if ($map_args['autozoom']) {
202
+				$map_args['enable_marker_cluster_no_reposition'] = false;
203
+			} else {
204
+				$map_args['enable_marker_cluster_no_reposition'] = true;
205
+			}
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+			$map_args['enable_marker_cluster_server'] = true ;
208 208
 
209
-        }
209
+		}
210 210
 	} else {
211 211
 		$map_args['enable_marker_cluster'] = false;
212 212
 	}
213 213
 
214
-    // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
-        $map_args['enable_marker_cluster_no_reposition'] = true;
217
-    }
214
+	// if lat and long set in shortcode, hack it so the map is not repositioned
215
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
+		$map_args['enable_marker_cluster_no_reposition'] = true;
217
+	}
218 218
 
219 219
 
220
-    geodir_draw_map($map_args);
220
+	geodir_draw_map($map_args);
221 221
 
222
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
222
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
223 223
 
224
-    $output = ob_get_contents();
224
+	$output = ob_get_contents();
225 225
 
226
-    ob_end_clean();
226
+	ob_end_clean();
227 227
 
228
-    return $output;
228
+	return $output;
229 229
 }
230 230
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
231 231
 
@@ -259,77 +259,77 @@  discard block
 block discarded – undo
259 259
  */
260 260
 function geodir_sc_listing_map($atts)
261 261
 {
262
-    ob_start();
263
-    add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
264
-
265
-    add_action('the_post', 'create_list_jsondata'); // Add marker in json array
266
-
267
-    add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
268
-
269
-    $defaults = array(
270
-        'width' => '294',
271
-        'height' => '370',
272
-        'zoom' => '13',
273
-        'autozoom' => '',
274
-        'sticky' => '',
275
-        'showall' => '0',
276
-        'scrollwheel' => '0',
277
-        'maptype' => 'ROADMAP',
278
-        'child_collapse' => 0,
262
+	ob_start();
263
+	add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
264
+
265
+	add_action('the_post', 'create_list_jsondata'); // Add marker in json array
266
+
267
+	add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
268
+
269
+	$defaults = array(
270
+		'width' => '294',
271
+		'height' => '370',
272
+		'zoom' => '13',
273
+		'autozoom' => '',
274
+		'sticky' => '',
275
+		'showall' => '0',
276
+		'scrollwheel' => '0',
277
+		'maptype' => 'ROADMAP',
278
+		'child_collapse' => 0,
279 279
 		'marker_cluster' => false
280
-    );
281
-
282
-    $params = shortcode_atts($defaults, $atts);
283
-
284
-    $params = gdsc_validate_map_args($params);
285
-
286
-    $map_args = array(
287
-        'map_canvas_name' => 'gd_listing_map',
288
-        'width' => $params['width'],
289
-        'height' => $params['height'],
290
-        'zoom' => $params['zoom'],
291
-        'autozoom' => $params['autozoom'],
292
-        'sticky' => $params['sticky'],
293
-        'showall' => $params['showall'],
294
-        'scrollwheel' => $params['scrollwheel'],
295
-        'child_collapse' => 0,
296
-        'enable_cat_filters' => false,
297
-        'enable_text_search' => false,
298
-        'enable_post_type_filters' => false,
299
-        'enable_location_filters' => false,
300
-        'enable_jason_on_load' => true,
301
-    );
302
-
303
-    if (is_single()) {
304
-
305
-        global $post;
306
-        $map_default_lat = $address_latitude = $post->post_latitude;
307
-        $map_default_lng = $address_longitude = $post->post_longitude;
308
-        $mapview = $post->post_mapview;
309
-        $map_args['zoom'] = $post->post_mapzoom;
310
-        $map_args['map_class_name'] = 'geodir-map-listing-page-single';
311
-
312
-    } else {
313
-        $default_location = geodir_get_default_location();
314
-
315
-        $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
316
-        $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
317
-        $map_args['map_class_name'] = 'geodir-map-listing-page';
318
-    }
319
-
320
-    if (empty($mapview)) {
321
-        $mapview = 'ROADMAP';
322
-    }
323
-
324
-    // Set default map options
325
-    $map_args['ajax_url'] = geodir_get_ajax_url();
326
-    $map_args['latitude'] = $map_default_lat;
327
-    $map_args['longitude'] = $map_default_lng;
328
-    $map_args['streetViewControl'] = true;
329
-    $map_args['maptype'] = $mapview;
330
-    $map_args['showPreview'] = '0';
331
-    $map_args['maxZoom'] = 21;
332
-    $map_args['bubble_size'] = 'small';
280
+	);
281
+
282
+	$params = shortcode_atts($defaults, $atts);
283
+
284
+	$params = gdsc_validate_map_args($params);
285
+
286
+	$map_args = array(
287
+		'map_canvas_name' => 'gd_listing_map',
288
+		'width' => $params['width'],
289
+		'height' => $params['height'],
290
+		'zoom' => $params['zoom'],
291
+		'autozoom' => $params['autozoom'],
292
+		'sticky' => $params['sticky'],
293
+		'showall' => $params['showall'],
294
+		'scrollwheel' => $params['scrollwheel'],
295
+		'child_collapse' => 0,
296
+		'enable_cat_filters' => false,
297
+		'enable_text_search' => false,
298
+		'enable_post_type_filters' => false,
299
+		'enable_location_filters' => false,
300
+		'enable_jason_on_load' => true,
301
+	);
302
+
303
+	if (is_single()) {
304
+
305
+		global $post;
306
+		$map_default_lat = $address_latitude = $post->post_latitude;
307
+		$map_default_lng = $address_longitude = $post->post_longitude;
308
+		$mapview = $post->post_mapview;
309
+		$map_args['zoom'] = $post->post_mapzoom;
310
+		$map_args['map_class_name'] = 'geodir-map-listing-page-single';
311
+
312
+	} else {
313
+		$default_location = geodir_get_default_location();
314
+
315
+		$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
316
+		$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
317
+		$map_args['map_class_name'] = 'geodir-map-listing-page';
318
+	}
319
+
320
+	if (empty($mapview)) {
321
+		$mapview = 'ROADMAP';
322
+	}
323
+
324
+	// Set default map options
325
+	$map_args['ajax_url'] = geodir_get_ajax_url();
326
+	$map_args['latitude'] = $map_default_lat;
327
+	$map_args['longitude'] = $map_default_lng;
328
+	$map_args['streetViewControl'] = true;
329
+	$map_args['maptype'] = $mapview;
330
+	$map_args['showPreview'] = '0';
331
+	$map_args['maxZoom'] = 21;
332
+	$map_args['bubble_size'] = 'small';
333 333
 	
334 334
 	// Add marker cluster
335 335
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 		$map_args['enable_marker_cluster'] = false;
339 339
 	}
340 340
 
341
-    geodir_draw_map($map_args);
341
+	geodir_draw_map($map_args);
342 342
 
343
-    $output = ob_get_contents();
343
+	$output = ob_get_contents();
344 344
 
345
-    ob_end_clean();
345
+	ob_end_clean();
346 346
 
347
-    return $output;
347
+	return $output;
348 348
 }
349 349
 
350 350
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -377,120 +377,120 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function geodir_sc_listing_slider($atts)
379 379
 {
380
-    ob_start();
381
-    $defaults = array(
382
-        'post_type' => 'gd_place',
383
-        'category' => '0',
384
-        'post_number' => '5',
385
-        'slideshow' => '0',
386
-        'animation_loop' => 0,
387
-        'direction_nav' => 0,
388
-        'slideshow_speed' => 5000,
389
-        'animation_speed' => 600,
390
-        'animation' => 'slide',
391
-        'order_by' => 'latest',
392
-        'show_title' => '',
393
-        'show_featured_only' => '',
394
-        'title' => '',
395
-    );
396
-
397
-    $params = shortcode_atts($defaults, $atts);
398
-
399
-
400
-    /*
380
+	ob_start();
381
+	$defaults = array(
382
+		'post_type' => 'gd_place',
383
+		'category' => '0',
384
+		'post_number' => '5',
385
+		'slideshow' => '0',
386
+		'animation_loop' => 0,
387
+		'direction_nav' => 0,
388
+		'slideshow_speed' => 5000,
389
+		'animation_speed' => 600,
390
+		'animation' => 'slide',
391
+		'order_by' => 'latest',
392
+		'show_title' => '',
393
+		'show_featured_only' => '',
394
+		'title' => '',
395
+	);
396
+
397
+	$params = shortcode_atts($defaults, $atts);
398
+
399
+
400
+	/*
401 401
      *
402 402
      * Now we begin the validation of the attributes.
403 403
      */
404
-    // Check we have a valid post_type
405
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
406
-        $params['post_type'] = 'gd_place';
407
-    }
408
-
409
-    // Check we have a valid sort_order
410
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
411
-
412
-    // Match the chosen animation to our options
413
-    $animation_list = array('slide', 'fade');
414
-    if (!(in_array($params['animation'], $animation_list))) {
415
-        $params['animation'] = 'slide';
416
-    }
417
-
418
-    // Post_number needs to be a positive integer
419
-    $params['post_number'] = absint($params['post_number']);
420
-    if (0 == $params['post_number']) {
421
-        $params['post_number'] = 1;
422
-    }
423
-
424
-    // Manage the entered categories
425
-    if (0 != $params['category'] || '' != $params['category']) {
426
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
427
-    }
428
-    // Convert show_title to a bool
429
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
430
-
431
-    // Convert show_featured_only to a bool
432
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
433
-
434
-    /*
404
+	// Check we have a valid post_type
405
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
406
+		$params['post_type'] = 'gd_place';
407
+	}
408
+
409
+	// Check we have a valid sort_order
410
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
411
+
412
+	// Match the chosen animation to our options
413
+	$animation_list = array('slide', 'fade');
414
+	if (!(in_array($params['animation'], $animation_list))) {
415
+		$params['animation'] = 'slide';
416
+	}
417
+
418
+	// Post_number needs to be a positive integer
419
+	$params['post_number'] = absint($params['post_number']);
420
+	if (0 == $params['post_number']) {
421
+		$params['post_number'] = 1;
422
+	}
423
+
424
+	// Manage the entered categories
425
+	if (0 != $params['category'] || '' != $params['category']) {
426
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
427
+	}
428
+	// Convert show_title to a bool
429
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
430
+
431
+	// Convert show_featured_only to a bool
432
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
433
+
434
+	/*
435 435
      * Hopefully all attributes are now valid, and safe to pass forward
436 436
      */
437 437
 
438
-    // redeclare vars after validation
439
-
440
-    if (isset($params['direction_nav'])) {
441
-        $params['directionNav'] = $params['direction_nav'];
442
-    }
443
-    if (isset($params['animation_loop'])) {
444
-        $params['animationLoop'] = $params['animation_loop'];
445
-    }
446
-    if (isset($params['slideshow_speed'])) {
447
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
448
-    }
449
-    if (isset($params['animation_speed'])) {
450
-        $params['animationSpeed'] = $params['animation_speed'];
451
-    }
452
-    if (isset($params['order_by'])) {
453
-        $params['list_sort'] = $params['order_by'];
454
-    }
455
-
456
-    $query_args = array(
457
-        'post_number' => $params['post_number'],
458
-        'is_geodir_loop' => true,
459
-        'post_type' => $params['post_type'],
460
-        'order_by' => $params['order_by']
461
-    );
462
-
463
-    if (1 == $params['show_featured_only']) {
464
-        $query_args['show_featured_only'] = 1;
465
-    }
466
-
467
-    if (0 != $params['category'] && '' != $params['category']) {
468
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
469
-        $tax_query = array(
470
-            'taxonomy' => $category_taxonomy[0],
471
-            'field' => 'id',
472
-            'terms' => $params['category'],
473
-        );
474
-
475
-        $query_args['tax_query'] = array($tax_query);
476
-    }
477
-
478
-    $defaults = array(
479
-        'before_widget' => '',
480
-        'after_widget' => '',
481
-        'before_title' => '',
482
-        'after_title' => '',
483
-    );
484
-
485
-    $query_args = array_merge($query_args, $params);
486
-
487
-    geodir_listing_slider_widget_output($defaults, $query_args);
488
-
489
-    $output = ob_get_contents();
490
-
491
-    ob_end_clean();
492
-
493
-    return $output;
438
+	// redeclare vars after validation
439
+
440
+	if (isset($params['direction_nav'])) {
441
+		$params['directionNav'] = $params['direction_nav'];
442
+	}
443
+	if (isset($params['animation_loop'])) {
444
+		$params['animationLoop'] = $params['animation_loop'];
445
+	}
446
+	if (isset($params['slideshow_speed'])) {
447
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
448
+	}
449
+	if (isset($params['animation_speed'])) {
450
+		$params['animationSpeed'] = $params['animation_speed'];
451
+	}
452
+	if (isset($params['order_by'])) {
453
+		$params['list_sort'] = $params['order_by'];
454
+	}
455
+
456
+	$query_args = array(
457
+		'post_number' => $params['post_number'],
458
+		'is_geodir_loop' => true,
459
+		'post_type' => $params['post_type'],
460
+		'order_by' => $params['order_by']
461
+	);
462
+
463
+	if (1 == $params['show_featured_only']) {
464
+		$query_args['show_featured_only'] = 1;
465
+	}
466
+
467
+	if (0 != $params['category'] && '' != $params['category']) {
468
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
469
+		$tax_query = array(
470
+			'taxonomy' => $category_taxonomy[0],
471
+			'field' => 'id',
472
+			'terms' => $params['category'],
473
+		);
474
+
475
+		$query_args['tax_query'] = array($tax_query);
476
+	}
477
+
478
+	$defaults = array(
479
+		'before_widget' => '',
480
+		'after_widget' => '',
481
+		'before_title' => '',
482
+		'after_title' => '',
483
+	);
484
+
485
+	$query_args = array_merge($query_args, $params);
486
+
487
+	geodir_listing_slider_widget_output($defaults, $query_args);
488
+
489
+	$output = ob_get_contents();
490
+
491
+	ob_end_clean();
492
+
493
+	return $output;
494 494
 }
495 495
 
496 496
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -514,22 +514,22 @@  discard block
 block discarded – undo
514 514
  */
515 515
 function geodir_sc_login_box($atts)
516 516
 {
517
-    ob_start();
517
+	ob_start();
518 518
 
519
-    $defaults = array(
520
-        'before_widget' => '',
521
-        'after_widget' => '',
522
-        'before_title' => '',
523
-        'after_title' => '',
524
-    );
519
+	$defaults = array(
520
+		'before_widget' => '',
521
+		'after_widget' => '',
522
+		'before_title' => '',
523
+		'after_title' => '',
524
+	);
525 525
 
526
-    geodir_loginwidget_output($defaults, $defaults);
526
+	geodir_loginwidget_output($defaults, $defaults);
527 527
 
528
-    $output = ob_get_contents();
528
+	$output = ob_get_contents();
529 529
 
530
-    ob_end_clean();
530
+	ob_end_clean();
531 531
 
532
-    return $output;
532
+	return $output;
533 533
 }
534 534
 
535 535
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -558,28 +558,28 @@  discard block
 block discarded – undo
558 558
  */
559 559
 function geodir_sc_popular_post_category($atts)
560 560
 {
561
-    ob_start();
562
-    global $geodir_post_category_str;
563
-    $defaults = array(
564
-        'category_limit' => 15,
565
-        'before_widget' => '',
566
-        'after_widget' => '',
567
-        'before_title' => '',
568
-        'after_title' => '',
569
-        'title' => '',
561
+	ob_start();
562
+	global $geodir_post_category_str;
563
+	$defaults = array(
564
+		'category_limit' => 15,
565
+		'before_widget' => '',
566
+		'after_widget' => '',
567
+		'before_title' => '',
568
+		'after_title' => '',
569
+		'title' => '',
570 570
 		'default_post_type' => '',
571
-    );
571
+	);
572 572
 
573
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
574
-    $params['category_limit'] = absint($params['category_limit']);
573
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
574
+	$params['category_limit'] = absint($params['category_limit']);
575 575
 	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
576
-    geodir_popular_post_category_output($params, $params);
576
+	geodir_popular_post_category_output($params, $params);
577 577
 
578
-    $output = ob_get_contents();
578
+	$output = ob_get_contents();
579 579
 
580
-    ob_end_clean();
580
+	ob_end_clean();
581 581
 
582
-    return $output;
582
+	return $output;
583 583
 }
584 584
 
585 585
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -619,97 +619,97 @@  discard block
 block discarded – undo
619 619
  */
620 620
 function geodir_sc_popular_post_view($atts)
621 621
 {
622
-    ob_start();
623
-    $defaults = array(
624
-        'post_type' => 'gd_place',
625
-        'category' => '0',
626
-        'post_number' => '5',
627
-        'layout' => 'gridview_onehalf',
628
-        'add_location_filter' => '0',
629
-        'list_sort' => 'latest',
630
-        'use_viewing_post_type' => '1',
631
-        'character_count' => '20',
632
-        'listing_width' => '',
633
-        'show_featured_only' => '0',
634
-        'show_special_only' => '0',
635
-        'with_pics_only' => '0',
636
-        'with_videos_only' => '0',
637
-        'before_widget' => '',
638
-        'after_widget' => '',
639
-        'before_title' => '<h3 class="widget-title">',
640
-        'after_title' => '</h3>',
641
-        'title' => '',
642
-        'category_title' => '',
643
-    );
644
-
645
-    $params = shortcode_atts($defaults, $atts);
646
-
647
-    /**
648
-     * Validate our incoming params
649
-     */
622
+	ob_start();
623
+	$defaults = array(
624
+		'post_type' => 'gd_place',
625
+		'category' => '0',
626
+		'post_number' => '5',
627
+		'layout' => 'gridview_onehalf',
628
+		'add_location_filter' => '0',
629
+		'list_sort' => 'latest',
630
+		'use_viewing_post_type' => '1',
631
+		'character_count' => '20',
632
+		'listing_width' => '',
633
+		'show_featured_only' => '0',
634
+		'show_special_only' => '0',
635
+		'with_pics_only' => '0',
636
+		'with_videos_only' => '0',
637
+		'before_widget' => '',
638
+		'after_widget' => '',
639
+		'before_title' => '<h3 class="widget-title">',
640
+		'after_title' => '</h3>',
641
+		'title' => '',
642
+		'category_title' => '',
643
+	);
650 644
 
651
-    // Validate the selected post type, default to gd_place on fail
652
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
653
-        $params['post_type'] = 'gd_place';
654
-    }
655
-
656
-    // Validate the selected category/ies - Grab the current list based on post_type
657
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
658
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
659
-
660
-    // Make sure we have an array
661
-    if (!(is_array($params['category']))) {
662
-        $params['category'] = explode(',', $params['category']);
663
-    }
664
-
665
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
666
-    // Otherwise it becomes empty and later on that will mean "All"
667
-    $params['category'] = array_intersect($params['category'], $categories);
668
-
669
-    // Post_number needs to be a positive integer
670
-    $params['post_number'] = absint($params['post_number']);
671
-    if (0 == $params['post_number']) {
672
-        $params['post_number'] = 1;
673
-    }
674
-
675
-    // Validate our layout choice
676
-    // Outside of the norm, I added some more simple terms to match the existing
677
-    // So now I just run the switch to set it properly.
678
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
679
-
680
-    // Validate our sorting choice
681
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
682
-
683
-    // Validate character_count
684
-    $params['character_count'] = absint($params['character_count']);
685
-    if (20 > $params['character_count']) {
686
-        $params['character_count'] = 20;
687
-    }
688
-
689
-    // Validate Listing width, used in the template widget-listing-listview.php
690
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
691
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
692
-
693
-    // Validate the checkboxes used on the widget
694
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
695
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
696
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
697
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
698
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
699
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
700
-
701
-    /**
702
-     * End of validation
703
-     */
645
+	$params = shortcode_atts($defaults, $atts);
646
+
647
+	/**
648
+	 * Validate our incoming params
649
+	 */
650
+
651
+	// Validate the selected post type, default to gd_place on fail
652
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
653
+		$params['post_type'] = 'gd_place';
654
+	}
655
+
656
+	// Validate the selected category/ies - Grab the current list based on post_type
657
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
658
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
659
+
660
+	// Make sure we have an array
661
+	if (!(is_array($params['category']))) {
662
+		$params['category'] = explode(',', $params['category']);
663
+	}
664
+
665
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
666
+	// Otherwise it becomes empty and later on that will mean "All"
667
+	$params['category'] = array_intersect($params['category'], $categories);
668
+
669
+	// Post_number needs to be a positive integer
670
+	$params['post_number'] = absint($params['post_number']);
671
+	if (0 == $params['post_number']) {
672
+		$params['post_number'] = 1;
673
+	}
704 674
 
705
-    geodir_popular_postview_output($params, $params);
675
+	// Validate our layout choice
676
+	// Outside of the norm, I added some more simple terms to match the existing
677
+	// So now I just run the switch to set it properly.
678
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
706 679
 
680
+	// Validate our sorting choice
681
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
707 682
 
708
-    $output = ob_get_contents();
683
+	// Validate character_count
684
+	$params['character_count'] = absint($params['character_count']);
685
+	if (20 > $params['character_count']) {
686
+		$params['character_count'] = 20;
687
+	}
688
+
689
+	// Validate Listing width, used in the template widget-listing-listview.php
690
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
691
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
692
+
693
+	// Validate the checkboxes used on the widget
694
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
695
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
696
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
697
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
698
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
699
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
700
+
701
+	/**
702
+	 * End of validation
703
+	 */
709 704
 
710
-    ob_end_clean();
705
+	geodir_popular_postview_output($params, $params);
711 706
 
712
-    return $output;
707
+
708
+	$output = ob_get_contents();
709
+
710
+	ob_end_clean();
711
+
712
+	return $output;
713 713
 }
714 714
 
715 715
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -731,37 +731,37 @@  discard block
 block discarded – undo
731 731
  * @return string Recent reviews HTML.
732 732
  */
733 733
 function geodir_sc_recent_reviews($atts) {
734
-    ob_start();
735
-    $defaults = array(
734
+	ob_start();
735
+	$defaults = array(
736 736
 		'title' => '',
737 737
 		'count' => 5,
738
-    );
738
+	);
739 739
 
740
-    $params = shortcode_atts($defaults, $atts);
740
+	$params = shortcode_atts($defaults, $atts);
741 741
 
742
-    $count = absint($params['count']);
743
-    if (0 == $count) {
744
-        $count = 1;
745
-    }
742
+	$count = absint($params['count']);
743
+	if (0 == $count) {
744
+		$count = 1;
745
+	}
746 746
 	
747 747
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
748 748
 
749
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
749
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
750 750
 
751
-    if ($comments_li) {
752
-        if ($title != '') { ?>
751
+	if ($comments_li) {
752
+		if ($title != '') { ?>
753 753
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
754 754
 		<?php } ?>
755 755
         <div class="geodir_sc_recent_reviews_section">
756 756
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
757 757
         </div>
758 758
     <?php
759
-    }
760
-    $output = ob_get_contents();
759
+	}
760
+	$output = ob_get_contents();
761 761
 
762
-    ob_end_clean();
762
+	ob_end_clean();
763 763
 
764
-    return $output;
764
+	return $output;
765 765
 }
766 766
 
767 767
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -791,64 +791,64 @@  discard block
 block discarded – undo
791 791
  */
792 792
 function geodir_sc_related_listings($atts)
793 793
 {
794
-    ob_start();
795
-    $defaults = array(
796
-        'post_number' => 5,
797
-        'relate_to' => 'category',
798
-        'layout' => 'gridview_onehalf',
799
-        'add_location_filter' => 0,
800
-        'listing_width' => '',
801
-        'list_sort' => 'latest',
802
-        'character_count' => 20,
803
-        'is_widget' => 1,
804
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
805
-    );
806
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
807
-
808
-    $params = shortcode_atts($defaults, $atts);
809
-
810
-    /**
811
-     * Begin validating parameters
812
-     */
794
+	ob_start();
795
+	$defaults = array(
796
+		'post_number' => 5,
797
+		'relate_to' => 'category',
798
+		'layout' => 'gridview_onehalf',
799
+		'add_location_filter' => 0,
800
+		'listing_width' => '',
801
+		'list_sort' => 'latest',
802
+		'character_count' => 20,
803
+		'is_widget' => 1,
804
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
805
+	);
806
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
807
+
808
+	$params = shortcode_atts($defaults, $atts);
809
+
810
+	/**
811
+	 * Begin validating parameters
812
+	 */
813 813
 
814
-    // Validate that post_number is a number and is 1 or higher
815
-    $params['post_number'] = absint($params['post_number']);
816
-    if (0 === $params['post_number']) {
817
-        $params['post_number'] = 1;
818
-    }
814
+	// Validate that post_number is a number and is 1 or higher
815
+	$params['post_number'] = absint($params['post_number']);
816
+	if (0 === $params['post_number']) {
817
+		$params['post_number'] = 1;
818
+	}
819 819
 
820
-    // Validate relate_to - only category or tags
821
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
822
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
823
-        $params['relate_to'] = 'category';
824
-    }
820
+	// Validate relate_to - only category or tags
821
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
822
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
823
+		$params['relate_to'] = 'category';
824
+	}
825 825
 
826
-    // Validate layout selection
827
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
826
+	// Validate layout selection
827
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
828 828
 
829
-    // Validate sorting option
830
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
829
+	// Validate sorting option
830
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
831 831
 
832
-    // Validate add_location_filter
833
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
832
+	// Validate add_location_filter
833
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
834 834
 
835
-    // Validate listing_width
836
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
835
+	// Validate listing_width
836
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
837 837
 
838
-    // Validate character_count
839
-    $params['character_count'] = absint($params['character_count']);
840
-    if (20 > $params['character_count']) {
841
-        $params['character_count'] = 20;
842
-    }
838
+	// Validate character_count
839
+	$params['character_count'] = absint($params['character_count']);
840
+	if (20 > $params['character_count']) {
841
+		$params['character_count'] = 20;
842
+	}
843 843
 
844
-    if ($related_display = geodir_related_posts_display($params)) {
845
-        echo $related_display;
846
-    }
847
-    $output = ob_get_contents();
844
+	if ($related_display = geodir_related_posts_display($params)) {
845
+		echo $related_display;
846
+	}
847
+	$output = ob_get_contents();
848 848
 
849
-    ob_end_clean();
849
+	ob_end_clean();
850 850
 
851
-    return $output;
851
+	return $output;
852 852
 }
853 853
 
854 854
 /**
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
  * @return string Advanced search widget HTML.
873 873
  */
874 874
 function geodir_sc_advanced_search($atts) {
875
-    $defaults = array(
875
+	$defaults = array(
876 876
 		'title' => '',
877 877
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">',
878
-        'after_widget' => '</section>',
879
-        'before_title' => '<h3 class="widget-title">',
880
-        'after_title' => '</h3>',
878
+		'after_widget' => '</section>',
879
+		'before_title' => '<h3 class="widget-title">',
880
+		'after_title' => '</h3>',
881 881
 		'show_adv_search' => 'default'
882 882
 	);
883 883
 	
@@ -901,9 +901,9 @@  discard block
 block discarded – undo
901 901
 	the_widget('geodir_advance_search_widget', $params, $params );
902 902
 	
903 903
 	$output = ob_get_contents();
904
-    ob_end_clean();
904
+	ob_end_clean();
905 905
 
906
-    return $output;
906
+	return $output;
907 907
 }
908 908
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
909 909
 
@@ -949,48 +949,48 @@  discard block
 block discarded – undo
949 949
 		'add_location_filter' => '1',
950 950
 		'tab_layout' => 'bestof-tabs-on-top',
951 951
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
952
-        'after_widget' => '</section>',
953
-        'before_title' => '<h3 class="widget-title">',
954
-        'after_title' => '</h3>',
952
+		'after_widget' => '</section>',
953
+		'before_title' => '<h3 class="widget-title">',
954
+		'after_title' => '</h3>',
955 955
 	);
956 956
 	$params = shortcode_atts($defaults, $atts);
957 957
 
958
-    /**
959
-     * Validate our incoming params
960
-     */
958
+	/**
959
+	 * Validate our incoming params
960
+	 */
961 961
 
962
-    // Validate the selected post type, default to gd_place on fail
963
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
964
-        $params['post_type'] = 'gd_place';
965
-    }
962
+	// Validate the selected post type, default to gd_place on fail
963
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
964
+		$params['post_type'] = 'gd_place';
965
+	}
966 966
 	
967 967
 	// Post limit needs to be a positive integer
968
-    $params['post_limit'] = absint($params['post_limit']);
969
-    if (0 == $params['post_limit']) {
970
-        $params['post_limit'] = 5;
971
-    }
968
+	$params['post_limit'] = absint($params['post_limit']);
969
+	if (0 == $params['post_limit']) {
970
+		$params['post_limit'] = 5;
971
+	}
972 972
 	
973 973
 	// Category limit needs to be a positive integer
974
-    $params['categ_limit'] = absint($params['categ_limit']);
975
-    if (0 == $params['categ_limit']) {
976
-        $params['categ_limit'] = 3;
977
-    }
974
+	$params['categ_limit'] = absint($params['categ_limit']);
975
+	if (0 == $params['categ_limit']) {
976
+		$params['categ_limit'] = 3;
977
+	}
978 978
 	
979 979
 	// Tab layout validation
980
-    $params['tab_layout'] = $params['tab_layout'];
981
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
982
-        $params['tab_layout'] = 'bestof-tabs-on-top';
983
-    }
980
+	$params['tab_layout'] = $params['tab_layout'];
981
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
982
+		$params['tab_layout'] = 'bestof-tabs-on-top';
983
+	}
984 984
 	
985 985
 	// Validate character_count
986
-    $params['character_count'] = $params['character_count'];
986
+	$params['character_count'] = $params['character_count'];
987 987
 
988 988
 	ob_start();
989 989
 	the_widget('geodir_bestof_widget', $params, $params);
990
-    $output = ob_get_contents();
991
-    ob_end_clean();
990
+	$output = ob_get_contents();
991
+	ob_end_clean();
992 992
 
993
-    return $output;
993
+	return $output;
994 994
 }
995 995
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
996 996
 
@@ -1038,127 +1038,127 @@  discard block
 block discarded – undo
1038 1038
  * @return string HTML content to display geodirectory listings.
1039 1039
  */
1040 1040
 function geodir_sc_gd_listings($atts, $content = '') {
1041
-    global $post;
1042
-    $defaults = array(
1043
-        'title'                 => '',
1044
-        'post_type'             => 'gd_place',
1045
-        'category'              => 0,
1046
-        'list_sort'             => 'latest',
1047
-        'event_type'            => '',
1048
-        'post_number'           => 10,
1049
-        'post_author'           => '',
1050
-        'layout'                => 'gridview_onehalf',
1051
-        'listing_width'         => '',
1052
-        'character_count'       => 20,
1053
-        'add_location_filter'   => 1,
1054
-        'show_featured_only'    => '',
1055
-        'show_special_only'     => '',
1056
-        'with_pics_only'        => '',
1057
-        'with_videos_only'      => '',
1058
-        'with_pagination'       => '1',
1059
-        'top_pagination'        => '0',
1060
-        'bottom_pagination'     => '1',
1061
-        'without_no_results'    => 0,
1062
-        'tags'                  => ''
1063
-    );
1064
-    $params = shortcode_atts($defaults, $atts);
1065
-
1066
-    $params['title']        = wp_strip_all_tags($params['title']);
1067
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1068
-
1069
-    // Validate the selected category/ies - Grab the current list based on post_type
1070
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1071
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1072
-
1073
-    // Make sure we have an array
1074
-    if (!(is_array($params['category']))) {
1075
-        $params['category'] = explode(',', $params['category']);
1076
-    }
1077
-
1078
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1079
-    // Otherwise it becomes empty and later on that will mean "All"
1080
-    $params['category']     = array_intersect($params['category'], $categories);
1081
-
1082
-    // Post_number needs to be a positive integer
1083
-    $params['post_number']  = absint($params['post_number']);
1084
-    $params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1041
+	global $post;
1042
+	$defaults = array(
1043
+		'title'                 => '',
1044
+		'post_type'             => 'gd_place',
1045
+		'category'              => 0,
1046
+		'list_sort'             => 'latest',
1047
+		'event_type'            => '',
1048
+		'post_number'           => 10,
1049
+		'post_author'           => '',
1050
+		'layout'                => 'gridview_onehalf',
1051
+		'listing_width'         => '',
1052
+		'character_count'       => 20,
1053
+		'add_location_filter'   => 1,
1054
+		'show_featured_only'    => '',
1055
+		'show_special_only'     => '',
1056
+		'with_pics_only'        => '',
1057
+		'with_videos_only'      => '',
1058
+		'with_pagination'       => '1',
1059
+		'top_pagination'        => '0',
1060
+		'bottom_pagination'     => '1',
1061
+		'without_no_results'    => 0,
1062
+		'tags'                  => ''
1063
+	);
1064
+	$params = shortcode_atts($defaults, $atts);
1065
+
1066
+	$params['title']        = wp_strip_all_tags($params['title']);
1067
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1068
+
1069
+	// Validate the selected category/ies - Grab the current list based on post_type
1070
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1071
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1072
+
1073
+	// Make sure we have an array
1074
+	if (!(is_array($params['category']))) {
1075
+		$params['category'] = explode(',', $params['category']);
1076
+	}
1077
+
1078
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1079
+	// Otherwise it becomes empty and later on that will mean "All"
1080
+	$params['category']     = array_intersect($params['category'], $categories);
1081
+
1082
+	// Post_number needs to be a positive integer
1083
+	$params['post_number']  = absint($params['post_number']);
1084
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1085 1085
     
1086
-    // Post_number needs to be a positive integer
1087
-    if (!empty($atts['post_author'])) {
1088
-        if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1089
-            $params['post_author'] = $post->post_author;
1090
-        } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1091
-            $params['post_author'] = absint($atts['post_author']);
1092
-        } else {
1093
-            unset($params['post_author']);
1094
-        }
1095
-    } else {
1096
-        unset($params['post_author']);
1097
-    }
1098
-
1099
-    // Validate character_count
1100
-    //todo: is this necessary?
1101
-    $params['character_count']  = $params['character_count'];
1102
-
1103
-    // Validate our layout choice
1104
-    // Outside of the norm, I added some more simple terms to match the existing
1105
-    // So now I just run the switch to set it properly.
1106
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1107
-
1108
-    // Validate our sorting choice
1109
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1110
-
1111
-    // Validate Listing width, used in the template widget-listing-listview.php
1112
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1113
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1114
-
1115
-    // Validate the checkboxes used on the widget
1116
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1117
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1118
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1119
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1120
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1121
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1122
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1123
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1124
-
1125
-    // Clean tags
1126
-    if (!empty($params['tags'])) {
1127
-        if (!is_array($params['tags'])) {
1128
-            $comma = _x(',', 'tag delimiter');
1129
-            if ( ',' !== $comma ) {
1130
-                $params['tags'] = str_replace($comma, ',', $params['tags']);
1131
-            }
1132
-            $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1133
-            $params['tags'] = array_map('trim', $params['tags']);
1134
-        }
1135
-    } else {
1136
-        $params['tags'] = array();
1137
-    }
1138
-
1139
-    /**
1140
-     * End of validation
1141
-     */
1142
-    if (isset($atts['geodir_ajax'])) {
1143
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1144
-        unset($atts['geodir_ajax']);
1145
-    }
1146
-    if (isset($atts['pageno'])) {
1147
-        $params['pageno'] = $atts['pageno'];
1148
-        unset($atts['pageno']);
1149
-    }
1150
-
1151
-    if ( !empty($atts['shortcode_content']) ) {
1152
-        $content = $atts['shortcode_content'];
1153
-    }
1154
-    $params['shortcode_content'] = trim($content);
1155
-    $atts['shortcode_content'] = trim($content);
1086
+	// Post_number needs to be a positive integer
1087
+	if (!empty($atts['post_author'])) {
1088
+		if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1089
+			$params['post_author'] = $post->post_author;
1090
+		} else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1091
+			$params['post_author'] = absint($atts['post_author']);
1092
+		} else {
1093
+			unset($params['post_author']);
1094
+		}
1095
+	} else {
1096
+		unset($params['post_author']);
1097
+	}
1098
+
1099
+	// Validate character_count
1100
+	//todo: is this necessary?
1101
+	$params['character_count']  = $params['character_count'];
1102
+
1103
+	// Validate our layout choice
1104
+	// Outside of the norm, I added some more simple terms to match the existing
1105
+	// So now I just run the switch to set it properly.
1106
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1107
+
1108
+	// Validate our sorting choice
1109
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1110
+
1111
+	// Validate Listing width, used in the template widget-listing-listview.php
1112
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1113
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1114
+
1115
+	// Validate the checkboxes used on the widget
1116
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1117
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1118
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1119
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1120
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1121
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1122
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1123
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1124
+
1125
+	// Clean tags
1126
+	if (!empty($params['tags'])) {
1127
+		if (!is_array($params['tags'])) {
1128
+			$comma = _x(',', 'tag delimiter');
1129
+			if ( ',' !== $comma ) {
1130
+				$params['tags'] = str_replace($comma, ',', $params['tags']);
1131
+			}
1132
+			$params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1133
+			$params['tags'] = array_map('trim', $params['tags']);
1134
+		}
1135
+	} else {
1136
+		$params['tags'] = array();
1137
+	}
1138
+
1139
+	/**
1140
+	 * End of validation
1141
+	 */
1142
+	if (isset($atts['geodir_ajax'])) {
1143
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1144
+		unset($atts['geodir_ajax']);
1145
+	}
1146
+	if (isset($atts['pageno'])) {
1147
+		$params['pageno'] = $atts['pageno'];
1148
+		unset($atts['pageno']);
1149
+	}
1150
+
1151
+	if ( !empty($atts['shortcode_content']) ) {
1152
+		$content = $atts['shortcode_content'];
1153
+	}
1154
+	$params['shortcode_content'] = trim($content);
1155
+	$atts['shortcode_content'] = trim($content);
1156 1156
     
1157
-    $params['shortcode_atts']       = $atts;
1157
+	$params['shortcode_atts']       = $atts;
1158 1158
 
1159
-    $output = geodir_sc_gd_listings_output($params);
1159
+	$output = geodir_sc_gd_listings_output($params);
1160 1160
 
1161
-    return $output;
1161
+	return $output;
1162 1162
 }
1163 1163
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1164 1164
 
@@ -1206,23 +1206,23 @@  discard block
 block discarded – undo
1206 1206
 		'max_count' => 'all',
1207 1207
 		'max_level' => '1',
1208 1208
 		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1209
-        'after_widget' => '</section>',
1210
-        'before_title' => '<h3 class="widget-title">',
1211
-        'after_title' => '</h3>',
1209
+		'after_widget' => '</section>',
1210
+		'before_title' => '<h3 class="widget-title">',
1211
+		'after_title' => '</h3>',
1212 1212
 	);
1213 1213
 	$params = shortcode_atts($defaults, $atts);
1214 1214
 
1215
-    /**
1216
-     * Validate our incoming params
1217
-     */
1215
+	/**
1216
+	 * Validate our incoming params
1217
+	 */
1218 1218
 	// Make sure we have an array
1219
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1219
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1220 1220
 	 
1221 1221
 	// Validate the checkboxes used on the widget
1222
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1223
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1224
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1225
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1222
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1223
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1224
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1225
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1226 1226
 	
1227 1227
 	if ($params['max_count'] != 'all') {
1228 1228
 		$params['max_count'] = absint($params['max_count']);
@@ -1236,10 +1236,10 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 	ob_start();
1238 1238
 	the_widget('geodir_cpt_categories_widget', $params, $params);
1239
-    $output = ob_get_contents();
1240
-    ob_end_clean();
1239
+	$output = ob_get_contents();
1240
+	ob_end_clean();
1241 1241
 
1242
-    return $output;
1242
+	return $output;
1243 1243
 }
1244 1244
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1245 1245
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
  * @return string HTML code.
1255 1255
  */
1256 1256
 function geodir_sc_responsive_videos($atts, $content) {
1257
-    return '<div class="geodir-video-wrapper">'.$content.'</div>';
1257
+	return '<div class="geodir-video-wrapper">'.$content.'</div>';
1258 1258
 }
1259 1259
 add_shortcode('gd_video', 'geodir_sc_responsive_videos');
1260 1260
 ?>
1261 1261
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_template_actions.php 2 patches
Indentation   +1735 added lines, -1735 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function gd_compat_styles()
19 19
 {
20
-    $tc = get_option('theme_compatibility_setting');
21
-    echo "<style id='gd-compat-styles' type='text/css'>";
22
-    echo $tc['geodir_theme_compat_css'];
23
-    echo "</style>";
20
+	$tc = get_option('theme_compatibility_setting');
21
+	echo "<style id='gd-compat-styles' type='text/css'>";
22
+	echo $tc['geodir_theme_compat_css'];
23
+	echo "</style>";
24 24
 }
25 25
 
26 26
 /**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function gd_compat_script()
33 33
 {
34
-    $tc = get_option('theme_compatibility_setting');
35
-    echo "<script>";
36
-    echo $tc['geodir_theme_compat_js'];
37
-    echo " </script>";
34
+	$tc = get_option('theme_compatibility_setting');
35
+	echo "<script>";
36
+	echo $tc['geodir_theme_compat_js'];
37
+	echo " </script>";
38 38
 }
39 39
 
40 40
 /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_top_content_add_dynamic()
49 49
 {
50
-    $tc = get_option('theme_compatibility_setting');
51
-    echo $tc['geodir_top_content_add'];
50
+	$tc = get_option('theme_compatibility_setting');
51
+	echo $tc['geodir_top_content_add'];
52 52
 }
53 53
 
54 54
 /**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function geodir_before_main_content_add_dynamic()
63 63
 {
64
-    $tc = get_option('theme_compatibility_setting');
65
-    echo $tc['geodir_before_main_content_add'];
64
+	$tc = get_option('theme_compatibility_setting');
65
+	echo $tc['geodir_before_main_content_add'];
66 66
 }
67 67
 
68 68
 /**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function geodir_full_page_class_dynamic()
77 77
 {
78
-    $tc = get_option('theme_compatibility_setting');
79
-    return $tc['geodir_full_page_class_filter'];
78
+	$tc = get_option('theme_compatibility_setting');
79
+	return $tc['geodir_full_page_class_filter'];
80 80
 }
81 81
 
82 82
 /**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function geodir_before_widget_dynamic()
91 91
 {
92
-    $tc = get_option('theme_compatibility_setting');
93
-    return $tc['geodir_before_widget_filter'];
92
+	$tc = get_option('theme_compatibility_setting');
93
+	return $tc['geodir_before_widget_filter'];
94 94
 }
95 95
 
96 96
 /**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function geodir_after_widget_dynamic()
105 105
 {
106
-    $tc = get_option('theme_compatibility_setting');
107
-    return $tc['geodir_after_widget_filter'];
106
+	$tc = get_option('theme_compatibility_setting');
107
+	return $tc['geodir_after_widget_filter'];
108 108
 }
109 109
 
110 110
 /**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function geodir_before_title_dynamic()
119 119
 {
120
-    $tc = get_option('theme_compatibility_setting');
121
-    return $tc['geodir_before_title_filter'];
120
+	$tc = get_option('theme_compatibility_setting');
121
+	return $tc['geodir_before_title_filter'];
122 122
 }
123 123
 
124 124
 /**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function geodir_after_title_dynamic()
133 133
 {
134
-    $tc = get_option('theme_compatibility_setting');
135
-    return $tc['geodir_after_title_filter'];
134
+	$tc = get_option('theme_compatibility_setting');
135
+	return $tc['geodir_after_title_filter'];
136 136
 }
137 137
 
138 138
 /**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function geodir_menu_li_class_dynamic()
147 147
 {
148
-    $tc = get_option('theme_compatibility_setting');
149
-    return $tc['geodir_menu_li_class_filter'];
148
+	$tc = get_option('theme_compatibility_setting');
149
+	return $tc['geodir_menu_li_class_filter'];
150 150
 }
151 151
 
152 152
 /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function geodir_sub_menu_ul_class_dynamic()
161 161
 {
162
-    $tc = get_option('theme_compatibility_setting');
163
-    return $tc['geodir_sub_menu_ul_class_filter'];
162
+	$tc = get_option('theme_compatibility_setting');
163
+	return $tc['geodir_sub_menu_ul_class_filter'];
164 164
 }
165 165
 
166 166
 /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function geodir_sub_menu_li_class_dynamic()
175 175
 {
176
-    $tc = get_option('theme_compatibility_setting');
177
-    return $tc['geodir_sub_menu_li_class_filter'];
176
+	$tc = get_option('theme_compatibility_setting');
177
+	return $tc['geodir_sub_menu_li_class_filter'];
178 178
 }
179 179
 
180 180
 /**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function geodir_menu_a_class_dynamic()
189 189
 {
190
-    $tc = get_option('theme_compatibility_setting');
191
-    return $tc['geodir_menu_a_class_filter'];
190
+	$tc = get_option('theme_compatibility_setting');
191
+	return $tc['geodir_menu_a_class_filter'];
192 192
 }
193 193
 
194 194
 /**
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
  */
202 202
 function geodir_sub_menu_a_class_dynamic()
203 203
 {
204
-    $tc = get_option('theme_compatibility_setting');
205
-    return $tc['geodir_sub_menu_a_class_filter'];
204
+	$tc = get_option('theme_compatibility_setting');
205
+	return $tc['geodir_sub_menu_a_class_filter'];
206 206
 }
207 207
 
208 208
 /**
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_location_switcher_menu_li_class_dynamic()
217 217
 {
218
-    $tc = get_option('theme_compatibility_setting');
219
-    return $tc['geodir_location_switcher_menu_li_class_filter'];
218
+	$tc = get_option('theme_compatibility_setting');
219
+	return $tc['geodir_location_switcher_menu_li_class_filter'];
220 220
 }
221 221
 
222 222
 /**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_location_switcher_menu_a_class_dynamic()
231 231
 {
232
-    $tc = get_option('theme_compatibility_setting');
233
-    return $tc['geodir_location_switcher_menu_a_class_filter'];
232
+	$tc = get_option('theme_compatibility_setting');
233
+	return $tc['geodir_location_switcher_menu_a_class_filter'];
234 234
 }
235 235
 
236 236
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 function geodir_location_switcher_menu_sub_ul_class_dynamic()
245 245
 {
246
-    $tc = get_option('theme_compatibility_setting');
247
-    return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
246
+	$tc = get_option('theme_compatibility_setting');
247
+	return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
248 248
 }
249 249
 
250 250
 /**
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
  */
258 258
 function geodir_location_switcher_menu_sub_li_class_dynamic()
259 259
 {
260
-    $tc = get_option('theme_compatibility_setting');
261
-    return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
260
+	$tc = get_option('theme_compatibility_setting');
261
+	return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
262 262
 }
263 263
 
264 264
 
@@ -275,106 +275,106 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
279
-    if (empty($tc)) {
280
-        return;
281
-    }
278
+	$tc = get_option('theme_compatibility_setting');
279
+	if (empty($tc)) {
280
+		return;
281
+	}
282 282
 
283
-    //php
284
-    if (!empty($tc['geodir_theme_compat_code'])) {
285
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
-    }
283
+	//php
284
+	if (!empty($tc['geodir_theme_compat_code'])) {
285
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+	}
287 287
 
288
-    //geodir_full_page_class
289
-    if (!empty($tc['geodir_full_page_class_filter'])) {
290
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
291
-    }
288
+	//geodir_full_page_class
289
+	if (!empty($tc['geodir_full_page_class_filter'])) {
290
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
291
+	}
292 292
 
293
-    //widget before filter
294
-    if (!empty($tc['geodir_before_widget_filter'])) {
295
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
296
-    }
293
+	//widget before filter
294
+	if (!empty($tc['geodir_before_widget_filter'])) {
295
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
296
+	}
297 297
 
298
-    //widget after filter
299
-    if (!empty($tc['geodir_after_widget_filter'])) {
300
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
301
-    }
298
+	//widget after filter
299
+	if (!empty($tc['geodir_after_widget_filter'])) {
300
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
301
+	}
302 302
 
303
-    //widget before title filter
304
-    if (!empty($tc['geodir_before_title_filter'])) {
305
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
306
-    }
303
+	//widget before title filter
304
+	if (!empty($tc['geodir_before_title_filter'])) {
305
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
306
+	}
307 307
 
308
-    //widget before title filter
309
-    if (!empty($tc['geodir_after_title_filter'])) {
310
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
311
-    }
308
+	//widget before title filter
309
+	if (!empty($tc['geodir_after_title_filter'])) {
310
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
311
+	}
312 312
 
313
-    //menu li class
314
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
315
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
316
-    }
313
+	//menu li class
314
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
315
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
316
+	}
317 317
 
318
-    //menu ul class
319
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
320
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
321
-    }
318
+	//menu ul class
319
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
320
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
321
+	}
322 322
 
323
-    //menu sub li class
324
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
325
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
326
-    }
323
+	//menu sub li class
324
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
325
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
326
+	}
327 327
 
328
-    //menu a class
329
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
330
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
331
-    }
328
+	//menu a class
329
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
330
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
331
+	}
332 332
 
333
-    //menu sub a class
334
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
335
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
336
-    }
333
+	//menu sub a class
334
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
335
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
336
+	}
337 337
 
338
-    //location menu li class
339
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
340
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
341
-    }
338
+	//location menu li class
339
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
340
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
341
+	}
342 342
 
343
-    //location menu sub ul class
344
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
345
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
346
-    }
343
+	//location menu sub ul class
344
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
345
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
346
+	}
347 347
 
348
-    //location menu sub li class
349
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
350
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
351
-    }
348
+	//location menu sub li class
349
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
350
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
351
+	}
352 352
 
353
-    //location menu a class
354
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
355
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
356
-    }
353
+	//location menu a class
354
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
355
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
356
+	}
357 357
 
358
-    // compat styles
359
-    if (!empty($tc['geodir_theme_compat_css'])) {
360
-        add_action('wp_head', 'gd_compat_styles');
361
-    }
358
+	// compat styles
359
+	if (!empty($tc['geodir_theme_compat_css'])) {
360
+		add_action('wp_head', 'gd_compat_styles');
361
+	}
362 362
 
363
-    // compat js
364
-    if (!empty($tc['geodir_theme_compat_js'])) {
365
-        add_action('wp_footer', 'gd_compat_script');
366
-    }
363
+	// compat js
364
+	if (!empty($tc['geodir_theme_compat_js'])) {
365
+		add_action('wp_footer', 'gd_compat_script');
366
+	}
367 367
 
368 368
 
369
-    // geodir_top_content_add
370
-    if (!empty($tc['geodir_top_content_add'])) {
371
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
372
-    }
369
+	// geodir_top_content_add
370
+	if (!empty($tc['geodir_top_content_add'])) {
371
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
372
+	}
373 373
 
374
-    // geodir_before_main_content_add
375
-    if (!empty($tc['geodir_before_main_content_add'])) {
376
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
377
-    }
374
+	// geodir_before_main_content_add
375
+	if (!empty($tc['geodir_before_main_content_add'])) {
376
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
377
+	}
378 378
 
379 379
 
380 380
 }
@@ -397,23 +397,23 @@  discard block
 block discarded – undo
397 397
  */
398 398
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
399 399
 {
400
-    $tc = get_option('theme_compatibility_setting');
401
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
402
-        $text = $tc['geodir_wrapper_open_replace'];
403
-    } else {
404
-        $text = '<div id="[id]" class="[class]">';
405
-    }
400
+	$tc = get_option('theme_compatibility_setting');
401
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
402
+		$text = $tc['geodir_wrapper_open_replace'];
403
+	} else {
404
+		$text = '<div id="[id]" class="[class]">';
405
+	}
406 406
 
407
-    if (!empty($tc['geodir_wrapper_open_id'])) {
408
-        $id = $tc['geodir_wrapper_open_id'];
409
-    }
410
-    if (!empty($tc['geodir_wrapper_open_class'])) {
411
-        $class = $tc['geodir_wrapper_open_class'];
412
-    }
407
+	if (!empty($tc['geodir_wrapper_open_id'])) {
408
+		$id = $tc['geodir_wrapper_open_id'];
409
+	}
410
+	if (!empty($tc['geodir_wrapper_open_class'])) {
411
+		$class = $tc['geodir_wrapper_open_class'];
412
+	}
413 413
 
414
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
414
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415 415
 
416
-    echo $text;
416
+	echo $text;
417 417
 }
418 418
 
419 419
 // action for adding the wrapperdiv closing tag
@@ -428,14 +428,14 @@  discard block
 block discarded – undo
428 428
  */
429 429
 function geodir_action_wrapper_close($type = '')
430 430
 {
431
-    $tc = get_option('theme_compatibility_setting');
432
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
433
-        $text = $tc['geodir_wrapper_close_replace'];
434
-    } else {
435
-        $text = '</div><!-- wrapper ends here-->';
436
-    }
431
+	$tc = get_option('theme_compatibility_setting');
432
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
433
+		$text = $tc['geodir_wrapper_close_replace'];
434
+	} else {
435
+		$text = '</div><!-- wrapper ends here-->';
436
+	}
437 437
 
438
-    echo $text;
438
+	echo $text;
439 439
 }
440 440
 
441 441
 // action for adding the content div opening tag
@@ -451,35 +451,35 @@  discard block
 block discarded – undo
451 451
  */
452 452
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
453 453
 {
454
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
-        $width_css = 'style="width:' . $width . '%;"';
456
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
-        $width_css = 'style="width:' . $width . '%;"';
458
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
-        $width_css = 'style="width:' . $width . '%;"';
460
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
-        $width_css = 'style="width:' . $width . '%;"';
462
-    } else {
463
-        $width_css = '';
464
-    }
465
-
466
-    $tc = get_option('theme_compatibility_setting');
467
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
468
-        $text = $tc['geodir_wrapper_content_open_replace'];
469
-    } else {
470
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
471
-    }
472
-
473
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
474
-        $id = $tc['geodir_wrapper_content_open_id'];
475
-    }
476
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
477
-        $class = $tc['geodir_wrapper_content_open_class'];
478
-    }
479
-
480
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
481
-
482
-    echo $text;
454
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
+		$width_css = 'style="width:' . $width . '%;"';
456
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
+		$width_css = 'style="width:' . $width . '%;"';
458
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
+		$width_css = 'style="width:' . $width . '%;"';
460
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
+		$width_css = 'style="width:' . $width . '%;"';
462
+	} else {
463
+		$width_css = '';
464
+	}
465
+
466
+	$tc = get_option('theme_compatibility_setting');
467
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
468
+		$text = $tc['geodir_wrapper_content_open_replace'];
469
+	} else {
470
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
471
+	}
472
+
473
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
474
+		$id = $tc['geodir_wrapper_content_open_id'];
475
+	}
476
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
477
+		$class = $tc['geodir_wrapper_content_open_class'];
478
+	}
479
+
480
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
481
+
482
+	echo $text;
483 483
 }
484 484
 
485 485
 // action for adding the primary div closing tag
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
  */
494 494
 function geodir_action_wrapper_content_close($type = '')
495 495
 {
496
-    $tc = get_option('theme_compatibility_setting');
497
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
498
-        $text = $tc['geodir_wrapper_content_close_replace'];
499
-    } else {
500
-        $text = '</div><!-- content ends here-->';
501
-    }
502
-    echo $text;
496
+	$tc = get_option('theme_compatibility_setting');
497
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
498
+		$text = $tc['geodir_wrapper_content_close_replace'];
499
+	} else {
500
+		$text = '</div><!-- content ends here-->';
501
+	}
502
+	echo $text;
503 503
 }
504 504
 
505 505
 // action for adding the <article> opening tag
@@ -517,24 +517,24 @@  discard block
 block discarded – undo
517 517
  */
518 518
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
519 519
 {
520
-    $class = implode(" ", $class);
521
-    $tc = get_option('theme_compatibility_setting');
522
-    if (!empty($tc['geodir_article_open_replace'])) {
523
-        $text = $tc['geodir_article_open_replace'];
524
-    } else {
525
-        $text = '<article  id="[id]" class="[class]" >';
526
-    }
520
+	$class = implode(" ", $class);
521
+	$tc = get_option('theme_compatibility_setting');
522
+	if (!empty($tc['geodir_article_open_replace'])) {
523
+		$text = $tc['geodir_article_open_replace'];
524
+	} else {
525
+		$text = '<article  id="[id]" class="[class]" >';
526
+	}
527 527
 
528
-    if (!empty($tc['geodir_article_open_id'])) {
529
-        $id = $tc['geodir_article_open_id'];
530
-    }
531
-    if (!empty($tc['geodir_article_open_class'])) {
532
-        $class = $tc['geodir_article_open_class'];
533
-    }
528
+	if (!empty($tc['geodir_article_open_id'])) {
529
+		$id = $tc['geodir_article_open_id'];
530
+	}
531
+	if (!empty($tc['geodir_article_open_class'])) {
532
+		$class = $tc['geodir_article_open_class'];
533
+	}
534 534
 
535
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
535
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536 536
 
537
-    echo $text;
537
+	echo $text;
538 538
 }
539 539
 
540 540
 // action for adding the primary div closing tag
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
  */
549 549
 function geodir_action_article_close($type = '')
550 550
 {
551
-    $tc = get_option('theme_compatibility_setting');
552
-    if (!empty($tc['geodir_article_close_replace'])) {
553
-        $text = $tc['geodir_article_close_replace'];
554
-    } else {
555
-        $text = '</article><!-- article ends here-->';
556
-    }
557
-    echo $text;
551
+	$tc = get_option('theme_compatibility_setting');
552
+	if (!empty($tc['geodir_article_close_replace'])) {
553
+		$text = $tc['geodir_article_close_replace'];
554
+	} else {
555
+		$text = '</article><!-- article ends here-->';
556
+	}
557
+	echo $text;
558 558
 }
559 559
 
560 560
 // action for adding the sidebar opening tag
@@ -571,35 +571,35 @@  discard block
 block discarded – undo
571 571
  */
572 572
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
573 573
 {
574
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
-        $width_css = 'style="width:' . $width . '%;"';
576
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
-        $width_css = 'style="width:' . $width . '%;"';
578
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
-        $width_css = 'style="width:' . $width . '%;"';
580
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
-        $width_css = 'style="width:' . $width . '%;"';
582
-    } else {
583
-        $width_css = '';
584
-    }
585
-
586
-    $tc = get_option('theme_compatibility_setting');
587
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
588
-        $text = $tc['geodir_sidebar_right_open_replace'];
589
-    } else {
590
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
591
-    }
592
-
593
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
594
-        $id = $tc['geodir_sidebar_right_open_id'];
595
-    }
596
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
597
-        $class = $tc['geodir_sidebar_right_open_class'];
598
-    }
599
-
600
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
601
-
602
-    echo $text;
574
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
+		$width_css = 'style="width:' . $width . '%;"';
576
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
+		$width_css = 'style="width:' . $width . '%;"';
578
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
+		$width_css = 'style="width:' . $width . '%;"';
580
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
+		$width_css = 'style="width:' . $width . '%;"';
582
+	} else {
583
+		$width_css = '';
584
+	}
585
+
586
+	$tc = get_option('theme_compatibility_setting');
587
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
588
+		$text = $tc['geodir_sidebar_right_open_replace'];
589
+	} else {
590
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
591
+	}
592
+
593
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
594
+		$id = $tc['geodir_sidebar_right_open_id'];
595
+	}
596
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
597
+		$class = $tc['geodir_sidebar_right_open_class'];
598
+	}
599
+
600
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
601
+
602
+	echo $text;
603 603
 }
604 604
 
605 605
 // action for adding the primary div closing tag
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function geodir_action_sidebar_right_close($type = '')
615 615
 {
616
-    $tc = get_option('theme_compatibility_setting');
617
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
618
-        $text = $tc['geodir_sidebar_right_close_replace'];
619
-    } else {
620
-        $text = '</aside><!-- sidebar ends here-->';
621
-    }
622
-    echo $text;
616
+	$tc = get_option('theme_compatibility_setting');
617
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
618
+		$text = $tc['geodir_sidebar_right_close_replace'];
619
+	} else {
620
+		$text = '</aside><!-- sidebar ends here-->';
621
+	}
622
+	echo $text;
623 623
 }
624 624
 
625 625
 
@@ -640,121 +640,121 @@  discard block
 block discarded – undo
640 640
  */
641 641
 function geodir_action_geodir_set_preview_post()
642 642
 {
643
-    global $post, $preview, $gd_session;
644
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
645
-    if (!$preview || $is_backend_preview) {
646
-        return;
647
-    }// bail if not previewing
648
-
649
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
650
-
651
-    $fields_info = geodir_get_custom_fields_type($listing_type);
652
-
653
-    foreach ($_REQUEST as $pkey => $pval) {
654
-        if ($pkey == 'geodir_video') {
655
-            $tags = '<iframe>';
656
-        } else if ($pkey == 'post_desc') {
657
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
658
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
659
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
660
-        } else if (is_array($_REQUEST[$pkey])) {
661
-            $tags = 'skip_field';
662
-        } else {
663
-            $tags = '';
664
-        }
665
-        /**
666
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
667
-         *
668
-         * @since 1.0.0
669
-         * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
670
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
671
-         */
672
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
673
-
674
-        if ($tags != 'skip_field') {
675
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
676
-        }
677
-    }
678
-
679
-    $post = (object)$_REQUEST;
680
-
681
-
682
-    if (isset($post->video)) {
683
-        $post->video = stripslashes($post->video);
684
-    }
685
-
686
-    if (isset($post->Video2)) {
687
-        $post->Video2 = stripslashes($post->Video2);
688
-    }
689
-
690
-    $post_type = $post->listing_type;
691
-    $post_type_info = get_post_type_object($post_type);
692
-
693
-    $listing_label = $post_type_info->labels->singular_name;
694
-
695
-    $term_icon = '';
696
-
697
-    if (!empty($post->post_category)) {
698
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
699
-
700
-            if ($post_term != '' && !is_array($post_term)) {
701
-                $post_term = explode(',', trim($post_term, ','));
702
-            }
643
+	global $post, $preview, $gd_session;
644
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
645
+	if (!$preview || $is_backend_preview) {
646
+		return;
647
+	}// bail if not previewing
648
+
649
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
650
+
651
+	$fields_info = geodir_get_custom_fields_type($listing_type);
652
+
653
+	foreach ($_REQUEST as $pkey => $pval) {
654
+		if ($pkey == 'geodir_video') {
655
+			$tags = '<iframe>';
656
+		} else if ($pkey == 'post_desc') {
657
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
658
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
659
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
660
+		} else if (is_array($_REQUEST[$pkey])) {
661
+			$tags = 'skip_field';
662
+		} else {
663
+			$tags = '';
664
+		}
665
+		/**
666
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
667
+		 *
668
+		 * @since 1.0.0
669
+		 * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
670
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
671
+		 */
672
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
673
+
674
+		if ($tags != 'skip_field') {
675
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
676
+		}
677
+	}
678
+
679
+	$post = (object)$_REQUEST;
680
+
681
+
682
+	if (isset($post->video)) {
683
+		$post->video = stripslashes($post->video);
684
+	}
685
+
686
+	if (isset($post->Video2)) {
687
+		$post->Video2 = stripslashes($post->Video2);
688
+	}
689
+
690
+	$post_type = $post->listing_type;
691
+	$post_type_info = get_post_type_object($post_type);
692
+
693
+	$listing_label = $post_type_info->labels->singular_name;
694
+
695
+	$term_icon = '';
696
+
697
+	if (!empty($post->post_category)) {
698
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
699
+
700
+			if ($post_term != '' && !is_array($post_term)) {
701
+				$post_term = explode(',', trim($post_term, ','));
702
+			}
703 703
 
704
-            if (is_array($post_term)) {
705
-                $post_term = array_unique($post_term);
706
-            }
704
+			if (is_array($post_term)) {
705
+				$post_term = array_unique($post_term);
706
+			}
707 707
 
708
-            if (!empty($post_term)) {
709
-                foreach ($post_term as $cat_id) {
710
-                    $cat_id = trim($cat_id);
711
-
712
-                    if ($cat_id != '') {
713
-                        $term_icon = get_option('geodir_default_marker_icon');
714
-
715
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716
-                            if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
-                                    $term_icon = $term_icon_url['src'];
719
-                                break;
720
-                            }
721
-                        }
722
-                    }
723
-                }
724
-            }
725
-        }
726
-    }
708
+			if (!empty($post_term)) {
709
+				foreach ($post_term as $cat_id) {
710
+					$cat_id = trim($cat_id);
711
+
712
+					if ($cat_id != '') {
713
+						$term_icon = get_option('geodir_default_marker_icon');
714
+
715
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716
+							if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
+									$term_icon = $term_icon_url['src'];
719
+								break;
720
+							}
721
+						}
722
+					}
723
+				}
724
+			}
725
+		}
726
+	}
727 727
 
728
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
729
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
728
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
729
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
730 730
 
731
-    $srcharr = array("'", "/", "-", '"', '\\');
732
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
731
+	$srcharr = array("'", "/", "-", '"', '\\');
732
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
733 733
 
734
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
734
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
735 735
 
736
-    $json = '{';
737
-    $json .= '"post_preview": "1",';
738
-    $json .= '"t": "' . $json_title . '",';
739
-    $json .= '"lt": "' . $post_latitude . '",';
740
-    $json .= '"ln": "' . $post_longitude . '",';
741
-    $json .= '"i":"' . $term_icon . '"';
742
-    $json .= '}';
736
+	$json = '{';
737
+	$json .= '"post_preview": "1",';
738
+	$json .= '"t": "' . $json_title . '",';
739
+	$json .= '"lt": "' . $post_latitude . '",';
740
+	$json .= '"ln": "' . $post_longitude . '",';
741
+	$json .= '"i":"' . $term_icon . '"';
742
+	$json .= '}';
743 743
 
744
-    $post->marker_json = $json;
744
+	$post->marker_json = $json;
745 745
 
746
-    $gd_session->set('listing', $_REQUEST);
746
+	$gd_session->set('listing', $_REQUEST);
747 747
 
748
-    // we need to define a few things to trick the setup_postdata
749
-    if (!isset($post->ID)) {
750
-        $post->ID = '';
751
-        $post->post_author = '';
752
-        $post->post_date = '';
753
-        $post->post_content = '';
754
-        $post->default_category = '';
755
-        $post->post_type = '';
756
-    }
757
-    setup_postdata($post);
748
+	// we need to define a few things to trick the setup_postdata
749
+	if (!isset($post->ID)) {
750
+		$post->ID = '';
751
+		$post->post_author = '';
752
+		$post->post_date = '';
753
+		$post->post_content = '';
754
+		$post->default_category = '';
755
+		$post->post_type = '';
756
+	}
757
+	setup_postdata($post);
758 758
 }
759 759
 
760 760
 /**
@@ -766,15 +766,15 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_action_geodir_preview_code()
768 768
 {
769
-    global $preview;
769
+	global $preview;
770 770
 
771
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
771
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
772 772
 
773
-    if (!$preview || $is_backend_preview) {
774
-        return;
775
-    }// bail if not previewing
773
+	if (!$preview || $is_backend_preview) {
774
+		return;
775
+	}// bail if not previewing
776 776
 
777
-    geodir_get_template_part('preview', 'buttons');
777
+	geodir_get_template_part('preview', 'buttons');
778 778
 }
779 779
 
780 780
 // action for adding the details page top widget area
@@ -790,20 +790,20 @@  discard block
 block discarded – undo
790 790
  */
791 791
 function geodir_action_geodir_sidebar_detail_top($class = '')
792 792
 {
793
-    if (get_option('geodir_show_detail_top_section')) { ?>
793
+	if (get_option('geodir_show_detail_top_section')) { ?>
794 794
         <div
795 795
             class="<?php
796
-            /**
797
-             * Filter the div class for the wrapper of the full width widget areas.
798
-             *
799
-             * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
800
-             *
801
-             * @since 1.0.0
802
-             * @param string $class The class of the div.
803
-             * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
804
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
805
-             */
806
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
796
+			/**
797
+			 * Filter the div class for the wrapper of the full width widget areas.
798
+			 *
799
+			 * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
800
+			 *
801
+			 * @since 1.0.0
802
+			 * @param string $class The class of the div.
803
+			 * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
804
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
805
+			 */
806
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
807 807
             <?php dynamic_sidebar('geodir_detail_top'); ?>
808 808
         </div>
809 809
     <?php }
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
  */
828 828
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
829 829
 {
830
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
830
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
831 831
         <div
832 832
             class="<?php
833
-            /** This action is documented in geodirectory_template_actions.php */
834
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
833
+			/** This action is documented in geodirectory_template_actions.php */
834
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
835 835
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
836 836
         </div><!-- clearfix ends here-->
837 837
     <?php }
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
  */
846 846
 function geodir_details_sidebar_widget_area()
847 847
 {
848
-    dynamic_sidebar('geodir_detail_sidebar');
848
+	dynamic_sidebar('geodir_detail_sidebar');
849 849
 }
850 850
 
851 851
 /**
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
  */
857 857
 function geodir_details_sidebar_place_details()
858 858
 {
859
-    /**
860
-     * Used to add items to the details page sidebar.
861
-     *
862
-     * @since 1.0.0
863
-     */
864
-    do_action('geodir_detail_page_sidebar');
859
+	/**
860
+	 * Used to add items to the details page sidebar.
861
+	 *
862
+	 * @since 1.0.0
863
+	 */
864
+	do_action('geodir_detail_page_sidebar');
865 865
 }
866 866
 
867 867
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -876,68 +876,68 @@  discard block
 block discarded – undo
876 876
  */
877 877
 function geodir_action_details_sidebar()
878 878
 {
879
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
880
-    if (get_option('geodir_detail_sidebar_left_section')) {
881
-        /**
882
-         * Called before the details page left sidebar is opened.
883
-         *
884
-         * This is used to add opening wrapper HTML to the details page left sidebar.
885
-         *
886
-         * @since 1.0.0
887
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
888
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
889
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
890
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
891
-         */
892
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
893
-        ?>
879
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
880
+	if (get_option('geodir_detail_sidebar_left_section')) {
881
+		/**
882
+		 * Called before the details page left sidebar is opened.
883
+		 *
884
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
885
+		 *
886
+		 * @since 1.0.0
887
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
888
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
889
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
890
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
891
+		 */
892
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
893
+		?>
894 894
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
895
-        /**
896
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
897
-         *
898
-         * This is used to add all info to the details page sidebars.
899
-         *
900
-         * @since 1.0.0
901
-         */
902
-        do_action('geodir_detail_sidebar_inside');
903
-        ?></div><!-- end geodir-content-left --><?php
904
-        /**
905
-         * Called after the details page left sidebar.
906
-         *
907
-         * This is used to add closing wrapper HTML to the details page left sidebar.
908
-         *
909
-         * @since 1.0.0
910
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
911
-         */
912
-        do_action('geodir_sidebar_left_close', 'details-page');
913
-    } else {
914
-        /**
915
-         * Called before the details page right sidebar is opened.
916
-         *
917
-         * This is used to add opening wrapper HTML to the details page right sidebar.
918
-         *
919
-         * @since 1.0.0
920
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
921
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
922
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
923
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
924
-         */
925
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
926
-        ?>
895
+		/**
896
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
897
+		 *
898
+		 * This is used to add all info to the details page sidebars.
899
+		 *
900
+		 * @since 1.0.0
901
+		 */
902
+		do_action('geodir_detail_sidebar_inside');
903
+		?></div><!-- end geodir-content-left --><?php
904
+		/**
905
+		 * Called after the details page left sidebar.
906
+		 *
907
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
908
+		 *
909
+		 * @since 1.0.0
910
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
911
+		 */
912
+		do_action('geodir_sidebar_left_close', 'details-page');
913
+	} else {
914
+		/**
915
+		 * Called before the details page right sidebar is opened.
916
+		 *
917
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
918
+		 *
919
+		 * @since 1.0.0
920
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
921
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
922
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
923
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
924
+		 */
925
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
926
+		?>
927 927
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
928
-        /** This action is documented in geodirectory_template_actions.php */
929
-        do_action('geodir_detail_sidebar_inside');
930
-        ?></div><!-- end geodir-content-right --><?php
931
-        /**
932
-         * Called after the details page right sidebar.
933
-         *
934
-         * This is used to add closing wrapper HTML to the details page right sidebar.
935
-         *
936
-         * @since 1.0.0
937
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
938
-         */
939
-        do_action('geodir_sidebar_right_close', 'details-page');
940
-    }
928
+		/** This action is documented in geodirectory_template_actions.php */
929
+		do_action('geodir_detail_sidebar_inside');
930
+		?></div><!-- end geodir-content-right --><?php
931
+		/**
932
+		 * Called after the details page right sidebar.
933
+		 *
934
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
935
+		 *
936
+		 * @since 1.0.0
937
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
938
+		 */
939
+		do_action('geodir_sidebar_right_close', 'details-page');
940
+	}
941 941
 }
942 942
 
943 943
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -951,21 +951,21 @@  discard block
 block discarded – undo
951 951
  */
952 952
 function geodir_action_page_title()
953 953
 {
954
-    /**
955
-     * Filter the page title HTML h1 class.
956
-     *
957
-     * @since 1.0.0
958
-     * @param string $class The class to use. Default is 'entry-title fn'.
959
-     */
960
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
961
-    /**
962
-     * Filter the page title HTML header wrapper class.
963
-     *
964
-     * @since 1.0.0
965
-     * @param string $class The class to use. Default is 'entry-header'.
966
-     */
967
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
954
+	/**
955
+	 * Filter the page title HTML h1 class.
956
+	 *
957
+	 * @since 1.0.0
958
+	 * @param string $class The class to use. Default is 'entry-title fn'.
959
+	 */
960
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
961
+	/**
962
+	 * Filter the page title HTML header wrapper class.
963
+	 *
964
+	 * @since 1.0.0
965
+	 * @param string $class The class to use. Default is 'entry-header'.
966
+	 */
967
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969 969
 }
970 970
 
971 971
 
@@ -982,87 +982,87 @@  discard block
 block discarded – undo
982 982
  */
983 983
 function geodir_action_details_slider()
984 984
 {
985
-    global $preview, $post;
985
+	global $preview, $post;
986 986
 
987
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
987
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988 988
 
989
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
990
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
989
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
990
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
991 991
 
992
-        $preview_post_images = array();
993
-        if ($preview_get_images) {
994
-            foreach ($preview_get_images as $row) {
995
-                $preview_post_images[] = $row->src;
996
-            }
997
-        }
998
-        if (!empty($preview_post_images)) {
999
-            $post->post_images = implode(',', $preview_post_images);
1000
-        }
1001
-    }
1002
-
1003
-    if ($preview) {
1004
-        $post_images = array();
1005
-        if (isset($post->post_images) && !empty($post->post_images)) {
1006
-            $post->post_images = trim($post->post_images, ",");
1007
-            $post_images = explode(",", $post->post_images);
1008
-        }
1009
-
1010
-        $main_slides = '';
1011
-        $nav_slides = '';
1012
-        $slides = 0;
1013
-
1014
-        if (!empty($post_images)) {
1015
-            foreach ($post_images as $image) {
1016
-                if (!empty($image)) {
1017
-                    $sizes = getimagesize(trim($image));
1018
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1019
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020
-
1021
-                    if ($image && $width && $height) {
1022
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
-                    }
1024
-
1025
-                    if (isset($image->src)) {
1026
-                        if ($image->height >= 400) {
1027
-                            $spacer_height = 0;
1028
-                        } else {
1029
-                            $spacer_height = ((400 - $image->height) / 2);
1030
-                        }
1031
-
1032
-                        $image_title = isset($image->title) ? $image->title : '';
1033
-
1034
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1037
-                        $slides++;
1038
-                    }
1039
-                }
1040
-            }// endfore
1041
-        } //end if
1042
-    } else {
1043
-        $main_slides = '';
1044
-        $nav_slides = '';
1045
-        $post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page.
1046
-        $slides = 0;
1047
-
1048
-        if (!empty($post_images)) {
1049
-            foreach ($post_images as $image) {
1050
-                if ($image->height >= 400) {
1051
-                    $spacer_height = 0;
1052
-                } else {
1053
-                    $spacer_height = ((400 - $image->height) / 2);
1054
-                }
1055
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059
-                $slides++;
1060
-            }
1061
-        }// endfore
1062
-    }
992
+		$preview_post_images = array();
993
+		if ($preview_get_images) {
994
+			foreach ($preview_get_images as $row) {
995
+				$preview_post_images[] = $row->src;
996
+			}
997
+		}
998
+		if (!empty($preview_post_images)) {
999
+			$post->post_images = implode(',', $preview_post_images);
1000
+		}
1001
+	}
1002
+
1003
+	if ($preview) {
1004
+		$post_images = array();
1005
+		if (isset($post->post_images) && !empty($post->post_images)) {
1006
+			$post->post_images = trim($post->post_images, ",");
1007
+			$post_images = explode(",", $post->post_images);
1008
+		}
1009
+
1010
+		$main_slides = '';
1011
+		$nav_slides = '';
1012
+		$slides = 0;
1013
+
1014
+		if (!empty($post_images)) {
1015
+			foreach ($post_images as $image) {
1016
+				if (!empty($image)) {
1017
+					$sizes = getimagesize(trim($image));
1018
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1019
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020
+
1021
+					if ($image && $width && $height) {
1022
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
+					}
1024
+
1025
+					if (isset($image->src)) {
1026
+						if ($image->height >= 400) {
1027
+							$spacer_height = 0;
1028
+						} else {
1029
+							$spacer_height = ((400 - $image->height) / 2);
1030
+						}
1031
+
1032
+						$image_title = isset($image->title) ? $image->title : '';
1033
+
1034
+						$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1037
+						$slides++;
1038
+					}
1039
+				}
1040
+			}// endfore
1041
+		} //end if
1042
+	} else {
1043
+		$main_slides = '';
1044
+		$nav_slides = '';
1045
+		$post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page.
1046
+		$slides = 0;
1047
+
1048
+		if (!empty($post_images)) {
1049
+			foreach ($post_images as $image) {
1050
+				if ($image->height >= 400) {
1051
+					$spacer_height = 0;
1052
+				} else {
1053
+					$spacer_height = ((400 - $image->height) / 2);
1054
+				}
1055
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
+				$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
+				$main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059
+				$slides++;
1060
+			}
1061
+		}// endfore
1062
+	}
1063 1063
 
1064
-    if (!empty($post_images)) {
1065
-        ?>
1064
+	if (!empty($post_images)) {
1065
+		?>
1066 1066
         <div class="geodir_flex-container">
1067 1067
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1068 1068
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
             <?php } ?>
1076 1076
         </div>
1077 1077
     <?php
1078
-    }
1078
+	}
1079 1079
 }
1080 1080
 
1081 1081
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1090,177 +1090,177 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function geodir_action_details_taxonomies()
1092 1092
 {
1093
-    global $preview, $post;?>
1093
+	global $preview, $post;?>
1094 1094
     <p class="geodir_post_taxomomies clearfix">
1095 1095
     <?php
1096
-    $taxonomies = array();
1097
-
1098
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1099
-
1100
-    if ($preview && !$is_backend_preview) {
1101
-        $post_type = $post->listing_type;
1102
-        $post_taxonomy = $post_type . 'category';
1103
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104
-    } else {
1105
-        $post_type = $post->post_type;
1106
-        $post_taxonomy = $post_type . 'category';
1107
-    }
1096
+	$taxonomies = array();
1097
+
1098
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1099
+
1100
+	if ($preview && !$is_backend_preview) {
1101
+		$post_type = $post->listing_type;
1102
+		$post_taxonomy = $post_type . 'category';
1103
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104
+	} else {
1105
+		$post_type = $post->post_type;
1106
+		$post_taxonomy = $post_type . 'category';
1107
+	}
1108 1108
 //{	
1109
-    $post_type_info = get_post_type_object($post_type);
1110
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1111
-
1112
-    if (!empty($post->post_tags)) {
1113
-
1114
-        if (taxonomy_exists($post_type . '_tags')):
1115
-            $links = array();
1116
-            $terms = array();
1117
-            // to limit post tags
1118
-            $post_tags = trim($post->post_tags, ",");
1119
-            $post_id = isset($post->ID) ? $post->ID : '';
1120
-            /**
1121
-             * Filter the post tags.
1122
-             *
1123
-             * Allows you to filter the post tags output on the details page of a post.
1124
-             *
1125
-             * @since 1.0.0
1126
-             * @param string $post_tags A comma seperated list of tags.
1127
-             * @param int $post_id The current post id.
1128
-             */
1129
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1130
-
1131
-            $post->post_tags = $post_tags;
1132
-            $post_tags = explode(",", trim($post->post_tags, ","));
1133
-
1134
-
1135
-            foreach ($post_tags as $post_term) {
1136
-
1137
-                // fix slug creation order for tags & location
1138
-                $post_term = trim($post_term);
1139
-
1140
-                $priority_location = false;
1141
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1142
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1143
-                } else {
1144
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1145
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1146
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1147
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1148
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1149
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1150
-                    if ($match_country || $match_region || $match_city) {
1151
-                        $priority_location = true;
1152
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1153
-                    } else {
1154
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1155
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1156
-                    }
1157
-                }
1158
-
1159
-                if (!is_wp_error($term) && is_object($term)) {
1160
-
1161
-                    // fix tag link on detail page
1162
-                    if ($priority_location) {
1163
-
1164
-                        $tag_link = "<a href=''>$post_term</a>";
1165
-                        /**
1166
-                         * Filter the tag name on the details page.
1167
-                         *
1168
-                         * @since 1.5.6
1169
-                         * @param string $tag_link The tag link html.
1170
-                         * @param object $term The tag term object.
1171
-                         */
1172
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1173
-                        $links[] = $tag_link;
1174
-                    } else {
1175
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1176
-                        /** This action is documented in geodirectory-template_actions.php */
1177
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1178
-                        $links[] = $tag_link;
1179
-                    }
1180
-                    $terms[] = $term;
1181
-                }
1182
-                //
1183
-            }
1184
-            if (!isset($listing_label)) {
1185
-                $listing_label = '';
1186
-            }
1187
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1188
-        endif;
1189
-
1190
-    }
1191
-
1192
-    if (!empty($post->{$post_taxonomy})) {
1193
-        $links = array();
1194
-        $terms = array();
1195
-        $termsOrdered = array();
1196
-        if (!is_array($post->{$post_taxonomy})) {
1197
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1198
-        } else {
1199
-            $post_term = $post->{$post_taxonomy};
1109
+	$post_type_info = get_post_type_object($post_type);
1110
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1111
+
1112
+	if (!empty($post->post_tags)) {
1113
+
1114
+		if (taxonomy_exists($post_type . '_tags')):
1115
+			$links = array();
1116
+			$terms = array();
1117
+			// to limit post tags
1118
+			$post_tags = trim($post->post_tags, ",");
1119
+			$post_id = isset($post->ID) ? $post->ID : '';
1120
+			/**
1121
+			 * Filter the post tags.
1122
+			 *
1123
+			 * Allows you to filter the post tags output on the details page of a post.
1124
+			 *
1125
+			 * @since 1.0.0
1126
+			 * @param string $post_tags A comma seperated list of tags.
1127
+			 * @param int $post_id The current post id.
1128
+			 */
1129
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1130
+
1131
+			$post->post_tags = $post_tags;
1132
+			$post_tags = explode(",", trim($post->post_tags, ","));
1133
+
1134
+
1135
+			foreach ($post_tags as $post_term) {
1136
+
1137
+				// fix slug creation order for tags & location
1138
+				$post_term = trim($post_term);
1139
+
1140
+				$priority_location = false;
1141
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1142
+					$term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1143
+				} else {
1144
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1145
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1146
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1147
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1148
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1149
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1150
+					if ($match_country || $match_region || $match_city) {
1151
+						$priority_location = true;
1152
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1153
+					} else {
1154
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1155
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1156
+					}
1157
+				}
1158
+
1159
+				if (!is_wp_error($term) && is_object($term)) {
1160
+
1161
+					// fix tag link on detail page
1162
+					if ($priority_location) {
1163
+
1164
+						$tag_link = "<a href=''>$post_term</a>";
1165
+						/**
1166
+						 * Filter the tag name on the details page.
1167
+						 *
1168
+						 * @since 1.5.6
1169
+						 * @param string $tag_link The tag link html.
1170
+						 * @param object $term The tag term object.
1171
+						 */
1172
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1173
+						$links[] = $tag_link;
1174
+					} else {
1175
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1176
+						/** This action is documented in geodirectory-template_actions.php */
1177
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1178
+						$links[] = $tag_link;
1179
+					}
1180
+					$terms[] = $term;
1181
+				}
1182
+				//
1183
+			}
1184
+			if (!isset($listing_label)) {
1185
+				$listing_label = '';
1186
+			}
1187
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1188
+		endif;
1189
+
1190
+	}
1191
+
1192
+	if (!empty($post->{$post_taxonomy})) {
1193
+		$links = array();
1194
+		$terms = array();
1195
+		$termsOrdered = array();
1196
+		if (!is_array($post->{$post_taxonomy})) {
1197
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1198
+		} else {
1199
+			$post_term = $post->{$post_taxonomy};
1200 1200
 			
1201 1201
 			if ($preview && !$is_backend_preview) {
1202 1202
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1203 1203
 			}
1204
-        }
1205
-
1206
-        $post_term = array_unique($post_term);
1207
-        if (!empty($post_term)) {
1208
-            foreach ($post_term as $post_term) {
1209
-                $post_term = trim($post_term);
1210
-
1211
-                if ($post_term != ''):
1212
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1213
-
1214
-                    if (is_object($term)) {
1215
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1216
-                        /**
1217
-                         * Filter the category name on the details page.
1218
-                         *
1219
-                         * @since 1.5.6
1220
-                         * @param string $term_link The link html to the category.
1221
-                         * @param object $term The category term object.
1222
-                         */
1223
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1224
-                        $links[] = $term_link;
1225
-                        $terms[] = $term;
1226
-                    }
1227
-                endif;
1228
-            }
1229
-            // order alphabetically
1230
-            asort($links);
1231
-            foreach (array_keys($links) as $key) {
1232
-                $termsOrdered[$key] = $terms[$key];
1233
-            }
1234
-            $terms = $termsOrdered;
1204
+		}
1205
+
1206
+		$post_term = array_unique($post_term);
1207
+		if (!empty($post_term)) {
1208
+			foreach ($post_term as $post_term) {
1209
+				$post_term = trim($post_term);
1210
+
1211
+				if ($post_term != ''):
1212
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1213
+
1214
+					if (is_object($term)) {
1215
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1216
+						/**
1217
+						 * Filter the category name on the details page.
1218
+						 *
1219
+						 * @since 1.5.6
1220
+						 * @param string $term_link The link html to the category.
1221
+						 * @param object $term The category term object.
1222
+						 */
1223
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1224
+						$links[] = $term_link;
1225
+						$terms[] = $term;
1226
+					}
1227
+				endif;
1228
+			}
1229
+			// order alphabetically
1230
+			asort($links);
1231
+			foreach (array_keys($links) as $key) {
1232
+				$termsOrdered[$key] = $terms[$key];
1233
+			}
1234
+			$terms = $termsOrdered;
1235 1235
 
1236
-        }
1236
+		}
1237 1237
 
1238
-        if (!isset($listing_label)) {
1239
-            $listing_label = '';
1240
-        }
1241
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1238
+		if (!isset($listing_label)) {
1239
+			$listing_label = '';
1240
+		}
1241
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1242 1242
 
1243
-    }
1243
+	}
1244 1244
 
1245
-    /**
1246
-     * Filter the taxonomies array before output.
1247
-     *
1248
-     * @since 1.5.9
1249
-     * @param array $taxonomies The array of cats and tags.
1250
-     * @param string $post_type The post type being output.
1251
-     * @param string $listing_label The post type label.
1252
-     * @param string $listing_label The post type label with ucwords function.
1253
-     */
1254
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1245
+	/**
1246
+	 * Filter the taxonomies array before output.
1247
+	 *
1248
+	 * @since 1.5.9
1249
+	 * @param array $taxonomies The array of cats and tags.
1250
+	 * @param string $post_type The post type being output.
1251
+	 * @param string $listing_label The post type label.
1252
+	 * @param string $listing_label The post type label with ucwords function.
1253
+	 */
1254
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1255 1255
 
1256
-    if (isset($taxonomies[$post_taxonomy])) {
1257
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1258
-    }
1256
+	if (isset($taxonomies[$post_taxonomy])) {
1257
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1258
+	}
1259 1259
 
1260
-    if (isset($taxonomies[$post_type . '_tags']))
1261
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1260
+	if (isset($taxonomies[$post_type . '_tags']))
1261
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1262 1262
 
1263
-    ?>
1263
+	?>
1264 1264
     </p><?php
1265 1265
 }
1266 1266
 
@@ -1282,127 +1282,127 @@  discard block
 block discarded – undo
1282 1282
 function geodir_action_details_micordata($post='')
1283 1283
 {
1284 1284
 
1285
-    global $preview;
1286
-    if(empty($post)){global $post;}
1287
-    if ($preview || !geodir_is_page('detail')) {
1288
-        return;
1289
-    }
1290
-
1291
-    // url
1292
-    $c_url = geodir_curPageURL();
1293
-
1294
-    // post reviews
1295
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1296
-    if (empty($post_reviews)) {
1297
-        $reviews = '';
1298
-    } else {
1299
-        foreach ($post_reviews as $review) {
1300
-            $reviews[] = array(
1301
-                "@type" => "Review",
1302
-                "author" => $review->comment_author,
1303
-                "datePublished" => $review->comment_date,
1304
-                "description" => $review->comment_content,
1305
-                "reviewRating" => array(
1306
-                    "@type" => "Rating",
1307
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1308
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1309
-                    "worstRating" => "1"
1310
-                )
1311
-            );
1312
-        }
1313
-
1314
-    }
1315
-
1316
-    // post images
1317
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1318
-    if (empty($post_images)) {
1319
-        $images = '';
1320
-    } else {
1321
-        $i_arr = array();
1322
-        foreach ($post_images as $img) {
1323
-            $i_arr[] = $img->src;
1324
-        }
1325
-
1326
-        if (count($i_arr) == 1) {
1327
-            $images = $i_arr[0];
1328
-        } else {
1329
-            $images = $i_arr;
1330
-        }
1331
-
1332
-    }
1333
-    //print_r($post);
1334
-    // external links
1335
-    $external_links =  array();
1336
-    $external_links[] = $post->geodir_website;
1337
-    $external_links[] = $post->geodir_twitter;
1338
-    $external_links[] = $post->geodir_facebook;
1339
-    $external_links = array_filter($external_links);
1340
-
1341
-    if(!empty($external_links)){
1342
-        $external_links = array_values($external_links);
1343
-    }
1344
-
1345
-    // reviews
1346
-    $comment_count = geodir_get_review_count_total($post->ID);
1347
-    $post_avgratings = geodir_get_post_rating($post->ID);
1348
-
1349
-    // schema type
1350
-    $schema_type = 'LocalBusiness';
1351
-    if(isset($post->default_category) && $post->default_category){
1352
-        $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1353
-        if($cat_schema){$schema_type = $cat_schema;}
1354
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1355
-    }
1356
-
1357
-    $schema = array();
1358
-    $schema['@context'] = "http://schema.org";
1359
-    $schema['@type'] = $schema_type;
1360
-    $schema['name'] = $post->post_name;
1361
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1362
-    $schema['telephone'] = $post->geodir_contact;
1363
-    $schema['url'] = $c_url;
1364
-    $schema['sameAs'] = $external_links;
1365
-    $schema['image'] = $images;
1366
-    $schema['address'] = array(
1367
-        "@type" => "PostalAddress",
1368
-        "streetAddress" => $post->post_address,
1369
-        "addressLocality" => $post->post_city,
1370
-        "addressRegion" => $post->post_region,
1371
-        "addressCountry" => $post->post_country,
1372
-        "postalCode" => $post->post_zip
1373
-    );
1374
-
1375
-    if($post->post_latitude && $post->post_longitude) {
1376
-        $schema['geo'] = array(
1377
-            "@type" => "GeoCoordinates",
1378
-            "latitude" => $post->post_latitude,
1379
-            "longitude" => $post->post_longitude
1380
-        );
1381
-    }
1382
-
1383
-    if($post_avgratings) {
1384
-        $schema['aggregateRating'] = array(
1385
-            "@type" => "AggregateRating",
1386
-            "ratingValue" => $post_avgratings,
1387
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1388
-            "worstRating" => "1",
1389
-            "ratingCount" => $comment_count
1390
-        );
1391
-    }
1392
-    $schema['review'] = $reviews;
1393
-
1394
-    /**
1395
-     * Allow the schema JSON-LD info to be filtered.
1396
-     *
1397
-     * @since 1.5.4
1398
-     * @since 1.5.7 Added $post variable.
1399
-     * @param array $schema The array of schema data to be filtered.
1400
-     * @param object $post The post object.
1401
-     */
1402
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1403
-
1404
-
1405
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1285
+	global $preview;
1286
+	if(empty($post)){global $post;}
1287
+	if ($preview || !geodir_is_page('detail')) {
1288
+		return;
1289
+	}
1290
+
1291
+	// url
1292
+	$c_url = geodir_curPageURL();
1293
+
1294
+	// post reviews
1295
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1296
+	if (empty($post_reviews)) {
1297
+		$reviews = '';
1298
+	} else {
1299
+		foreach ($post_reviews as $review) {
1300
+			$reviews[] = array(
1301
+				"@type" => "Review",
1302
+				"author" => $review->comment_author,
1303
+				"datePublished" => $review->comment_date,
1304
+				"description" => $review->comment_content,
1305
+				"reviewRating" => array(
1306
+					"@type" => "Rating",
1307
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1308
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1309
+					"worstRating" => "1"
1310
+				)
1311
+			);
1312
+		}
1313
+
1314
+	}
1315
+
1316
+	// post images
1317
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1318
+	if (empty($post_images)) {
1319
+		$images = '';
1320
+	} else {
1321
+		$i_arr = array();
1322
+		foreach ($post_images as $img) {
1323
+			$i_arr[] = $img->src;
1324
+		}
1325
+
1326
+		if (count($i_arr) == 1) {
1327
+			$images = $i_arr[0];
1328
+		} else {
1329
+			$images = $i_arr;
1330
+		}
1331
+
1332
+	}
1333
+	//print_r($post);
1334
+	// external links
1335
+	$external_links =  array();
1336
+	$external_links[] = $post->geodir_website;
1337
+	$external_links[] = $post->geodir_twitter;
1338
+	$external_links[] = $post->geodir_facebook;
1339
+	$external_links = array_filter($external_links);
1340
+
1341
+	if(!empty($external_links)){
1342
+		$external_links = array_values($external_links);
1343
+	}
1344
+
1345
+	// reviews
1346
+	$comment_count = geodir_get_review_count_total($post->ID);
1347
+	$post_avgratings = geodir_get_post_rating($post->ID);
1348
+
1349
+	// schema type
1350
+	$schema_type = 'LocalBusiness';
1351
+	if(isset($post->default_category) && $post->default_category){
1352
+		$cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1353
+		if($cat_schema){$schema_type = $cat_schema;}
1354
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1355
+	}
1356
+
1357
+	$schema = array();
1358
+	$schema['@context'] = "http://schema.org";
1359
+	$schema['@type'] = $schema_type;
1360
+	$schema['name'] = $post->post_name;
1361
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1362
+	$schema['telephone'] = $post->geodir_contact;
1363
+	$schema['url'] = $c_url;
1364
+	$schema['sameAs'] = $external_links;
1365
+	$schema['image'] = $images;
1366
+	$schema['address'] = array(
1367
+		"@type" => "PostalAddress",
1368
+		"streetAddress" => $post->post_address,
1369
+		"addressLocality" => $post->post_city,
1370
+		"addressRegion" => $post->post_region,
1371
+		"addressCountry" => $post->post_country,
1372
+		"postalCode" => $post->post_zip
1373
+	);
1374
+
1375
+	if($post->post_latitude && $post->post_longitude) {
1376
+		$schema['geo'] = array(
1377
+			"@type" => "GeoCoordinates",
1378
+			"latitude" => $post->post_latitude,
1379
+			"longitude" => $post->post_longitude
1380
+		);
1381
+	}
1382
+
1383
+	if($post_avgratings) {
1384
+		$schema['aggregateRating'] = array(
1385
+			"@type" => "AggregateRating",
1386
+			"ratingValue" => $post_avgratings,
1387
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1388
+			"worstRating" => "1",
1389
+			"ratingCount" => $comment_count
1390
+		);
1391
+	}
1392
+	$schema['review'] = $reviews;
1393
+
1394
+	/**
1395
+	 * Allow the schema JSON-LD info to be filtered.
1396
+	 *
1397
+	 * @since 1.5.4
1398
+	 * @since 1.5.7 Added $post variable.
1399
+	 * @param array $schema The array of schema data to be filtered.
1400
+	 * @param object $post The post object.
1401
+	 */
1402
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1403
+
1404
+
1405
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1406 1406
 
1407 1407
 }
1408 1408
 
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
  */
1421 1421
 function geodir_action_details_next_prev()
1422 1422
 {
1423
-    ?>
1423
+	?>
1424 1424
     <div class="geodir-pos_navigation clearfix">
1425 1425
     <div
1426 1426
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1438,15 +1438,15 @@  discard block
 block discarded – undo
1438 1438
  */
1439 1439
 function geodir_action_before_single_post()
1440 1440
 {
1441
-    global $post;
1442
-    /**
1443
-     * Called at the very start of the details page output, before the title section.
1444
-     *
1445
-     * @since 1.0.0
1446
-     * @param object $post The current post object.
1447
-     * @global WP_Post|null $post The current post, if available.
1448
-     */
1449
-    do_action('geodir_before_single_post', $post); // extra action	
1441
+	global $post;
1442
+	/**
1443
+	 * Called at the very start of the details page output, before the title section.
1444
+	 *
1445
+	 * @since 1.0.0
1446
+	 * @param object $post The current post object.
1447
+	 * @global WP_Post|null $post The current post, if available.
1448
+	 */
1449
+	do_action('geodir_before_single_post', $post); // extra action	
1450 1450
 }
1451 1451
 
1452 1452
 /**
@@ -1457,13 +1457,13 @@  discard block
 block discarded – undo
1457 1457
  */
1458 1458
 function geodir_action_after_single_post($post)
1459 1459
 {
1460
-    /**
1461
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1462
-     *
1463
-     * @since 1.0.0
1464
-     * @param object $post The current post object.
1465
-     */
1466
-    do_action('geodir_after_single_post', $post); // extra action	
1460
+	/**
1461
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1462
+	 *
1463
+	 * @since 1.0.0
1464
+	 * @param object $post The current post object.
1465
+	 */
1466
+	do_action('geodir_after_single_post', $post); // extra action	
1467 1467
 }
1468 1468
 
1469 1469
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1489,167 +1489,167 @@  discard block
 block discarded – undo
1489 1489
  */
1490 1490
 function geodir_action_listings_title()
1491 1491
 {
1492
-    global $wp, $term;
1492
+	global $wp, $term;
1493 1493
 
1494
-    $gd_post_type = geodir_get_current_posttype();
1495
-    $post_type_info = get_post_type_object($gd_post_type);
1494
+	$gd_post_type = geodir_get_current_posttype();
1495
+	$post_type_info = get_post_type_object($gd_post_type);
1496 1496
 
1497
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1498
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1499
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1500
-    }
1497
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1498
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1499
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1500
+	}
1501 1501
 
1502
-    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1503
-    $single_name = $post_type_info->labels->singular_name;
1502
+	$list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1503
+	$single_name = $post_type_info->labels->singular_name;
1504 1504
 
1505
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1505
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1506 1506
 
1507
-    $gd_country = get_query_var('gd_country');
1508
-    $gd_region = get_query_var('gd_region');
1509
-    $gd_city = get_query_var('gd_city');
1507
+	$gd_country = get_query_var('gd_country');
1508
+	$gd_region = get_query_var('gd_region');
1509
+	$gd_city = get_query_var('gd_city');
1510 1510
 
1511
-    if (!empty($term)) {
1512
-        $location_name = '';
1513
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1514
-            if ($gd_country != '') {
1515
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1516
-            }
1517
-
1518
-            if ($gd_region != '') {
1519
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1520
-            }
1521
-
1522
-            if ($gd_city != '') {
1523
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1524
-            }
1525
-        }
1526
-
1527
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1528
-        if (!empty($current_term)) {
1529
-            $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1530
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1531
-                $location_last_char = substr($location_name, -1);
1532
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1533
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1534
-            } else {
1535
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1536
-            }
1537
-        } else {
1538
-            if (count($taxonomy) > 1) {
1539
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1540
-
1541
-                if (!empty($current_term)) {
1542
-                    $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1543
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1544
-                        $location_last_char = substr($location_name, -1);
1545
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1546
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1547
-                    } else {
1548
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1549
-                    }
1550
-                }
1551
-            }
1552
-        }
1553
-
1554
-    } else {
1555
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1556
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1557
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1558
-
1559
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1560
-
1561
-        if (function_exists('get_actual_location_name')) {
1562
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1563
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1564
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1565
-        }
1566
-
1567
-        if ($gd_city != '') {
1568
-            if ($gd_city_actual != '') {
1569
-                $gd_city = $gd_city_actual;
1570
-            } else {
1571
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1572
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1573
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1574
-            }
1575
-
1576
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1577
-        } else if ($gd_region != '') {
1578
-            if ($gd_region_actual != '') {
1579
-                $gd_region = $gd_region_actual;
1580
-            } else {
1581
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1582
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1583
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1584
-            }
1585
-
1586
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1587
-        } else if ($gd_country != '') {
1588
-            if ($gd_country_actual != '') {
1589
-                $gd_country = $gd_country_actual;
1590
-            } else {
1591
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1592
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1593
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1594
-            }
1595
-
1596
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1597
-        }
1598
-    }
1599
-
1600
-    if (is_search()) {
1601
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1602
-    }
1603
-    /** This action is documented in geodirectory_template_actions.php */
1604
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1605
-    /** This action is documented in geodirectory_template_actions.php */
1606
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1607
-
1608
-
1609
-    $title = $list_title;
1610
-    if(geodir_is_page('pt')){
1611
-        $gd_page = 'pt';
1612
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1613
-    }
1614
-    elseif(geodir_is_page('listing')){
1615
-        $gd_page = 'listing';
1616
-        global $wp_query;
1617
-        $current_term = $wp_query->get_queried_object();
1618
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1619
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1620
-        }else{
1621
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1622
-        }
1511
+	if (!empty($term)) {
1512
+		$location_name = '';
1513
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1514
+			if ($gd_country != '') {
1515
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1516
+			}
1623 1517
 
1624
-    }
1625
-    elseif(geodir_is_page('author')){
1626
-        $gd_page = 'author';
1627
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1628
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1629
-        }else{
1630
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1631
-        }
1518
+			if ($gd_region != '') {
1519
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1520
+			}
1632 1521
 
1633
-    }
1522
+			if ($gd_city != '') {
1523
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1524
+			}
1525
+		}
1526
+
1527
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1528
+		if (!empty($current_term)) {
1529
+			$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1530
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1531
+				$location_last_char = substr($location_name, -1);
1532
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1533
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1534
+			} else {
1535
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1536
+			}
1537
+		} else {
1538
+			if (count($taxonomy) > 1) {
1539
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1540
+
1541
+				if (!empty($current_term)) {
1542
+					$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1543
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1544
+						$location_last_char = substr($location_name, -1);
1545
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1546
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1547
+					} else {
1548
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1549
+					}
1550
+				}
1551
+			}
1552
+		}
1553
+
1554
+	} else {
1555
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1556
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1557
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1558
+
1559
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1560
+
1561
+		if (function_exists('get_actual_location_name')) {
1562
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1563
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1564
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1565
+		}
1566
+
1567
+		if ($gd_city != '') {
1568
+			if ($gd_city_actual != '') {
1569
+				$gd_city = $gd_city_actual;
1570
+			} else {
1571
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1572
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1573
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1574
+			}
1634 1575
 
1576
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1577
+		} else if ($gd_region != '') {
1578
+			if ($gd_region_actual != '') {
1579
+				$gd_region = $gd_region_actual;
1580
+			} else {
1581
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1582
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1583
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1584
+			}
1635 1585
 
1636
-    /**
1637
-     * Filter page title to replace variables.
1638
-     *
1639
-     * @since 1.5.4
1640
-     * @param string $title The page title including variables.
1641
-     * @param string $gd_page The GeoDirectory page type if any.
1642
-     */
1643
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1586
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1587
+		} else if ($gd_country != '') {
1588
+			if ($gd_country_actual != '') {
1589
+				$gd_country = $gd_country_actual;
1590
+			} else {
1591
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1592
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1593
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1594
+			}
1644 1595
 
1645
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1646
-        /**
1647
-         * Filter the listing page title.
1648
-         *
1649
-         * @since 1.0.0
1650
-         * @param string $list_title The title for the category page.
1651
-         */
1652
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1596
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1597
+		}
1598
+	}
1599
+
1600
+	if (is_search()) {
1601
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1602
+	}
1603
+	/** This action is documented in geodirectory_template_actions.php */
1604
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1605
+	/** This action is documented in geodirectory_template_actions.php */
1606
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1607
+
1608
+
1609
+	$title = $list_title;
1610
+	if(geodir_is_page('pt')){
1611
+		$gd_page = 'pt';
1612
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1613
+	}
1614
+	elseif(geodir_is_page('listing')){
1615
+		$gd_page = 'listing';
1616
+		global $wp_query;
1617
+		$current_term = $wp_query->get_queried_object();
1618
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1619
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1620
+		}else{
1621
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1622
+		}
1623
+
1624
+	}
1625
+	elseif(geodir_is_page('author')){
1626
+		$gd_page = 'author';
1627
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1628
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1629
+		}else{
1630
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1631
+		}
1632
+
1633
+	}
1634
+
1635
+
1636
+	/**
1637
+	 * Filter page title to replace variables.
1638
+	 *
1639
+	 * @since 1.5.4
1640
+	 * @param string $title The page title including variables.
1641
+	 * @param string $gd_page The GeoDirectory page type if any.
1642
+	 */
1643
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1644
+
1645
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1646
+		/**
1647
+		 * Filter the listing page title.
1648
+		 *
1649
+		 * @since 1.0.0
1650
+		 * @param string $list_title The title for the category page.
1651
+		 */
1652
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1653 1653
 }
1654 1654
 
1655 1655
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1662,46 +1662,46 @@  discard block
 block discarded – undo
1662 1662
  */
1663 1663
 function geodir_action_listings_description()
1664 1664
 {
1665
-    global $wp_query;
1666
-    $current_term = $wp_query->get_queried_object();
1665
+	global $wp_query;
1666
+	$current_term = $wp_query->get_queried_object();
1667 1667
 
1668
-    $gd_post_type = geodir_get_current_posttype();
1669
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1668
+	$gd_post_type = geodir_get_current_posttype();
1669
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1670 1670
 
1671
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1672
-        $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1673
-        if ($term_desc && !$saved_data) {
1674
-            $saved_data = $term_desc;
1675
-        }
1671
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1672
+		$saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1673
+		if ($term_desc && !$saved_data) {
1674
+			$saved_data = $term_desc;
1675
+		}
1676 1676
 
1677
-        // stop payment manager filtering content length
1678
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1679
-        if ( false !== $filter_priority ) {
1680
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1681
-        }
1677
+		// stop payment manager filtering content length
1678
+		$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1679
+		if ( false !== $filter_priority ) {
1680
+			remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1681
+		}
1682 1682
 
1683
-        /**
1684
-         * Apply the core filter `the_content` filter to the variable string.
1685
-         *
1686
-         * This is a WordPress core filter that does many things.
1687
-         *
1688
-         * @since 1.0.0
1689
-         * @param string $var The string to apply the filter to.
1690
-         */
1691
-        $cat_description = apply_filters('the_content', $saved_data);
1683
+		/**
1684
+		 * Apply the core filter `the_content` filter to the variable string.
1685
+		 *
1686
+		 * This is a WordPress core filter that does many things.
1687
+		 *
1688
+		 * @since 1.0.0
1689
+		 * @param string $var The string to apply the filter to.
1690
+		 */
1691
+		$cat_description = apply_filters('the_content', $saved_data);
1692 1692
 
1693 1693
 
1694
-        if ( false !== $filter_priority ) {
1695
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1696
-        }
1694
+		if ( false !== $filter_priority ) {
1695
+			add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1696
+		}
1697 1697
 
1698
-        if ($cat_description) {
1699
-            ?>
1698
+		if ($cat_description) {
1699
+			?>
1700 1700
 
1701 1701
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1702
-        }
1702
+		}
1703 1703
 
1704
-    }
1704
+	}
1705 1705
 }
1706 1706
 
1707 1707
 // action for adding the listings page top widget area
@@ -1720,11 +1720,11 @@  discard block
 block discarded – undo
1720 1720
  */
1721 1721
 function geodir_action_geodir_sidebar_listings_top()
1722 1722
 {
1723
-    if (get_option('geodir_show_listing_top_section')) { ?>
1723
+	if (get_option('geodir_show_listing_top_section')) { ?>
1724 1724
         <div
1725 1725
             class="<?php
1726
-            /** This action is documented in geodirectory_template_actions.php */
1727
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1726
+			/** This action is documented in geodirectory_template_actions.php */
1727
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1728 1728
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1729 1729
         </div><!-- clearfix ends here-->
1730 1730
     <?php }
@@ -1747,35 +1747,35 @@  discard block
 block discarded – undo
1747 1747
  */
1748 1748
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1749 1749
 {
1750
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1751
-        $width_css = 'style="width:' . $width . '%;"';
1752
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1753
-        $width_css = 'style="width:' . $width . '%;"';
1754
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1755
-        $width_css = 'style="width:' . $width . '%;"';
1756
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1757
-        $width_css = 'style="width:' . $width . '%;"';
1758
-    } else {
1759
-        $width_css = '';
1760
-    }
1761
-
1762
-    $tc = get_option('theme_compatibility_setting');
1763
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1764
-        $text = $tc['geodir_sidebar_left_open_replace'];
1765
-    } else {
1766
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1767
-    }
1768
-
1769
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1770
-        $id = $tc['geodir_sidebar_left_open_id'];
1771
-    }
1772
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1773
-        $class = $tc['geodir_sidebar_left_open_class'];
1774
-    }
1775
-
1776
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1777
-
1778
-    echo $text;
1750
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1751
+		$width_css = 'style="width:' . $width . '%;"';
1752
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1753
+		$width_css = 'style="width:' . $width . '%;"';
1754
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1755
+		$width_css = 'style="width:' . $width . '%;"';
1756
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1757
+		$width_css = 'style="width:' . $width . '%;"';
1758
+	} else {
1759
+		$width_css = '';
1760
+	}
1761
+
1762
+	$tc = get_option('theme_compatibility_setting');
1763
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1764
+		$text = $tc['geodir_sidebar_left_open_replace'];
1765
+	} else {
1766
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1767
+	}
1768
+
1769
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1770
+		$id = $tc['geodir_sidebar_left_open_id'];
1771
+	}
1772
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1773
+		$class = $tc['geodir_sidebar_left_open_class'];
1774
+	}
1775
+
1776
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1777
+
1778
+	echo $text;
1779 1779
 }
1780 1780
 
1781 1781
 // action for adding the primary div closing tag
@@ -1791,13 +1791,13 @@  discard block
 block discarded – undo
1791 1791
  */
1792 1792
 function geodir_action_sidebar_left_close($type = '')
1793 1793
 {
1794
-    $tc = get_option('theme_compatibility_setting');
1795
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1796
-        $text = $tc['geodir_sidebar_left_close_replace'];
1797
-    } else {
1798
-        $text = '</aside><!-- sidebar ends here-->';
1799
-    }
1800
-    echo $text;
1794
+	$tc = get_option('theme_compatibility_setting');
1795
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1796
+		$text = $tc['geodir_sidebar_left_close_replace'];
1797
+	} else {
1798
+		$text = '</aside><!-- sidebar ends here-->';
1799
+	}
1800
+	echo $text;
1801 1801
 }
1802 1802
 
1803 1803
 /**
@@ -1810,7 +1810,7 @@  discard block
 block discarded – undo
1810 1810
  */
1811 1811
 function geodir_listing_left_section()
1812 1812
 {
1813
-    if (get_option('geodir_show_listing_left_section')) { ?>
1813
+	if (get_option('geodir_show_listing_left_section')) { ?>
1814 1814
         <div class="geodir-content-left geodir-sidebar-wrap">
1815 1815
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1816 1816
         </div><!-- end geodir-content-left -->
@@ -1828,20 +1828,20 @@  discard block
 block discarded – undo
1828 1828
  */
1829 1829
 function geodir_action_listings_sidebar_left()
1830 1830
 {
1831
-    if (get_option('geodir_show_listing_left_section')) {
1832
-        /** This action is documented in geodirectory_template_actions.php */
1833
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1834
-        /**
1835
-         * Calls the listings page (category) left sidebar content.
1836
-         *
1837
-         * All the content for the listings page left sidebar is added via this hook.
1838
-         *
1839
-         * @since 1.0.0
1840
-         */
1841
-        do_action('geodir_listings_sidebar_left_inside');
1842
-        /** This action is documented in geodirectory_template_actions.php */
1843
-        do_action('geodir_sidebar_left_close', 'listings-page');
1844
-    }
1831
+	if (get_option('geodir_show_listing_left_section')) {
1832
+		/** This action is documented in geodirectory_template_actions.php */
1833
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1834
+		/**
1835
+		 * Calls the listings page (category) left sidebar content.
1836
+		 *
1837
+		 * All the content for the listings page left sidebar is added via this hook.
1838
+		 *
1839
+		 * @since 1.0.0
1840
+		 */
1841
+		do_action('geodir_listings_sidebar_left_inside');
1842
+		/** This action is documented in geodirectory_template_actions.php */
1843
+		do_action('geodir_sidebar_left_close', 'listings-page');
1844
+	}
1845 1845
 }
1846 1846
 
1847 1847
 /**
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
  */
1855 1855
 function geodir_listing_right_section()
1856 1856
 {
1857
-    if (get_option('geodir_show_listing_right_section')) { ?>
1857
+	if (get_option('geodir_show_listing_right_section')) { ?>
1858 1858
         <div class="geodir-content-right geodir-sidebar-wrap">
1859 1859
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1860 1860
         </div><!-- end geodir-content-right -->
@@ -1872,20 +1872,20 @@  discard block
 block discarded – undo
1872 1872
  */
1873 1873
 function geodir_action_listings_sidebar_right()
1874 1874
 {
1875
-    if (get_option('geodir_show_listing_right_section')) {
1876
-        /** This action is documented in geodirectory_template_actions.php */
1877
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1878
-        /**
1879
-         * Calls the listings page (category) right sidebar content.
1880
-         *
1881
-         * All the content for the listings page right sidebar is added via this hook.
1882
-         *
1883
-         * @since 1.0.0
1884
-         */
1885
-        do_action('geodir_listings_sidebar_right_inside');
1886
-        /** This action is documented in geodirectory_template_actions.php */
1887
-        do_action('geodir_sidebar_right_close', 'listings-page');
1888
-    }
1875
+	if (get_option('geodir_show_listing_right_section')) {
1876
+		/** This action is documented in geodirectory_template_actions.php */
1877
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1878
+		/**
1879
+		 * Calls the listings page (category) right sidebar content.
1880
+		 *
1881
+		 * All the content for the listings page right sidebar is added via this hook.
1882
+		 *
1883
+		 * @since 1.0.0
1884
+		 */
1885
+		do_action('geodir_listings_sidebar_right_inside');
1886
+		/** This action is documented in geodirectory_template_actions.php */
1887
+		do_action('geodir_sidebar_right_close', 'listings-page');
1888
+	}
1889 1889
 }
1890 1890
 
1891 1891
 
@@ -1902,23 +1902,23 @@  discard block
 block discarded – undo
1902 1902
  */
1903 1903
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1904 1904
 {
1905
-    $tc = get_option('theme_compatibility_setting');
1906
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1907
-        $text = $tc['geodir_main_content_open_replace'];
1908
-    } else {
1909
-        $text = '<main id="[id]" class="[class]" role="main">';
1910
-    }
1905
+	$tc = get_option('theme_compatibility_setting');
1906
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1907
+		$text = $tc['geodir_main_content_open_replace'];
1908
+	} else {
1909
+		$text = '<main id="[id]" class="[class]" role="main">';
1910
+	}
1911 1911
 
1912
-    if (!empty($tc['geodir_main_content_open_id'])) {
1913
-        $id = $tc['geodir_main_content_open_id'];
1914
-    }
1915
-    if (!empty($tc['geodir_main_content_open_class'])) {
1916
-        $class = $tc['geodir_main_content_open_class'];
1917
-    }
1912
+	if (!empty($tc['geodir_main_content_open_id'])) {
1913
+		$id = $tc['geodir_main_content_open_id'];
1914
+	}
1915
+	if (!empty($tc['geodir_main_content_open_class'])) {
1916
+		$class = $tc['geodir_main_content_open_class'];
1917
+	}
1918 1918
 
1919
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1919
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1920 1920
 
1921
-    echo $text;
1921
+	echo $text;
1922 1922
 }
1923 1923
 
1924 1924
 // action for adding the primary div closing tag
@@ -1931,13 +1931,13 @@  discard block
 block discarded – undo
1931 1931
  */
1932 1932
 function geodir_action_main_content_close()
1933 1933
 {
1934
-    $tc = get_option('theme_compatibility_setting');
1935
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1936
-        $text = $tc['geodir_main_content_close_replace'];
1937
-    } else {
1938
-        $text = '</main><!-- main ends here-->';
1939
-    }
1940
-    echo $text;
1934
+	$tc = get_option('theme_compatibility_setting');
1935
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1936
+		$text = $tc['geodir_main_content_close_replace'];
1937
+	} else {
1938
+		$text = '</main><!-- main ends here-->';
1939
+	}
1940
+	echo $text;
1941 1941
 }
1942 1942
 
1943 1943
 /**
@@ -1949,14 +1949,14 @@  discard block
 block discarded – undo
1949 1949
  */
1950 1950
 function geodir_action_listings_content_inside()
1951 1951
 {
1952
-    global $gridview_columns;
1953
-    $listing_view = get_option('geodir_listing_view');
1954
-    if (strstr($listing_view, 'gridview')) {
1955
-        $gridview_columns = $listing_view;
1956
-        $listing_view_exp = explode('_', $listing_view);
1957
-        $listing_view = $listing_view_exp[0];
1958
-    }
1959
-    geodir_get_template_part('listing', 'listview');
1952
+	global $gridview_columns;
1953
+	$listing_view = get_option('geodir_listing_view');
1954
+	if (strstr($listing_view, 'gridview')) {
1955
+		$gridview_columns = $listing_view;
1956
+		$listing_view_exp = explode('_', $listing_view);
1957
+		$listing_view = $listing_view_exp[0];
1958
+	}
1959
+	geodir_get_template_part('listing', 'listview');
1960 1960
 }
1961 1961
 
1962 1962
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1972,47 +1972,47 @@  discard block
 block discarded – undo
1972 1972
  */
1973 1973
 function geodir_action_listings_content()
1974 1974
 {
1975
-    /**
1976
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1977
-     *
1978
-     * @since 1.0.0
1979
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1980
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
1981
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1982
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1983
-     */
1984
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1985
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1986
-    echo '<div class="clearfix '.$extra_class.'">';
1987
-    /**
1988
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1989
-     *
1990
-     * @since 1.0.0
1991
-     */
1992
-    do_action('geodir_before_listing');
1993
-    echo '</div>';
1994
-
1995
-    /**
1996
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
1997
-     *
1998
-     * @since 1.0.0
1999
-     */
2000
-    do_action('geodir_listings_content_inside');
2001
-
2002
-    /**
2003
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2004
-     *
2005
-     * @since 1.0.0
2006
-     */
2007
-    do_action('geodir_after_listing');
2008
-
2009
-    /**
2010
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2011
-     *
2012
-     * @since 1.0.0
2013
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2014
-     */
2015
-    do_action('geodir_main_content_close', 'listings-page');
1975
+	/**
1976
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1977
+	 *
1978
+	 * @since 1.0.0
1979
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1980
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
1981
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1982
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1983
+	 */
1984
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1985
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1986
+	echo '<div class="clearfix '.$extra_class.'">';
1987
+	/**
1988
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1989
+	 *
1990
+	 * @since 1.0.0
1991
+	 */
1992
+	do_action('geodir_before_listing');
1993
+	echo '</div>';
1994
+
1995
+	/**
1996
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
1997
+	 *
1998
+	 * @since 1.0.0
1999
+	 */
2000
+	do_action('geodir_listings_content_inside');
2001
+
2002
+	/**
2003
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2004
+	 *
2005
+	 * @since 1.0.0
2006
+	 */
2007
+	do_action('geodir_after_listing');
2008
+
2009
+	/**
2010
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2011
+	 *
2012
+	 * @since 1.0.0
2013
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2014
+	 */
2015
+	do_action('geodir_main_content_close', 'listings-page');
2016 2016
 }
2017 2017
 
2018 2018
 
@@ -2027,10 +2027,10 @@  discard block
 block discarded – undo
2027 2027
  */
2028 2028
 function geodir_action_sidebar_listings_bottom_section()
2029 2029
 {
2030
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2030
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2031 2031
         <div class="<?php
2032
-            /** This action is documented in geodirectory_template_actions.php */
2033
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2032
+			/** This action is documented in geodirectory_template_actions.php */
2033
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2034 2034
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2035 2035
         </div><!-- clearfix ends here-->
2036 2036
     <?php }
@@ -2050,38 +2050,38 @@  discard block
 block discarded – undo
2050 2050
  */
2051 2051
 function geodir_action_add_listing_page_title()
2052 2052
 {
2053
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2054
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2055
-    /** This action is documented in geodirectory_template_actions.php */
2056
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2057
-    /** This action is documented in geodirectory_template_actions.php */
2058
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2059
-
2060
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2061
-
2062
-    if(geodir_is_page('add-listing')){
2063
-        $gd_page = 'add-listing';
2064
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2065
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2066
-        }elseif(isset($listing_type)){
2067
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2068
-        }
2053
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2054
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2055
+	/** This action is documented in geodirectory_template_actions.php */
2056
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2057
+	/** This action is documented in geodirectory_template_actions.php */
2058
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2059
+
2060
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2061
+
2062
+	if(geodir_is_page('add-listing')){
2063
+		$gd_page = 'add-listing';
2064
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2065
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2066
+		}elseif(isset($listing_type)){
2067
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2068
+		}
2069 2069
 
2070
-    }
2070
+	}
2071 2071
 
2072 2072
 
2073
-    /**
2074
-     * Filter page title to replace variables.
2075
-     *
2076
-     * @since 1.5.4
2077
-     * @param string $title The page title including variables.
2078
-     * @param string $gd_page The GeoDirectory page type if any.
2079
-     */
2080
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2073
+	/**
2074
+	 * Filter page title to replace variables.
2075
+	 *
2076
+	 * @since 1.5.4
2077
+	 * @param string $title The page title including variables.
2078
+	 * @param string $gd_page The GeoDirectory page type if any.
2079
+	 */
2080
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2081 2081
 
2082
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2083
-    echo $title;
2084
-    echo '</h1></header>';
2082
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2083
+	echo $title;
2084
+	echo '</h1></header>';
2085 2085
 }
2086 2086
 
2087 2087
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2112,59 +2112,59 @@  discard block
 block discarded – undo
2112 2112
  */
2113 2113
 function geodir_action_add_listing_form()
2114 2114
 {
2115
-    global $cat_display, $post_cat, $current_user, $gd_session;
2116
-    $page_id = get_the_ID();
2117
-    $post = '';
2118
-    $title = '';
2119
-    $desc = '';
2120
-    $kw_tags = '';
2121
-    $required_msg = '';
2122
-    $submit_button = '';
2123
-
2124
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2125
-
2126
-    $thumb_img_arr = array();
2127
-    $curImages = '';
2128
-
2129
-    if (isset($_REQUEST['backandedit'])) {
2130
-        global $post;
2131
-        $post = (object)$gd_session->get('listing');
2132
-        $listing_type = $post->listing_type;
2133
-        $title = $post->post_title;
2134
-        $desc = $post->post_desc;
2135
-        $post_cat = $post->post_category;
2136
-
2137
-        $kw_tags = $post->post_tags;
2138
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2139
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2140
-        global $post, $post_images;
2141
-
2142
-        $post = geodir_get_post_info($_REQUEST['pid']);
2143
-        $thumb_img_arr = geodir_get_images($post->ID);
2144
-        if ($thumb_img_arr) {
2145
-            foreach ($thumb_img_arr as $post_img) {
2146
-                $curImages .= $post_img->src . ',';
2147
-            }
2148
-        }
2115
+	global $cat_display, $post_cat, $current_user, $gd_session;
2116
+	$page_id = get_the_ID();
2117
+	$post = '';
2118
+	$title = '';
2119
+	$desc = '';
2120
+	$kw_tags = '';
2121
+	$required_msg = '';
2122
+	$submit_button = '';
2123
+
2124
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2125
+
2126
+	$thumb_img_arr = array();
2127
+	$curImages = '';
2128
+
2129
+	if (isset($_REQUEST['backandedit'])) {
2130
+		global $post;
2131
+		$post = (object)$gd_session->get('listing');
2132
+		$listing_type = $post->listing_type;
2133
+		$title = $post->post_title;
2134
+		$desc = $post->post_desc;
2135
+		$post_cat = $post->post_category;
2136
+
2137
+		$kw_tags = $post->post_tags;
2138
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2139
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2140
+		global $post, $post_images;
2141
+
2142
+		$post = geodir_get_post_info($_REQUEST['pid']);
2143
+		$thumb_img_arr = geodir_get_images($post->ID);
2144
+		if ($thumb_img_arr) {
2145
+			foreach ($thumb_img_arr as $post_img) {
2146
+				$curImages .= $post_img->src . ',';
2147
+			}
2148
+		}
2149 2149
 
2150
-        $listing_type = $post->post_type;
2151
-        $title = $post->post_title;
2152
-        $desc = $post->post_content;
2153
-        $kw_tags = $post->post_tags;
2154
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2155
-    } else {
2156
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2157
-    }
2150
+		$listing_type = $post->post_type;
2151
+		$title = $post->post_title;
2152
+		$desc = $post->post_content;
2153
+		$kw_tags = $post->post_tags;
2154
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2155
+	} else {
2156
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2157
+	}
2158 2158
 
2159
-    if ($current_user->ID != '0') {
2160
-        $user_login = true;
2161
-    }
2159
+	if ($current_user->ID != '0') {
2160
+		$user_login = true;
2161
+	}
2162 2162
 
2163
-    $post_type_info = geodir_get_posttype_info($listing_type);
2163
+	$post_type_info = geodir_get_posttype_info($listing_type);
2164 2164
 
2165
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
2165
+	$cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
2166 2166
 
2167
-    ?>
2167
+	?>
2168 2168
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2169 2169
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2170 2170
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2175,27 +2175,27 @@  discard block
 block discarded – undo
2175 2175
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2176 2176
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2177 2177
         <?php
2178
-        } 
2179
-        /**
2180
-         * Called at the very top of the add listing page form for frontend.
2181
-         *
2182
-         * This is called just before the "Enter Listing Details" text.
2183
-         *
2184
-         * @since 1.0.0
2185
-         */
2186
-        do_action('geodir_before_detail_fields');
2187
-        ?>
2178
+		} 
2179
+		/**
2180
+		 * Called at the very top of the add listing page form for frontend.
2181
+		 *
2182
+		 * This is called just before the "Enter Listing Details" text.
2183
+		 *
2184
+		 * @since 1.0.0
2185
+		 */
2186
+		do_action('geodir_before_detail_fields');
2187
+		?>
2188 2188
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2189 2189
         <?php
2190
-        /**
2191
-         * Called at the top of the add listing page form for frontend.
2192
-         *
2193
-         * This is called after the "Enter Listing Details" text.
2194
-         *
2195
-         * @since 1.0.0
2196
-         */
2197
-        do_action('geodir_before_main_form_fields');
2198
-        ?>
2190
+		/**
2191
+		 * Called at the top of the add listing page form for frontend.
2192
+		 *
2193
+		 * This is called after the "Enter Listing Details" text.
2194
+		 *
2195
+		 * @since 1.0.0
2196
+		 */
2197
+		do_action('geodir_before_main_form_fields');
2198
+		?>
2199 2199
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2200 2200
             <label><?php echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); ?><span>*</span> </label>
2201 2201
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
@@ -2203,57 +2203,57 @@  discard block
 block discarded – undo
2203 2203
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2204 2204
         </div>
2205 2205
         <?php
2206
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2207
-
2208
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2209
-        $desc_limit = '';
2210
-        /**
2211
-         * Filter the add listing description field character limit number.
2212
-         *
2213
-         * @since 1.0.0
2214
-         * @param int $desc_limit The amount of characters to limit the description to.
2215
-         */
2216
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2217
-        /**
2218
-         * Filter the add listing description field text.
2219
-         *
2220
-         * @since 1.0.0
2221
-         * @param string $desc The text for the description field.
2222
-         * @param int $desc_limit The character limit number if any.
2223
-         */
2224
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2225
-        $desc_limit_msg = '';
2226
-        /**
2227
-         * Filter the add listing description limit message.
2228
-         *
2229
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2230
-         *
2231
-         * @since 1.0.0
2232
-         * @param string $desc_limit_msg The limit message string if any.
2233
-         * @param int $desc_limit The character limit numer if any.
2234
-         */
2235
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2206
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2207
+
2208
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2209
+		$desc_limit = '';
2210
+		/**
2211
+		 * Filter the add listing description field character limit number.
2212
+		 *
2213
+		 * @since 1.0.0
2214
+		 * @param int $desc_limit The amount of characters to limit the description to.
2215
+		 */
2216
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2217
+		/**
2218
+		 * Filter the add listing description field text.
2219
+		 *
2220
+		 * @since 1.0.0
2221
+		 * @param string $desc The text for the description field.
2222
+		 * @param int $desc_limit The character limit number if any.
2223
+		 */
2224
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2225
+		$desc_limit_msg = '';
2226
+		/**
2227
+		 * Filter the add listing description limit message.
2228
+		 *
2229
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2230
+		 *
2231
+		 * @since 1.0.0
2232
+		 * @param string $desc_limit_msg The limit message string if any.
2233
+		 * @param int $desc_limit The character limit numer if any.
2234
+		 */
2235
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2236 2236
         
2237
-        $desc_class = '';
2238
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2239
-            /**
2240
-             * Called on the add listing page form for frontend just before the description field.
2241
-             *
2242
-             * @since 1.0.0
2243
-             */
2244
-            do_action('geodir_before_description_field');
2237
+		$desc_class = '';
2238
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2239
+			/**
2240
+			 * Called on the add listing page form for frontend just before the description field.
2241
+			 *
2242
+			 * @since 1.0.0
2243
+			 */
2244
+			do_action('geodir_before_description_field');
2245 2245
             
2246
-            $desc_class = ' required_field';
2247
-        } else {
2248
-            $desc_class = ' hidden';
2249
-        }
2250
-        ?>
2246
+			$desc_class = ' required_field';
2247
+		} else {
2248
+			$desc_class = ' hidden';
2249
+		}
2250
+		?>
2251 2251
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2252 2252
             <label><?php echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2253 2253
             <?php
2254
-            if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2255
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2256
-            ?>
2254
+			if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2255
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2256
+			?>
2257 2257
                 <div class="editor" field_id="post_desc" field_type="editor">
2258 2258
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2259 2259
                 </div>
@@ -2267,56 +2267,56 @@  discard block
 block discarded – undo
2267 2267
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2268 2268
         </div>
2269 2269
         <?php
2270
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2271
-            /**
2272
-             * Called on the add listing page form for frontend just after the description field.
2273
-             *
2274
-             * @since 1.0.0
2275
-             */
2276
-            do_action('geodir_after_description_field');
2277
-        }
2270
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2271
+			/**
2272
+			 * Called on the add listing page form for frontend just after the description field.
2273
+			 *
2274
+			 * @since 1.0.0
2275
+			 */
2276
+			do_action('geodir_after_description_field');
2277
+		}
2278 2278
         
2279
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2280
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2281
-        $kw_tags_msg = TAGKW_MSG;
2282
-        /**
2283
-         * Filter the add listing tags character limit.
2284
-         *
2285
-         * @since 1.0.0
2286
-         * @param int $kw_tags_count The character count limit if any.
2287
-         */
2288
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2289
-        /**
2290
-         * Filter the add listing tags field value.
2291
-         *
2292
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2293
-         *
2294
-         * @since 1.0.0
2295
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2296
-         * @param int $kw_tags_count The character count limit if any.
2297
-         */
2298
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2299
-        /**
2300
-         * Filter the add listing tags field message text.
2301
-         *
2302
-         * @since 1.0.0
2303
-         * @param string $kw_tags_msg The message shown under the field.
2304
-         * @param int $kw_tags_count The character count limit if any.
2305
-         */
2306
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2279
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2280
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2281
+		$kw_tags_msg = TAGKW_MSG;
2282
+		/**
2283
+		 * Filter the add listing tags character limit.
2284
+		 *
2285
+		 * @since 1.0.0
2286
+		 * @param int $kw_tags_count The character count limit if any.
2287
+		 */
2288
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2289
+		/**
2290
+		 * Filter the add listing tags field value.
2291
+		 *
2292
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2293
+		 *
2294
+		 * @since 1.0.0
2295
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2296
+		 * @param int $kw_tags_count The character count limit if any.
2297
+		 */
2298
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2299
+		/**
2300
+		 * Filter the add listing tags field message text.
2301
+		 *
2302
+		 * @since 1.0.0
2303
+		 * @param string $kw_tags_msg The message shown under the field.
2304
+		 * @param int $kw_tags_count The character count limit if any.
2305
+		 */
2306
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2307 2307
         
2308
-        $tags_class = '';
2309
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2310
-            /**
2311
-             * Called on the add listing page form for frontend just before the tags field.
2312
-             *
2313
-             * @since 1.0.0
2314
-             */
2315
-            do_action('geodir_before_listing_tags_field');
2316
-        } else {
2317
-            $tags_class = ' hidden';
2318
-        }
2319
-        ?>
2308
+		$tags_class = '';
2309
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2310
+			/**
2311
+			 * Called on the add listing page form for frontend just before the tags field.
2312
+			 *
2313
+			 * @since 1.0.0
2314
+			 */
2315
+			do_action('geodir_before_listing_tags_field');
2316
+		} else {
2317
+			$tags_class = ' hidden';
2318
+		}
2319
+		?>
2320 2320
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2321 2321
             <label><?php echo TAGKW_TEXT; ?></label>
2322 2322
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2324,90 +2324,90 @@  discard block
 block discarded – undo
2324 2324
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2325 2325
         </div>
2326 2326
         <?php
2327
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2328
-            /**
2329
-             * Called on the add listing page form for frontend just after the tags field.
2330
-             *
2331
-             * @since 1.0.0
2332
-             */
2333
-            do_action('geodir_after_listing_tags_field');
2334
-        }
2327
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2328
+			/**
2329
+			 * Called on the add listing page form for frontend just after the tags field.
2330
+			 *
2331
+			 * @since 1.0.0
2332
+			 */
2333
+			do_action('geodir_after_listing_tags_field');
2334
+		}
2335 2335
         
2336
-        $package_info = array();
2337
-        $package_info = geodir_post_package_info($package_info, $post);
2336
+		$package_info = array();
2337
+		$package_info = geodir_post_package_info($package_info, $post);
2338 2338
         
2339
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2339
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2340 2340
         
2341
-        // adjust values here
2342
-        $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2343
-
2344
-        $multiple = true; // allow multiple files upload
2341
+		// adjust values here
2342
+		$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2345 2343
 
2346
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2344
+		$multiple = true; // allow multiple files upload
2347 2345
 
2348
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2346
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2349 2347
 
2350
-        $thumb_img_arr = array();
2351
-        $totImg = 0;
2352
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2353
-            $post = (object)$gd_session->get('listing');
2354
-            if (isset($post->post_images))
2355
-                $curImages = trim($post->post_images, ",");
2348
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2356 2349
 
2350
+		$thumb_img_arr = array();
2351
+		$totImg = 0;
2352
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2353
+			$post = (object)$gd_session->get('listing');
2354
+			if (isset($post->post_images))
2355
+				$curImages = trim($post->post_images, ",");
2357 2356
 
2358
-            if ($curImages != '') {
2359
-                $curImages_array = explode(',', $curImages);
2360
-                $totImg = count($curImages_array);
2361
-            }
2362 2357
 
2363
-            $listing_type = $post->listing_type;
2358
+			if ($curImages != '') {
2359
+				$curImages_array = explode(',', $curImages);
2360
+				$totImg = count($curImages_array);
2361
+			}
2364 2362
 
2365
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2366
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2367
-            $listing_type = $post->post_type;
2368
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2363
+			$listing_type = $post->listing_type;
2369 2364
 
2370
-        } else {
2371
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2372
-        }
2365
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2366
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2367
+			$listing_type = $post->post_type;
2368
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2373 2369
 
2370
+		} else {
2371
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2372
+		}
2374 2373
 
2375
-        if (!empty($thumb_img_arr)) {
2376
-            foreach ($thumb_img_arr as $img) {
2377
-                //$curImages = $img->src.",";
2378
-            }
2379 2374
 
2380
-            $totImg = count((array)$thumb_img_arr);
2381
-        }
2375
+		if (!empty($thumb_img_arr)) {
2376
+			foreach ($thumb_img_arr as $img) {
2377
+				//$curImages = $img->src.",";
2378
+			}
2382 2379
 
2383
-        if ($curImages != '')
2384
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2385
-        else
2386
-            $svalue = '';
2387
-
2388
-        $image_limit = $package_info->image_limit;
2389
-        $show_image_input_box = ($image_limit != '0');
2390
-        /**
2391
-         * Filter to be able to show/hide the image upload section of the add listing form.
2392
-         *
2393
-         * @since 1.0.0
2394
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2395
-         * @param string $listing_type The custom post type slug.
2396
-         */
2397
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2398
-        if ($show_image_input_box) {
2399
-            ?>
2380
+			$totImg = count((array)$thumb_img_arr);
2381
+		}
2382
+
2383
+		if ($curImages != '')
2384
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2385
+		else
2386
+			$svalue = '';
2387
+
2388
+		$image_limit = $package_info->image_limit;
2389
+		$show_image_input_box = ($image_limit != '0');
2390
+		/**
2391
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2392
+		 *
2393
+		 * @since 1.0.0
2394
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2395
+		 * @param string $listing_type The custom post type slug.
2396
+		 */
2397
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2398
+		if ($show_image_input_box) {
2399
+			?>
2400 2400
 
2401 2401
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2402 2402
                 <?php if ($image_limit == 1) {
2403
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2404
-                } ?>
2403
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2404
+				} ?>
2405 2405
                 <?php if ($image_limit > 1) {
2406
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2407
-                } ?>
2406
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2407
+				} ?>
2408 2408
                 <?php if ($image_limit == '') {
2409
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2410
-                } ?>
2409
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2410
+				} ?>
2411 2411
             </h5>
2412 2412
 
2413 2413
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2445,12 +2445,12 @@  discard block
 block discarded – undo
2445 2445
         <?php } ?>
2446 2446
 
2447 2447
         <?php
2448
-        /**
2449
-         * Called on the add listing page form for frontend just after the image upload field.
2450
-         *
2451
-         * @since 1.0.0
2452
-         */
2453
-        do_action('geodir_after_main_form_fields');?>
2448
+		/**
2449
+		 * Called on the add listing page form for frontend just after the image upload field.
2450
+		 *
2451
+		 * @since 1.0.0
2452
+		 */
2453
+		do_action('geodir_after_main_form_fields');?>
2454 2454
 
2455 2455
 
2456 2456
         <!-- add captcha code -->
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
 
2480 2480
     </form>
2481 2481
     <?php
2482
-    wp_reset_query();
2482
+	wp_reset_query();
2483 2483
 }
2484 2484
 
2485 2485
 /**
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
  */
2491 2491
 function geodir_add_listing_sidebar_widget_area()
2492 2492
 {
2493
-    dynamic_sidebar('geodir_add_listing_sidebar');
2493
+	dynamic_sidebar('geodir_add_listing_sidebar');
2494 2494
 }
2495 2495
 
2496 2496
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2505,16 +2505,16 @@  discard block
 block discarded – undo
2505 2505
  */
2506 2506
 function geodir_action_add_listing_sidebar()
2507 2507
 {
2508
-    /** This action is documented in geodirectory_template_actions.php */
2509
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2510
-    /**
2511
-     * This is used to add the content to the add listing page sidebar.
2512
-     *
2513
-     * @since 1.0.0
2514
-     */
2515
-    do_action('geodir_add_listing_sidebar_inside');
2516
-    /** This action is documented in geodirectory_template_actions.php */
2517
-    do_action('geodir_sidebar_right_close', 'details-page');
2508
+	/** This action is documented in geodirectory_template_actions.php */
2509
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2510
+	/**
2511
+	 * This is used to add the content to the add listing page sidebar.
2512
+	 *
2513
+	 * @since 1.0.0
2514
+	 */
2515
+	do_action('geodir_add_listing_sidebar_inside');
2516
+	/** This action is documented in geodirectory_template_actions.php */
2517
+	do_action('geodir_sidebar_right_close', 'details-page');
2518 2518
 }
2519 2519
 
2520 2520
 ###############################################
@@ -2531,11 +2531,11 @@  discard block
 block discarded – undo
2531 2531
  */
2532 2532
 function geodir_action_geodir_sidebar_signup_top()
2533 2533
 {
2534
-    ?>
2534
+	?>
2535 2535
     <div
2536 2536
         class="<?php
2537
-        /** This action is documented in geodirectory_template_actions.php */
2538
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2537
+		/** This action is documented in geodirectory_template_actions.php */
2538
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2539 2539
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2540 2540
     </div><!-- clearfix ends here-->
2541 2541
 <?php
@@ -2554,9 +2554,9 @@  discard block
 block discarded – undo
2554 2554
 function geodir_action_signup_forms()
2555 2555
 {
2556 2556
 
2557
-    global $user_login;
2557
+	global $user_login;
2558 2558
 
2559
-    ?>
2559
+	?>
2560 2560
     <script type="text/javascript">
2561 2561
         <?php if ( $user_login ) { ?>
2562 2562
         setTimeout(function () {
@@ -2592,65 +2592,65 @@  discard block
 block discarded – undo
2592 2592
         <?php } ?>
2593 2593
     </script><?php
2594 2594
 
2595
-    global $errors;
2596
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2597
-        $errors->add('claim_login', LOGIN_CLAIM);
2598
-
2599
-    if (!empty($errors)) {
2600
-        foreach ($errors as $errorsObj) {
2601
-            foreach ($errorsObj as $key => $val) {
2602
-                for ($i = 0; $i < count($val); $i++) {
2603
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2604
-                    $registration_error_msg = 1;
2605
-                }
2606
-            }
2607
-        }
2608
-    }
2595
+	global $errors;
2596
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2597
+		$errors->add('claim_login', LOGIN_CLAIM);
2598
+
2599
+	if (!empty($errors)) {
2600
+		foreach ($errors as $errorsObj) {
2601
+			foreach ($errorsObj as $key => $val) {
2602
+				for ($i = 0; $i < count($val); $i++) {
2603
+					echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2604
+					$registration_error_msg = 1;
2605
+				}
2606
+			}
2607
+		}
2608
+	}
2609 2609
 
2610
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2611
-        ?>
2610
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2611
+		?>
2612 2612
 
2613 2613
         <div class="login_form">
2614 2614
             <?php
2615
-            /**
2616
-             * Contains login form template.
2617
-             *
2618
-             * @since 1.0.0
2619
-             */
2620
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2615
+			/**
2616
+			 * Contains login form template.
2617
+			 *
2618
+			 * @since 1.0.0
2619
+			 */
2620
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2621 2621
         </div>
2622 2622
 
2623 2623
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
2624 2624
 
2625 2625
         <div class="registration_form">
2626 2626
             <?php
2627
-            /**
2628
-             * Contains registration form template.
2629
-             *
2630
-             * @since 1.0.0
2631
-             */
2632
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2627
+			/**
2628
+			 * Contains registration form template.
2629
+			 *
2630
+			 * @since 1.0.0
2631
+			 */
2632
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2633 2633
         </div>
2634 2634
 
2635 2635
     <?php } else { ?>
2636 2636
 
2637 2637
         <div class="login_form_l">
2638 2638
             <?php
2639
-            /**
2640
-             * Contains login form template.
2641
-             *
2642
-             * @since 1.0.0
2643
-             */
2644
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2639
+			/**
2640
+			 * Contains login form template.
2641
+			 *
2642
+			 * @since 1.0.0
2643
+			 */
2644
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2645 2645
         </div>
2646 2646
         <div class="registration_form_r">
2647 2647
             <?php
2648
-            /**
2649
-             * Contains registration form template.
2650
-             *
2651
-             * @since 1.0.0
2652
-             */
2653
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2648
+			/**
2649
+			 * Contains registration form template.
2650
+			 *
2651
+			 * @since 1.0.0
2652
+			 */
2653
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2654 2654
         </div>
2655 2655
 
2656 2656
     <?php }?>
@@ -2681,66 +2681,66 @@  discard block
 block discarded – undo
2681 2681
  */
2682 2682
 function geodir_action_author_page_title()
2683 2683
 {
2684
-    global $term;
2684
+	global $term;
2685 2685
 
2686
-    $gd_post_type = geodir_get_current_posttype();
2687
-    $post_type_info = get_post_type_object($gd_post_type);
2686
+	$gd_post_type = geodir_get_current_posttype();
2687
+	$post_type_info = get_post_type_object($gd_post_type);
2688 2688
 
2689
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2690
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2691
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2692
-    }
2689
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2690
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2691
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2692
+	}
2693 2693
 
2694
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2695
-    $single_name = $post_type_info->labels->singular_name;
2694
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2695
+	$single_name = $post_type_info->labels->singular_name;
2696 2696
 
2697
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2697
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2698 2698
 
2699
-    if (!empty($term)) {
2700
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2701
-        if (!empty($current_term))
2702
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2703
-    }
2699
+	if (!empty($term)) {
2700
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2701
+		if (!empty($current_term))
2702
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2703
+	}
2704 2704
 
2705 2705
 
2706
-    if (is_search()) {
2707
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2706
+	if (is_search()) {
2707
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2708 2708
 
2709
-    }
2710
-    /** This action is documented in geodirectory_template_actions.php */
2711
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2712
-    /** This action is documented in geodirectory_template_actions.php */
2713
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2709
+	}
2710
+	/** This action is documented in geodirectory_template_actions.php */
2711
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2712
+	/** This action is documented in geodirectory_template_actions.php */
2713
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2714 2714
 
2715
-    $title = $list_title;
2716
-    if(geodir_is_page('author')){
2717
-        $gd_page = 'author';
2718
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2719
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2720
-        }else{
2721
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2722
-        }
2715
+	$title = $list_title;
2716
+	if(geodir_is_page('author')){
2717
+		$gd_page = 'author';
2718
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2719
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2720
+		}else{
2721
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2722
+		}
2723 2723
 
2724
-    }
2724
+	}
2725 2725
 
2726 2726
 
2727
-    /**
2728
-     * Filter page title to replace variables.
2729
-     *
2730
-     * @since 1.5.4
2731
-     * @param string $title The page title including variables.
2732
-     * @param string $gd_page The GeoDirectory page type if any.
2733
-     */
2734
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2727
+	/**
2728
+	 * Filter page title to replace variables.
2729
+	 *
2730
+	 * @since 1.5.4
2731
+	 * @param string $title The page title including variables.
2732
+	 * @param string $gd_page The GeoDirectory page type if any.
2733
+	 */
2734
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2735 2735
 
2736
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2737
-        /**
2738
-         * Filter the author page title text.
2739
-         *
2740
-         * @since 1.0.0
2741
-         * @param string $list_title The title for the page.
2742
-         */
2743
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2736
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2737
+		/**
2738
+		 * Filter the author page title text.
2739
+		 *
2740
+		 * @since 1.0.0
2741
+		 * @param string $list_title The title for the page.
2742
+		 */
2743
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2744 2744
 }
2745 2745
 
2746 2746
 
@@ -2758,11 +2758,11 @@  discard block
 block discarded – undo
2758 2758
  */
2759 2759
 function geodir_action_geodir_sidebar_author_top()
2760 2760
 {
2761
-    if (get_option('geodir_show_author_top_section')) { ?>
2761
+	if (get_option('geodir_show_author_top_section')) { ?>
2762 2762
         <div
2763 2763
             class="<?php
2764
-            /** This action is documented in geodirectory_template_actions.php */
2765
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2764
+			/** This action is documented in geodirectory_template_actions.php */
2765
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2766 2766
             <?php dynamic_sidebar('geodir_author_top'); ?>
2767 2767
         </div><!-- clearfix ends here-->
2768 2768
     <?php }
@@ -2778,7 +2778,7 @@  discard block
 block discarded – undo
2778 2778
  */
2779 2779
 function geodir_author_left_section()
2780 2780
 {
2781
-    if (get_option('geodir_show_author_left_section')) { ?>
2781
+	if (get_option('geodir_show_author_left_section')) { ?>
2782 2782
         <div class="geodir-content-left geodir-sidebar-wrap">
2783 2783
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2784 2784
         </div><!-- end geodir-content-left -->
@@ -2799,19 +2799,19 @@  discard block
 block discarded – undo
2799 2799
  */
2800 2800
 function geodir_action_author_sidebar_left()
2801 2801
 {
2802
-    if (get_option('geodir_show_author_left_section')) {
2802
+	if (get_option('geodir_show_author_left_section')) {
2803 2803
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2804
-        /** This action is documented in geodirectory_template_actions.php */
2805
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2806
-        /**
2807
-         * This is used to add the content to the author page left sidebar (if active).
2808
-         *
2809
-         * @since 1.0.0
2810
-         */
2811
-        do_action('geodir_author_sidebar_left_inside');
2812
-        /** This action is documented in geodirectory_template_actions.php */
2813
-        do_action('geodir_sidebar_left_close', 'author-page');
2814
-    }
2804
+		/** This action is documented in geodirectory_template_actions.php */
2805
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2806
+		/**
2807
+		 * This is used to add the content to the author page left sidebar (if active).
2808
+		 *
2809
+		 * @since 1.0.0
2810
+		 */
2811
+		do_action('geodir_author_sidebar_left_inside');
2812
+		/** This action is documented in geodirectory_template_actions.php */
2813
+		do_action('geodir_sidebar_left_close', 'author-page');
2814
+	}
2815 2815
 }
2816 2816
 
2817 2817
 /**
@@ -2824,7 +2824,7 @@  discard block
 block discarded – undo
2824 2824
  */
2825 2825
 function geodir_author_right_section()
2826 2826
 {
2827
-    if (get_option('geodir_show_author_right_section')) { ?>
2827
+	if (get_option('geodir_show_author_right_section')) { ?>
2828 2828
         <div class="geodir-content-right geodir-sidebar-wrap">
2829 2829
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2830 2830
         </div><!-- end geodir-content-right -->
@@ -2844,18 +2844,18 @@  discard block
 block discarded – undo
2844 2844
  */
2845 2845
 function geodir_action_author_sidebar_right()
2846 2846
 {
2847
-    if (get_option('geodir_show_author_right_section')) {
2848
-        /** This action is documented in geodirectory_template_actions.php */
2849
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2850
-        /**
2851
-         * This is used to add the content to the author page right sidebar (if active).
2852
-         *
2853
-         * @since 1.0.0
2854
-         */
2855
-        do_action('geodir_author_sidebar_right_inside');
2856
-        /** This action is documented in geodirectory_template_actions.php */
2857
-        do_action('geodir_sidebar_right_close', 'author-page');
2858
-    }
2847
+	if (get_option('geodir_show_author_right_section')) {
2848
+		/** This action is documented in geodirectory_template_actions.php */
2849
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2850
+		/**
2851
+		 * This is used to add the content to the author page right sidebar (if active).
2852
+		 *
2853
+		 * @since 1.0.0
2854
+		 */
2855
+		do_action('geodir_author_sidebar_right_inside');
2856
+		/** This action is documented in geodirectory_template_actions.php */
2857
+		do_action('geodir_sidebar_right_close', 'author-page');
2858
+	}
2859 2859
 }
2860 2860
 
2861 2861
 /**
@@ -2867,14 +2867,14 @@  discard block
 block discarded – undo
2867 2867
  */
2868 2868
 function geodir_action_author_content_inside()
2869 2869
 {
2870
-    global $gridview_columns;
2871
-    $listing_view = get_option('geodir_author_view');
2872
-    if (strstr($listing_view, 'gridview')) {
2873
-        $gridview_columns = $listing_view;
2874
-        $listing_view_exp = explode('_', $listing_view);
2875
-        $listing_view = $listing_view_exp[0];
2876
-    }
2877
-    geodir_get_template_part('listing', 'listview');
2870
+	global $gridview_columns;
2871
+	$listing_view = get_option('geodir_author_view');
2872
+	if (strstr($listing_view, 'gridview')) {
2873
+		$gridview_columns = $listing_view;
2874
+		$listing_view_exp = explode('_', $listing_view);
2875
+		$listing_view = $listing_view_exp[0];
2876
+	}
2877
+	geodir_get_template_part('listing', 'listview');
2878 2878
 }
2879 2879
 
2880 2880
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2889,22 +2889,22 @@  discard block
 block discarded – undo
2889 2889
  */
2890 2890
 function geodir_action_author_content()
2891 2891
 {
2892
-    /** This action is documented in geodirectory_template_actions.php */
2893
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2894
-    echo '<div class="clearfix">';
2895
-    /** This action is documented in geodirectory_template_actions.php */
2896
-    do_action('geodir_before_listing');
2897
-    echo '</div>';
2898
-    /**
2899
-     * This is used to add the content to the author page main content.
2900
-     *
2901
-     * @since 1.0.0
2902
-     */
2903
-    do_action('geodir_author_content_inside');
2904
-    /** This action is documented in geodirectory_template_actions.php */
2905
-    do_action('geodir_after_listing');
2906
-    /** This action is documented in geodirectory_template_actions.php */
2907
-    do_action('geodir_main_content_close', 'author-page');
2892
+	/** This action is documented in geodirectory_template_actions.php */
2893
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2894
+	echo '<div class="clearfix">';
2895
+	/** This action is documented in geodirectory_template_actions.php */
2896
+	do_action('geodir_before_listing');
2897
+	echo '</div>';
2898
+	/**
2899
+	 * This is used to add the content to the author page main content.
2900
+	 *
2901
+	 * @since 1.0.0
2902
+	 */
2903
+	do_action('geodir_author_content_inside');
2904
+	/** This action is documented in geodirectory_template_actions.php */
2905
+	do_action('geodir_after_listing');
2906
+	/** This action is documented in geodirectory_template_actions.php */
2907
+	do_action('geodir_main_content_close', 'author-page');
2908 2908
 }
2909 2909
 
2910 2910
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2918,11 +2918,11 @@  discard block
 block discarded – undo
2918 2918
  */
2919 2919
 function geodir_action_sidebar_author_bottom_section()
2920 2920
 {
2921
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2921
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2922 2922
         <div
2923 2923
             class="<?php
2924
-            /** This action is documented in geodirectory_template_actions.php */
2925
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2924
+			/** This action is documented in geodirectory_template_actions.php */
2925
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2926 2926
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2927 2927
         </div><!-- clearfix ends here-->
2928 2928
     <?php }
@@ -2941,23 +2941,23 @@  discard block
 block discarded – undo
2941 2941
  */
2942 2942
 function geodir_action_search_page_title()
2943 2943
 {
2944
-    $gd_post_type = geodir_get_current_posttype();
2945
-    $post_type_info = get_post_type_object($gd_post_type);
2944
+	$gd_post_type = geodir_get_current_posttype();
2945
+	$post_type_info = get_post_type_object($gd_post_type);
2946 2946
 
2947
-    $pt_name = '';
2948
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2947
+	$pt_name = '';
2948
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2949 2949
 
2950
-    if (is_search()) {
2951
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2950
+	if (is_search()) {
2951
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2952 2952
 
2953
-    }
2954
-    /** This action is documented in geodirectory_template_actions.php */
2955
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2956
-    /** This action is documented in geodirectory_template_actions.php */
2957
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2958
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2959
-        /** This action is documented in geodirectory_template_actions.php */
2960
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2953
+	}
2954
+	/** This action is documented in geodirectory_template_actions.php */
2955
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2956
+	/** This action is documented in geodirectory_template_actions.php */
2957
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2958
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2959
+		/** This action is documented in geodirectory_template_actions.php */
2960
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2961 2961
 }
2962 2962
 
2963 2963
 // action for adding the listings page top widget area
@@ -2973,11 +2973,11 @@  discard block
 block discarded – undo
2973 2973
  */
2974 2974
 function geodir_action_geodir_sidebar_search_top()
2975 2975
 {
2976
-    if (get_option('geodir_show_search_top_section')) { ?>
2976
+	if (get_option('geodir_show_search_top_section')) { ?>
2977 2977
         <div
2978 2978
             class="<?php
2979
-            /** This action is documented in geodirectory_template_actions.php */
2980
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2979
+			/** This action is documented in geodirectory_template_actions.php */
2980
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2981 2981
             <?php dynamic_sidebar('geodir_search_top'); ?>
2982 2982
         </div><!-- clearfix ends here-->
2983 2983
     <?php }
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
  */
2994 2994
 function geodir_search_left_section()
2995 2995
 {
2996
-    if (get_option('geodir_show_search_left_section')) { ?>
2996
+	if (get_option('geodir_show_search_left_section')) { ?>
2997 2997
         <div class="geodir-content-left geodir-sidebar-wrap">
2998 2998
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
2999 2999
         </div><!-- end geodir-content-left -->
@@ -3013,19 +3013,19 @@  discard block
 block discarded – undo
3013 3013
  */
3014 3014
 function geodir_action_search_sidebar_left()
3015 3015
 {
3016
-    if (get_option('geodir_show_search_left_section')) {
3016
+	if (get_option('geodir_show_search_left_section')) {
3017 3017
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3018
-        /** This action is documented in geodirectory_template_actions.php */
3019
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3020
-        /**
3021
-         * This is used to add the content to the search page left sidebar (if active).
3022
-         *
3023
-         * @since 1.0.0
3024
-         */
3025
-        do_action('geodir_search_sidebar_left_inside');
3026
-        /** This action is documented in geodirectory_template_actions.php */
3027
-        do_action('geodir_sidebar_left_close', 'search-page');
3028
-    }
3018
+		/** This action is documented in geodirectory_template_actions.php */
3019
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3020
+		/**
3021
+		 * This is used to add the content to the search page left sidebar (if active).
3022
+		 *
3023
+		 * @since 1.0.0
3024
+		 */
3025
+		do_action('geodir_search_sidebar_left_inside');
3026
+		/** This action is documented in geodirectory_template_actions.php */
3027
+		do_action('geodir_sidebar_left_close', 'search-page');
3028
+	}
3029 3029
 }
3030 3030
 
3031 3031
 /**
@@ -3038,7 +3038,7 @@  discard block
 block discarded – undo
3038 3038
  */
3039 3039
 function geodir_search_right_section()
3040 3040
 {
3041
-    if (get_option('geodir_show_search_right_section')) { ?>
3041
+	if (get_option('geodir_show_search_right_section')) { ?>
3042 3042
         <div class="geodir-content-right geodir-sidebar-wrap">
3043 3043
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3044 3044
         </div><!-- end geodir-content-right -->
@@ -3058,18 +3058,18 @@  discard block
 block discarded – undo
3058 3058
  */
3059 3059
 function geodir_action_search_sidebar_right()
3060 3060
 {
3061
-    if (get_option('geodir_show_search_right_section')) {
3062
-        /** This action is documented in geodirectory_template_actions.php */
3063
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3064
-        /**
3065
-         * This is used to add the content to the search page right sidebar (if active).
3066
-         *
3067
-         * @since 1.0.0
3068
-         */
3069
-        do_action('geodir_search_sidebar_right_inside');
3070
-        /** This action is documented in geodirectory_template_actions.php */
3071
-        do_action('geodir_sidebar_right_close', 'search-page');
3072
-    }
3061
+	if (get_option('geodir_show_search_right_section')) {
3062
+		/** This action is documented in geodirectory_template_actions.php */
3063
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3064
+		/**
3065
+		 * This is used to add the content to the search page right sidebar (if active).
3066
+		 *
3067
+		 * @since 1.0.0
3068
+		 */
3069
+		do_action('geodir_search_sidebar_right_inside');
3070
+		/** This action is documented in geodirectory_template_actions.php */
3071
+		do_action('geodir_sidebar_right_close', 'search-page');
3072
+	}
3073 3073
 }
3074 3074
 
3075 3075
 
@@ -3084,11 +3084,11 @@  discard block
 block discarded – undo
3084 3084
  */
3085 3085
 function geodir_action_sidebar_search_bottom_section()
3086 3086
 {
3087
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3087
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3088 3088
         <div
3089 3089
             class="<?php
3090
-            /** This action is documented in geodirectory_template_actions.php */
3091
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3090
+			/** This action is documented in geodirectory_template_actions.php */
3091
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3092 3092
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3093 3093
         </div><!-- clearfix ends here-->
3094 3094
     <?php }
@@ -3103,14 +3103,14 @@  discard block
 block discarded – undo
3103 3103
  */
3104 3104
 function geodir_action_search_content_inside()
3105 3105
 {
3106
-    global $gridview_columns;
3107
-    $listing_view = get_option('geodir_search_view');
3108
-    if (strstr($listing_view, 'gridview')) {
3109
-        $gridview_columns = $listing_view;
3110
-        $listing_view_exp = explode('_', $listing_view);
3111
-        $listing_view = $listing_view_exp[0];
3112
-    }
3113
-    geodir_get_template_part('listing', 'listview');
3106
+	global $gridview_columns;
3107
+	$listing_view = get_option('geodir_search_view');
3108
+	if (strstr($listing_view, 'gridview')) {
3109
+		$gridview_columns = $listing_view;
3110
+		$listing_view_exp = explode('_', $listing_view);
3111
+		$listing_view = $listing_view_exp[0];
3112
+	}
3113
+	geodir_get_template_part('listing', 'listview');
3114 3114
 }
3115 3115
 
3116 3116
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3126,22 +3126,22 @@  discard block
 block discarded – undo
3126 3126
  */
3127 3127
 function geodir_action_search_content()
3128 3128
 {
3129
-    /** This action is documented in geodirectory_template_actions.php */
3130
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3131
-    echo '<div class="clearfix">';
3132
-    /** This action is documented in geodirectory_template_actions.php */
3133
-    do_action('geodir_before_listing');
3134
-    echo '</div>';
3135
-    /**
3136
-     * This is used to add the content to the search page main content.
3137
-     *
3138
-     * @since 1.0.0
3139
-     */
3140
-    do_action('geodir_search_content_inside');
3141
-    /** This action is documented in geodirectory_template_actions.php */
3142
-    do_action('geodir_after_listing');
3143
-    /** This action is documented in geodirectory_template_actions.php */
3144
-    do_action('geodir_main_content_close', 'search-page');
3129
+	/** This action is documented in geodirectory_template_actions.php */
3130
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3131
+	echo '<div class="clearfix">';
3132
+	/** This action is documented in geodirectory_template_actions.php */
3133
+	do_action('geodir_before_listing');
3134
+	echo '</div>';
3135
+	/**
3136
+	 * This is used to add the content to the search page main content.
3137
+	 *
3138
+	 * @since 1.0.0
3139
+	 */
3140
+	do_action('geodir_search_content_inside');
3141
+	/** This action is documented in geodirectory_template_actions.php */
3142
+	do_action('geodir_after_listing');
3143
+	/** This action is documented in geodirectory_template_actions.php */
3144
+	do_action('geodir_main_content_close', 'search-page');
3145 3145
 }
3146 3146
 
3147 3147
 ###############################################
@@ -3164,11 +3164,11 @@  discard block
 block discarded – undo
3164 3164
  */
3165 3165
 function geodir_action_geodir_sidebar_home_top()
3166 3166
 {
3167
-    if (get_option('geodir_show_home_top_section')) { ?>
3167
+	if (get_option('geodir_show_home_top_section')) { ?>
3168 3168
         <div
3169 3169
             class="<?php
3170
-            /** This action is documented in geodirectory_template_actions.php */
3171
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3170
+			/** This action is documented in geodirectory_template_actions.php */
3171
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3172 3172
             <?php dynamic_sidebar('geodir_home_top'); ?>
3173 3173
         </div><!-- clearfix ends here-->
3174 3174
     <?php }
@@ -3184,7 +3184,7 @@  discard block
 block discarded – undo
3184 3184
  */
3185 3185
 function geodir_home_left_section()
3186 3186
 {
3187
-    if (get_option('geodir_show_home_left_section')) { ?>
3187
+	if (get_option('geodir_show_home_left_section')) { ?>
3188 3188
         <div class="geodir-content-left geodir-sidebar-wrap">
3189 3189
             <?php dynamic_sidebar('geodir_home_left'); ?>
3190 3190
         </div><!-- end geodir-content-left -->
@@ -3206,19 +3206,19 @@  discard block
 block discarded – undo
3206 3206
  */
3207 3207
 function geodir_action_home_sidebar_left()
3208 3208
 {
3209
-    if (get_option('geodir_show_home_left_section')) {
3209
+	if (get_option('geodir_show_home_left_section')) {
3210 3210
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3211
-        /** This action is documented in geodirectory_template_actions.php */
3212
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3213
-        /**
3214
-         * This is used to add the content to the home page left sidebar (if active).
3215
-         *
3216
-         * @since 1.0.0
3217
-         */
3218
-        do_action('geodir_home_sidebar_left_inside');
3219
-        /** This action is documented in geodirectory_template_actions.php */
3220
-        do_action('geodir_sidebar_left_close', 'home-page');
3221
-    }
3211
+		/** This action is documented in geodirectory_template_actions.php */
3212
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3213
+		/**
3214
+		 * This is used to add the content to the home page left sidebar (if active).
3215
+		 *
3216
+		 * @since 1.0.0
3217
+		 */
3218
+		do_action('geodir_home_sidebar_left_inside');
3219
+		/** This action is documented in geodirectory_template_actions.php */
3220
+		do_action('geodir_sidebar_left_close', 'home-page');
3221
+	}
3222 3222
 }
3223 3223
 
3224 3224
 /**
@@ -3231,7 +3231,7 @@  discard block
 block discarded – undo
3231 3231
  */
3232 3232
 function geodir_home_right_section()
3233 3233
 {
3234
-    if (get_option('geodir_show_home_right_section')) { ?>
3234
+	if (get_option('geodir_show_home_right_section')) { ?>
3235 3235
         <div class="geodir-content-right geodir-sidebar-wrap">
3236 3236
             <?php dynamic_sidebar('geodir_home_right'); ?>
3237 3237
         </div><!-- end geodir-content-right -->
@@ -3252,18 +3252,18 @@  discard block
 block discarded – undo
3252 3252
  */
3253 3253
 function geodir_action_home_sidebar_right()
3254 3254
 {
3255
-    if (get_option('geodir_show_home_right_section')) {
3256
-        /** This action is documented in geodirectory_template_actions.php */
3257
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3258
-        /**
3259
-         * This is used to add the content to the home page right sidebar (if active).
3260
-         *
3261
-         * @since 1.0.0
3262
-         */
3263
-        do_action('geodir_home_sidebar_right_inside');
3264
-        /** This action is documented in geodirectory_template_actions.php */
3265
-        do_action('geodir_sidebar_right_close', 'home-page');
3266
-    }
3255
+	if (get_option('geodir_show_home_right_section')) {
3256
+		/** This action is documented in geodirectory_template_actions.php */
3257
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3258
+		/**
3259
+		 * This is used to add the content to the home page right sidebar (if active).
3260
+		 *
3261
+		 * @since 1.0.0
3262
+		 */
3263
+		do_action('geodir_home_sidebar_right_inside');
3264
+		/** This action is documented in geodirectory_template_actions.php */
3265
+		do_action('geodir_sidebar_right_close', 'home-page');
3266
+	}
3267 3267
 }
3268 3268
 
3269 3269
 /**
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
  */
3275 3275
 function geodir_action_home_content_inside()
3276 3276
 {
3277
-    dynamic_sidebar('geodir_home_content');
3277
+	dynamic_sidebar('geodir_home_content');
3278 3278
 }
3279 3279
 
3280 3280
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3289,28 +3289,28 @@  discard block
 block discarded – undo
3289 3289
  */
3290 3290
 function geodir_action_home_content()
3291 3291
 {
3292
-    /** This action is documented in geodirectory_template_actions.php */
3293
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3294
-    /**
3295
-     * This called before the home page main content.
3296
-     *
3297
-     * @since 1.0.0
3298
-     */
3299
-    do_action('geodir_before_home_content');
3300
-    /**
3301
-     * This is used to add the content to the home page main content.
3302
-     *
3303
-     * @since 1.0.0
3304
-     */
3305
-    do_action('geodir_home_content_inside');
3306
-    /**
3307
-     * This is called after the homepage main content.
3308
-     *
3309
-     * @since 1.0.0
3310
-     */
3311
-    do_action('geodir_after_home_content');
3312
-    /** This action is documented in geodirectory_template_actions.php */
3313
-    do_action('geodir_main_content_close', 'home-page');
3292
+	/** This action is documented in geodirectory_template_actions.php */
3293
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3294
+	/**
3295
+	 * This called before the home page main content.
3296
+	 *
3297
+	 * @since 1.0.0
3298
+	 */
3299
+	do_action('geodir_before_home_content');
3300
+	/**
3301
+	 * This is used to add the content to the home page main content.
3302
+	 *
3303
+	 * @since 1.0.0
3304
+	 */
3305
+	do_action('geodir_home_content_inside');
3306
+	/**
3307
+	 * This is called after the homepage main content.
3308
+	 *
3309
+	 * @since 1.0.0
3310
+	 */
3311
+	do_action('geodir_after_home_content');
3312
+	/** This action is documented in geodirectory_template_actions.php */
3313
+	do_action('geodir_main_content_close', 'home-page');
3314 3314
 }
3315 3315
 
3316 3316
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3325,11 +3325,11 @@  discard block
 block discarded – undo
3325 3325
  */
3326 3326
 function geodir_action_sidebar_home_bottom_section()
3327 3327
 {
3328
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3328
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3329 3329
         <div
3330 3330
             class="<?php
3331
-            /** This action is documented in geodirectory_template_actions.php */
3332
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3331
+			/** This action is documented in geodirectory_template_actions.php */
3332
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3333 3333
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3334 3334
         </div><!-- clearfix ends here-->
3335 3335
     <?php }
@@ -3357,13 +3357,13 @@  discard block
 block discarded – undo
3357 3357
  */
3358 3358
 function geodir_filter_listing_page_title($list_title)
3359 3359
 {
3360
-    if (is_search() && trim(get_search_query()) == '') {
3361
-        $gd_post_type = geodir_get_current_posttype();
3362
-        $post_type_info = get_post_type_object($gd_post_type);
3360
+	if (is_search() && trim(get_search_query()) == '') {
3361
+		$gd_post_type = geodir_get_current_posttype();
3362
+		$post_type_info = get_post_type_object($gd_post_type);
3363 3363
 
3364
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3365
-    }
3366
-    return $list_title;
3364
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3365
+	}
3366
+	return $list_title;
3367 3367
 }
3368 3368
 
3369 3369
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3378,61 +3378,61 @@  discard block
 block discarded – undo
3378 3378
  * @param string $gd_page The geodirectory page type. Default null.
3379 3379
  */
3380 3380
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3381
-    global $post;
3381
+	global $post;
3382 3382
         
3383
-    $gd_page_id = NULL;
3384
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3385
-        $gd_page_id = geodir_home_page_id();
3386
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3387
-        $gd_page_id = geodir_preview_page_id();
3388
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3389
-        $gd_page_id = geodir_add_listing_page_id();
3390
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3391
-        $gd_page_id = geodir_success_page_id();
3392
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3393
-        $gd_page_id = geodir_location_page_id();
3394
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3395
-        $gd_page_id = geodir_info_page_id();
3396
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3397
-        $gd_page_id = geodir_login_page_id();
3398
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3399
-        $gd_page_id = geodir_payment_checkout_page_id();
3400
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3401
-        $gd_page_id = geodir_payment_invoices_page_id();
3402
-    }
3383
+	$gd_page_id = NULL;
3384
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3385
+		$gd_page_id = geodir_home_page_id();
3386
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3387
+		$gd_page_id = geodir_preview_page_id();
3388
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3389
+		$gd_page_id = geodir_add_listing_page_id();
3390
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3391
+		$gd_page_id = geodir_success_page_id();
3392
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3393
+		$gd_page_id = geodir_location_page_id();
3394
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3395
+		$gd_page_id = geodir_info_page_id();
3396
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3397
+		$gd_page_id = geodir_login_page_id();
3398
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3399
+		$gd_page_id = geodir_payment_checkout_page_id();
3400
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3401
+		$gd_page_id = geodir_payment_invoices_page_id();
3402
+	}
3403 3403
     
3404
-    if (!$gd_page_id > 0) {
3405
-        return;
3406
-    }
3404
+	if (!$gd_page_id > 0) {
3405
+		return;
3406
+	}
3407 3407
     
3408
-    $display = 'before';
3409
-    /**
3410
-     * Filter the position to display the page content.
3411
-     *
3412
-     * @since 1.6.3
3413
-     *
3414
-     * @param string $display Position to add the post content.
3415
-     * @param string $gd_page The geodirectory page type.
3416
-     */
3417
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3408
+	$display = 'before';
3409
+	/**
3410
+	 * Filter the position to display the page content.
3411
+	 *
3412
+	 * @since 1.6.3
3413
+	 *
3414
+	 * @param string $display Position to add the post content.
3415
+	 * @param string $gd_page The geodirectory page type.
3416
+	 */
3417
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3418 3418
     
3419
-    if ($position !== $display) {
3420
-        return;
3421
-    }
3419
+	if ($position !== $display) {
3420
+		return;
3421
+	}
3422 3422
         
3423
-    $gd_post = $post;
3423
+	$gd_post = $post;
3424 3424
     
3425
-    setup_postdata(get_post($gd_page_id));
3425
+	setup_postdata(get_post($gd_page_id));
3426 3426
     
3427
-    if (get_the_content()) {
3428
-        ?>
3427
+	if (get_the_content()) {
3428
+		?>
3429 3429
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3430 3430
         <?php
3431
-    }
3431
+	}
3432 3432
     
3433
-    $post = $gd_post;
3434
-    if (!empty($gd_post) && is_object($gd_post)) {
3435
-        setup_postdata($gd_post);
3436
-    }
3433
+	$post = $gd_post;
3434
+	if (!empty($gd_post) && is_object($gd_post)) {
3435
+		setup_postdata($gd_post);
3436
+	}
3437 3437
 }
3438 3438
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
3439 3439
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
     //php
284 284
     if (!empty($tc['geodir_theme_compat_code'])) {
285
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
285
+        include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
286 286
     }
287 287
 
288 288
     //geodir_full_page_class
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
453 453
 {
454 454
     if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
-        $width_css = 'style="width:' . $width . '%;"';
455
+        $width_css = 'style="width:'.$width.'%;"';
456 456
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
-        $width_css = 'style="width:' . $width . '%;"';
457
+        $width_css = 'style="width:'.$width.'%;"';
458 458
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
-        $width_css = 'style="width:' . $width . '%;"';
459
+        $width_css = 'style="width:'.$width.'%;"';
460 460
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
-        $width_css = 'style="width:' . $width . '%;"';
461
+        $width_css = 'style="width:'.$width.'%;"';
462 462
     } else {
463 463
         $width_css = '';
464 464
     }
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
573 573
 {
574 574
     if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
-        $width_css = 'style="width:' . $width . '%;"';
575
+        $width_css = 'style="width:'.$width.'%;"';
576 576
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
-        $width_css = 'style="width:' . $width . '%;"';
577
+        $width_css = 'style="width:'.$width.'%;"';
578 578
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
-        $width_css = 'style="width:' . $width . '%;"';
579
+        $width_css = 'style="width:'.$width.'%;"';
580 580
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
-        $width_css = 'style="width:' . $width . '%;"';
581
+        $width_css = 'style="width:'.$width.'%;"';
582 582
     } else {
583 583
         $width_css = '';
584 584
     }
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
         }
677 677
     }
678 678
 
679
-    $post = (object)$_REQUEST;
679
+    $post = (object) $_REQUEST;
680 680
 
681 681
 
682 682
     if (isset($post->video)) {
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 
736 736
     $json = '{';
737 737
     $json .= '"post_preview": "1",';
738
-    $json .= '"t": "' . $json_title . '",';
739
-    $json .= '"lt": "' . $post_latitude . '",';
740
-    $json .= '"ln": "' . $post_longitude . '",';
741
-    $json .= '"i":"' . $term_icon . '"';
738
+    $json .= '"t": "'.$json_title.'",';
739
+    $json .= '"lt": "'.$post_latitude.'",';
740
+    $json .= '"ln": "'.$post_longitude.'",';
741
+    $json .= '"i":"'.$term_icon.'"';
742 742
     $json .= '}';
743 743
 
744 744
     $post->marker_json = $json;
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
      * @param string $class The class to use. Default is 'entry-header'.
966 966
      */
967 967
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
968
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>';
969 969
 }
970 970
 
971 971
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020 1020
 
1021 1021
                     if ($image && $width && $height) {
1022
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1022
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1023 1023
                     }
1024 1024
 
1025 1025
                     if (isset($image->src)) {
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
                         $image_title = isset($image->title) ? $image->title : '';
1033 1033
 
1034
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1034
+                        $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1035
+                        $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>';
1036
+                        $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>';
1037 1037
                         $slides++;
1038 1038
                     }
1039 1039
                 }
@@ -1052,10 +1052,10 @@  discard block
 block discarded – undo
1052 1052
                 } else {
1053 1053
                     $spacer_height = ((400 - $image->height) / 2);
1054 1054
                 }
1055
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1055
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
+                $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1057
+                $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
+                $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
1059 1059
                 $slides++;
1060 1060
             }
1061 1061
         }// endfore
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function geodir_action_details_taxonomies()
1092 1092
 {
1093
-    global $preview, $post;?>
1093
+    global $preview, $post; ?>
1094 1094
     <p class="geodir_post_taxomomies clearfix">
1095 1095
     <?php
1096 1096
     $taxonomies = array();
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
     if ($preview && !$is_backend_preview) {
1101 1101
         $post_type = $post->listing_type;
1102
-        $post_taxonomy = $post_type . 'category';
1102
+        $post_taxonomy = $post_type.'category';
1103 1103
         $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104 1104
     } else {
1105 1105
         $post_type = $post->post_type;
1106
-        $post_taxonomy = $post_type . 'category';
1106
+        $post_taxonomy = $post_type.'category';
1107 1107
     }
1108 1108
 //{	
1109 1109
     $post_type_info = get_post_type_object($post_type);
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 
1112 1112
     if (!empty($post->post_tags)) {
1113 1113
 
1114
-        if (taxonomy_exists($post_type . '_tags')):
1114
+        if (taxonomy_exists($post_type.'_tags')):
1115 1115
             $links = array();
1116 1116
             $terms = array();
1117 1117
             // to limit post tags
@@ -1138,8 +1138,8 @@  discard block
 block discarded – undo
1138 1138
                 $post_term = trim($post_term);
1139 1139
 
1140 1140
                 $priority_location = false;
1141
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1142
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1141
+                if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
1142
+                    $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
1143 1143
                 } else {
1144 1144
                     $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1145 1145
                     $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
@@ -1149,10 +1149,10 @@  discard block
 block discarded – undo
1149 1149
                     $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1150 1150
                     if ($match_country || $match_region || $match_city) {
1151 1151
                         $priority_location = true;
1152
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1152
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1153 1153
                     } else {
1154
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1155
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1154
+                        $insert_term = wp_insert_term($post_term, $post_type.'_tags');
1155
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1156 1156
                     }
1157 1157
                 }
1158 1158
 
@@ -1169,12 +1169,12 @@  discard block
 block discarded – undo
1169 1169
                          * @param string $tag_link The tag link html.
1170 1170
                          * @param object $term The tag term object.
1171 1171
                          */
1172
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1173 1173
                         $links[] = $tag_link;
1174 1174
                     } else {
1175
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
+                        $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>";
1176 1176
                         /** This action is documented in geodirectory-template_actions.php */
1177
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1178 1178
                         $links[] = $tag_link;
1179 1179
                     }
1180 1180
                     $terms[] = $term;
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
             if (!isset($listing_label)) {
1185 1185
                 $listing_label = '';
1186 1186
             }
1187
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1187
+            $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1188 1188
         endif;
1189 1189
 
1190 1190
     }
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
                     $term = get_term_by('id', $post_term, $post_taxonomy);
1213 1213
 
1214 1214
                     if (is_object($term)) {
1215
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
+                        $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>";
1216 1216
                         /**
1217 1217
                          * Filter the category name on the details page.
1218 1218
                          *
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
                          * @param string $term_link The link html to the category.
1221 1221
                          * @param object $term The category term object.
1222 1222
                          */
1223
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1224 1224
                         $links[] = $term_link;
1225 1225
                         $terms[] = $term;
1226 1226
                     }
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
         if (!isset($listing_label)) {
1239 1239
             $listing_label = '';
1240 1240
         }
1241
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1241
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1242 1242
 
1243 1243
     }
1244 1244
 
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
      * @param string $listing_label The post type label.
1252 1252
      * @param string $listing_label The post type label with ucwords function.
1253 1253
      */
1254
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1254
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1255 1255
 
1256 1256
     if (isset($taxonomies[$post_taxonomy])) {
1257
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1257
+        echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>';
1258 1258
     }
1259 1259
 
1260
-    if (isset($taxonomies[$post_type . '_tags']))
1261
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1260
+    if (isset($taxonomies[$post_type.'_tags']))
1261
+        echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>';
1262 1262
 
1263 1263
     ?>
1264 1264
     </p><?php
@@ -1279,11 +1279,11 @@  discard block
 block discarded – undo
1279 1279
  * @param object $post Optional. The post object or blank.
1280 1280
  * @package GeoDirectory
1281 1281
  */
1282
-function geodir_action_details_micordata($post='')
1282
+function geodir_action_details_micordata($post = '')
1283 1283
 {
1284 1284
 
1285 1285
     global $preview;
1286
-    if(empty($post)){global $post;}
1286
+    if (empty($post)) {global $post; }
1287 1287
     if ($preview || !geodir_is_page('detail')) {
1288 1288
         return;
1289 1289
     }
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
                 "description" => $review->comment_content,
1305 1305
                 "reviewRating" => array(
1306 1306
                     "@type" => "Rating",
1307
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1307
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1308 1308
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1309 1309
                     "worstRating" => "1"
1310 1310
                 )
@@ -1332,13 +1332,13 @@  discard block
 block discarded – undo
1332 1332
     }
1333 1333
     //print_r($post);
1334 1334
     // external links
1335
-    $external_links =  array();
1335
+    $external_links = array();
1336 1336
     $external_links[] = $post->geodir_website;
1337 1337
     $external_links[] = $post->geodir_twitter;
1338 1338
     $external_links[] = $post->geodir_facebook;
1339 1339
     $external_links = array_filter($external_links);
1340 1340
 
1341
-    if(!empty($external_links)){
1341
+    if (!empty($external_links)) {
1342 1342
         $external_links = array_values($external_links);
1343 1343
     }
1344 1344
 
@@ -1348,17 +1348,17 @@  discard block
 block discarded – undo
1348 1348
 
1349 1349
     // schema type
1350 1350
     $schema_type = 'LocalBusiness';
1351
-    if(isset($post->default_category) && $post->default_category){
1351
+    if (isset($post->default_category) && $post->default_category) {
1352 1352
         $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1353
-        if($cat_schema){$schema_type = $cat_schema;}
1354
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1353
+        if ($cat_schema) {$schema_type = $cat_schema; }
1354
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1355 1355
     }
1356 1356
 
1357 1357
     $schema = array();
1358 1358
     $schema['@context'] = "http://schema.org";
1359 1359
     $schema['@type'] = $schema_type;
1360 1360
     $schema['name'] = $post->post_name;
1361
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1361
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1362 1362
     $schema['telephone'] = $post->geodir_contact;
1363 1363
     $schema['url'] = $c_url;
1364 1364
     $schema['sameAs'] = $external_links;
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
         "postalCode" => $post->post_zip
1373 1373
     );
1374 1374
 
1375
-    if($post->post_latitude && $post->post_longitude) {
1375
+    if ($post->post_latitude && $post->post_longitude) {
1376 1376
         $schema['geo'] = array(
1377 1377
             "@type" => "GeoCoordinates",
1378 1378
             "latitude" => $post->post_latitude,
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
         );
1381 1381
     }
1382 1382
 
1383
-    if($post_avgratings) {
1383
+    if ($post_avgratings) {
1384 1384
         $schema['aggregateRating'] = array(
1385 1385
             "@type" => "AggregateRating",
1386 1386
             "ratingValue" => $post_avgratings,
@@ -1399,10 +1399,10 @@  discard block
 block discarded – undo
1399 1399
      * @param array $schema The array of schema data to be filtered.
1400 1400
      * @param object $post The post object.
1401 1401
      */
1402
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1402
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1403 1403
 
1404 1404
 
1405
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1405
+    echo '<script type="application/ld+json">'.json_encode($schema).'</script>';
1406 1406
 
1407 1407
 }
1408 1408
 
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
     ?>
1424 1424
     <div class="geodir-pos_navigation clearfix">
1425 1425
     <div
1426
-        class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
1426
+        class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
1427 1427
     <div
1428
-        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
1428
+        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
1429 1429
     </div><?php
1430 1430
 }
1431 1431
 
@@ -1494,12 +1494,12 @@  discard block
 block discarded – undo
1494 1494
     $gd_post_type = geodir_get_current_posttype();
1495 1495
     $post_type_info = get_post_type_object($gd_post_type);
1496 1496
 
1497
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1497
+    $add_string_in_title = __('All', 'geodirectory').' ';
1498 1498
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1499
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1499
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
1500 1500
     }
1501 1501
 
1502
-    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1502
+    $list_title = $add_string_in_title.__(ucfirst($post_type_info->labels->name), 'geodirectory');
1503 1503
     $single_name = $post_type_info->labels->singular_name;
1504 1504
 
1505 1505
     $taxonomy = geodir_get_taxonomies($gd_post_type, true);
@@ -1527,12 +1527,12 @@  discard block
 block discarded – undo
1527 1527
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
1528 1528
         if (!empty($current_term)) {
1529 1529
             $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1530
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1530
+            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1531 1531
                 $location_last_char = substr($location_name, -1);
1532 1532
                 $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1533
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1533
+                $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1534 1534
             } else {
1535
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1535
+                $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1536 1536
             }
1537 1537
         } else {
1538 1538
             if (count($taxonomy) > 1) {
@@ -1540,12 +1540,12 @@  discard block
 block discarded – undo
1540 1540
 
1541 1541
                 if (!empty($current_term)) {
1542 1542
                     $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1543
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1543
+                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1544 1544
                         $location_last_char = substr($location_name, -1);
1545 1545
                         $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1546
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1546
+                        $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1547 1547
                     } else {
1548
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1548
+                        $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1549 1549
                     }
1550 1550
                 }
1551 1551
             }
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
                 $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1574 1574
             }
1575 1575
 
1576
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1576
+            $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
1577 1577
         } else if ($gd_region != '') {
1578 1578
             if ($gd_region_actual != '') {
1579 1579
                 $gd_region = $gd_region_actual;
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
                 $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1584 1584
             }
1585 1585
 
1586
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1586
+            $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
1587 1587
         } else if ($gd_country != '') {
1588 1588
             if ($gd_country_actual != '') {
1589 1589
                 $gd_country = $gd_country_actual;
@@ -1593,12 +1593,12 @@  discard block
 block discarded – undo
1593 1593
                 $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1594 1594
             }
1595 1595
 
1596
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1596
+            $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
1597 1597
         }
1598 1598
     }
1599 1599
 
1600 1600
     if (is_search()) {
1601
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1601
+        $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
1602 1602
     }
1603 1603
     /** This action is documented in geodirectory_template_actions.php */
1604 1604
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
@@ -1607,26 +1607,26 @@  discard block
 block discarded – undo
1607 1607
 
1608 1608
 
1609 1609
     $title = $list_title;
1610
-    if(geodir_is_page('pt')){
1610
+    if (geodir_is_page('pt')) {
1611 1611
         $gd_page = 'pt';
1612
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1612
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1613 1613
     }
1614
-    elseif(geodir_is_page('listing')){
1614
+    elseif (geodir_is_page('listing')) {
1615 1615
         $gd_page = 'listing';
1616 1616
         global $wp_query;
1617 1617
         $current_term = $wp_query->get_queried_object();
1618
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1618
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1619 1619
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1620
-        }else{
1620
+        } else {
1621 1621
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1622 1622
         }
1623 1623
 
1624 1624
     }
1625
-    elseif(geodir_is_page('author')){
1625
+    elseif (geodir_is_page('author')) {
1626 1626
         $gd_page = 'author';
1627
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1627
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1628 1628
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1629
-        }else{
1629
+        } else {
1630 1630
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1631 1631
         }
1632 1632
 
@@ -1640,16 +1640,16 @@  discard block
 block discarded – undo
1640 1640
      * @param string $title The page title including variables.
1641 1641
      * @param string $gd_page The GeoDirectory page type if any.
1642 1642
      */
1643
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1643
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1644 1644
 
1645
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1645
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
1646 1646
         /**
1647 1647
          * Filter the listing page title.
1648 1648
          *
1649 1649
          * @since 1.0.0
1650 1650
          * @param string $list_title The title for the category page.
1651 1651
          */
1652
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1652
+        apply_filters('geodir_listing_page_title', $title).'</h1></header>';
1653 1653
 }
1654 1654
 
1655 1655
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1668,16 +1668,16 @@  discard block
 block discarded – undo
1668 1668
     $gd_post_type = geodir_get_current_posttype();
1669 1669
     if (isset($current_term->term_id) && $current_term->term_id != '') {
1670 1670
 
1671
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1671
+        $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags');
1672 1672
         $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1673 1673
         if ($term_desc && !$saved_data) {
1674 1674
             $saved_data = $term_desc;
1675 1675
         }
1676 1676
 
1677 1677
         // stop payment manager filtering content length
1678
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1679
-        if ( false !== $filter_priority ) {
1680
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1678
+        $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1679
+        if (false !== $filter_priority) {
1680
+            remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1681 1681
         }
1682 1682
 
1683 1683
         /**
@@ -1691,14 +1691,14 @@  discard block
 block discarded – undo
1691 1691
         $cat_description = apply_filters('the_content', $saved_data);
1692 1692
 
1693 1693
 
1694
-        if ( false !== $filter_priority ) {
1695
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1694
+        if (false !== $filter_priority) {
1695
+            add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1696 1696
         }
1697 1697
 
1698 1698
         if ($cat_description) {
1699 1699
             ?>
1700 1700
 
1701
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1701
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1702 1702
         }
1703 1703
 
1704 1704
     }
@@ -1748,13 +1748,13 @@  discard block
 block discarded – undo
1748 1748
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1749 1749
 {
1750 1750
     if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1751
-        $width_css = 'style="width:' . $width . '%;"';
1751
+        $width_css = 'style="width:'.$width.'%;"';
1752 1752
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1753
-        $width_css = 'style="width:' . $width . '%;"';
1753
+        $width_css = 'style="width:'.$width.'%;"';
1754 1754
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1755
-        $width_css = 'style="width:' . $width . '%;"';
1755
+        $width_css = 'style="width:'.$width.'%;"';
1756 1756
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1757
-        $width_css = 'style="width:' . $width . '%;"';
1757
+        $width_css = 'style="width:'.$width.'%;"';
1758 1758
     } else {
1759 1759
         $width_css = '';
1760 1760
     }
@@ -2059,11 +2059,11 @@  discard block
 block discarded – undo
2059 2059
 
2060 2060
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2061 2061
 
2062
-    if(geodir_is_page('add-listing')){
2062
+    if (geodir_is_page('add-listing')) {
2063 2063
         $gd_page = 'add-listing';
2064
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2064
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2065 2065
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2066
-        }elseif(isset($listing_type)){
2066
+        }elseif (isset($listing_type)) {
2067 2067
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2068 2068
         }
2069 2069
 
@@ -2077,9 +2077,9 @@  discard block
 block discarded – undo
2077 2077
      * @param string $title The page title including variables.
2078 2078
      * @param string $gd_page The GeoDirectory page type if any.
2079 2079
      */
2080
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2080
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2081 2081
 
2082
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2082
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">';
2083 2083
     echo $title;
2084 2084
     echo '</h1></header>';
2085 2085
 }
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
  */
2094 2094
 function geodir_action_add_listing_page_mandatory()
2095 2095
 {?>
2096
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2096
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2097 2097
 <?php
2098 2098
 }
2099 2099
 
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
 
2129 2129
     if (isset($_REQUEST['backandedit'])) {
2130 2130
         global $post;
2131
-        $post = (object)$gd_session->get('listing');
2131
+        $post = (object) $gd_session->get('listing');
2132 2132
         $listing_type = $post->listing_type;
2133 2133
         $title = $post->post_title;
2134 2134
         $desc = $post->post_desc;
@@ -2143,7 +2143,7 @@  discard block
 block discarded – undo
2143 2143
         $thumb_img_arr = geodir_get_images($post->ID);
2144 2144
         if ($thumb_img_arr) {
2145 2145
             foreach ($thumb_img_arr as $post_img) {
2146
-                $curImages .= $post_img->src . ',';
2146
+                $curImages .= $post_img->src.',';
2147 2147
             }
2148 2148
         }
2149 2149
 
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
         $title = $post->post_title;
2152 2152
         $desc = $post->post_content;
2153 2153
         $kw_tags = $post->post_tags;
2154
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2154
+        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
2155 2155
     } else {
2156 2156
         $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2157 2157
     }
@@ -2162,18 +2162,18 @@  discard block
 block discarded – undo
2162 2162
 
2163 2163
     $post_type_info = geodir_get_posttype_info($listing_type);
2164 2164
 
2165
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
2165
+    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing', 'geodirectory');
2166 2166
 
2167 2167
     ?>
2168
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2169
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2170
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2168
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2169
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2170
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2171 2171
         <?php if ($page_id) { ?>
2172
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2172
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2173 2173
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2174
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2174
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2175 2175
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2176
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2176
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2177 2177
         <?php
2178 2178
         } 
2179 2179
         /**
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
          */
2186 2186
         do_action('geodir_before_detail_fields');
2187 2187
         ?>
2188
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2188
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2189 2189
         <?php
2190 2190
         /**
2191 2191
          * Called at the top of the add listing page form for frontend.
@@ -2197,10 +2197,10 @@  discard block
 block discarded – undo
2197 2197
         do_action('geodir_before_main_form_fields');
2198 2198
         ?>
2199 2199
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2200
-            <label><?php echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); ?><span>*</span> </label>
2200
+            <label><?php echo sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name); ?><span>*</span> </label>
2201 2201
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2202 2202
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2203
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2203
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2204 2204
         </div>
2205 2205
         <?php
2206 2206
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2235,7 +2235,7 @@  discard block
 block discarded – undo
2235 2235
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2236 2236
         
2237 2237
         $desc_class = '';
2238
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2238
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2239 2239
             /**
2240 2240
              * Called on the add listing page form for frontend just before the description field.
2241 2241
              *
@@ -2248,8 +2248,8 @@  discard block
 block discarded – undo
2248 2248
             $desc_class = ' hidden';
2249 2249
         }
2250 2250
         ?>
2251
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2252
-            <label><?php echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2251
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2252
+            <label><?php echo sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2253 2253
             <?php
2254 2254
             if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2255 2255
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2258,16 +2258,16 @@  discard block
 block discarded – undo
2258 2258
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2259 2259
                 </div>
2260 2260
             <?php if ($desc_limit != '') { ?>
2261
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2261
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2262 2262
             <?php } } else { ?>
2263 2263
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2264 2264
             <?php } if ($desc_limit_msg != '') { ?>
2265 2265
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2266 2266
             <?php } ?>
2267
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2267
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2268 2268
         </div>
2269 2269
         <?php
2270
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2270
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2271 2271
             /**
2272 2272
              * Called on the add listing page form for frontend just after the description field.
2273 2273
              *
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2307 2307
         
2308 2308
         $tags_class = '';
2309
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2309
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2310 2310
             /**
2311 2311
              * Called on the add listing page form for frontend just before the tags field.
2312 2312
              *
@@ -2317,14 +2317,14 @@  discard block
 block discarded – undo
2317 2317
             $tags_class = ' hidden';
2318 2318
         }
2319 2319
         ?>
2320
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2320
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2321 2321
             <label><?php echo TAGKW_TEXT; ?></label>
2322 2322
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2323
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2324
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2323
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2324
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2325 2325
         </div>
2326 2326
         <?php
2327
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2327
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2328 2328
             /**
2329 2329
              * Called on the add listing page form for frontend just after the tags field.
2330 2330
              *
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
         $thumb_img_arr = array();
2351 2351
         $totImg = 0;
2352 2352
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2353
-            $post = (object)$gd_session->get('listing');
2353
+            $post = (object) $gd_session->get('listing');
2354 2354
             if (isset($post->post_images))
2355 2355
                 $curImages = trim($post->post_images, ",");
2356 2356
 
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
             $listing_type = $post->listing_type;
2364 2364
 
2365 2365
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2366
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2366
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2367 2367
             $listing_type = $post->post_type;
2368 2368
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2369 2369
 
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
                 //$curImages = $img->src.",";
2378 2378
             }
2379 2379
 
2380
-            $totImg = count((array)$thumb_img_arr);
2380
+            $totImg = count((array) $thumb_img_arr);
2381 2381
         }
2382 2382
 
2383 2383
         if ($curImages != '')
@@ -2398,15 +2398,15 @@  discard block
 block discarded – undo
2398 2398
         if ($show_image_input_box) {
2399 2399
             ?>
2400 2400
 
2401
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2401
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2402 2402
                 <?php if ($image_limit == 1) {
2403
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2403
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2404 2404
                 } ?>
2405 2405
                 <?php if ($image_limit > 1) {
2406
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2406
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2407 2407
                 } ?>
2408 2408
                 <?php if ($image_limit == '') {
2409
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2409
+                    echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2410 2410
                 } ?>
2411 2411
             </h5>
2412 2412
 
@@ -2421,11 +2421,11 @@  discard block
 block discarded – undo
2421 2421
                 <div
2422 2422
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2423 2423
                     id="<?php echo $id; ?>plupload-upload-ui">
2424
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2424
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2425 2425
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2426 2426
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2427 2427
                     <span class="ajaxnonceplu"
2428
-                          id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2428
+                          id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2429 2429
                     <?php if ($width && $height): ?>
2430 2430
                         <span class="plupload-resize"></span>
2431 2431
                         <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2439 2439
                 </div>
2440 2440
                 <span
2441
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2441
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2442 2442
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2443 2443
             </div>
2444 2444
 
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
          *
2451 2451
          * @since 1.0.0
2452 2452
          */
2453
-        do_action('geodir_after_main_form_fields');?>
2453
+        do_action('geodir_after_main_form_fields'); ?>
2454 2454
 
2455 2455
 
2456 2456
         <!-- add captcha code -->
@@ -2461,7 +2461,7 @@  discard block
 block discarded – undo
2461 2461
         </script>
2462 2462
         <noscript>
2463 2463
             <div>
2464
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2464
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2465 2465
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2466 2466
             </div>
2467 2467
         </noscript>
@@ -2471,10 +2471,10 @@  discard block
 block discarded – undo
2471 2471
         <!-- end captcha code -->
2472 2472
 
2473 2473
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2474
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2475
-                   class="geodir_button" <?php echo $submit_button;?>/>
2474
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2475
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2476 2476
             <span class="geodir_message_note"
2477
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2477
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2478 2478
         </div>
2479 2479
 
2480 2480
     </form>
@@ -2536,7 +2536,7 @@  discard block
 block discarded – undo
2536 2536
         class="<?php
2537 2537
         /** This action is documented in geodirectory_template_actions.php */
2538 2538
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2539
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2539
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2540 2540
     </div><!-- clearfix ends here-->
2541 2541
 <?php
2542 2542
 }
@@ -2558,7 +2558,7 @@  discard block
 block discarded – undo
2558 2558
 
2559 2559
     ?>
2560 2560
     <script type="text/javascript">
2561
-        <?php if ( $user_login ) { ?>
2561
+        <?php if ($user_login) { ?>
2562 2562
         setTimeout(function () {
2563 2563
             try {
2564 2564
                 d = document.getElementById('user_pass');
@@ -2575,7 +2575,7 @@  discard block
 block discarded – undo
2575 2575
         <?php } ?>
2576 2576
     </script>
2577 2577
     <script type="text/javascript">
2578
-        <?php if ( $user_login ) { ?>
2578
+        <?php if ($user_login) { ?>
2579 2579
         setTimeout(function () {
2580 2580
             try {
2581 2581
                 d = document.getElementById('user_pass');
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
         foreach ($errors as $errorsObj) {
2601 2601
             foreach ($errorsObj as $key => $val) {
2602 2602
                 for ($i = 0; $i < count($val); $i++) {
2603
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2603
+                    echo "<div class=error_msg_fix>".$val[$i].'</div>';
2604 2604
                     $registration_error_msg = 1;
2605 2605
                 }
2606 2606
             }
@@ -2617,7 +2617,7 @@  discard block
 block discarded – undo
2617 2617
              *
2618 2618
              * @since 1.0.0
2619 2619
              */
2620
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2620
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2621 2621
         </div>
2622 2622
 
2623 2623
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
              *
2630 2630
              * @since 1.0.0
2631 2631
              */
2632
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2632
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2633 2633
         </div>
2634 2634
 
2635 2635
     <?php } else { ?>
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
              *
2642 2642
              * @since 1.0.0
2643 2643
              */
2644
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2644
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2645 2645
         </div>
2646 2646
         <div class="registration_form_r">
2647 2647
             <?php
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
              *
2651 2651
              * @since 1.0.0
2652 2652
              */
2653
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2653
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2654 2654
         </div>
2655 2655
 
2656 2656
     <?php }?>
@@ -2686,12 +2686,12 @@  discard block
 block discarded – undo
2686 2686
     $gd_post_type = geodir_get_current_posttype();
2687 2687
     $post_type_info = get_post_type_object($gd_post_type);
2688 2688
 
2689
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2689
+    $add_string_in_title = __('All', 'geodirectory').' ';
2690 2690
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2691
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2691
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
2692 2692
     }
2693 2693
 
2694
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2694
+    $list_title = $add_string_in_title.$post_type_info->labels->name;
2695 2695
     $single_name = $post_type_info->labels->singular_name;
2696 2696
 
2697 2697
     $taxonomy = geodir_get_taxonomies($gd_post_type);
@@ -2699,12 +2699,12 @@  discard block
 block discarded – undo
2699 2699
     if (!empty($term)) {
2700 2700
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2701 2701
         if (!empty($current_term))
2702
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2702
+            $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
2703 2703
     }
2704 2704
 
2705 2705
 
2706 2706
     if (is_search()) {
2707
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2707
+        $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2708 2708
 
2709 2709
     }
2710 2710
     /** This action is documented in geodirectory_template_actions.php */
@@ -2713,11 +2713,11 @@  discard block
 block discarded – undo
2713 2713
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2714 2714
 
2715 2715
     $title = $list_title;
2716
-    if(geodir_is_page('author')){
2716
+    if (geodir_is_page('author')) {
2717 2717
         $gd_page = 'author';
2718
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2718
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2719 2719
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2720
-        }else{
2720
+        } else {
2721 2721
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2722 2722
         }
2723 2723
 
@@ -2731,16 +2731,16 @@  discard block
 block discarded – undo
2731 2731
      * @param string $title The page title including variables.
2732 2732
      * @param string $gd_page The GeoDirectory page type if any.
2733 2733
      */
2734
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2734
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2735 2735
 
2736
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2736
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2737 2737
         /**
2738 2738
          * Filter the author page title text.
2739 2739
          *
2740 2740
          * @since 1.0.0
2741 2741
          * @param string $list_title The title for the page.
2742 2742
          */
2743
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2743
+        apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
2744 2744
 }
2745 2745
 
2746 2746
 
@@ -2945,19 +2945,19 @@  discard block
 block discarded – undo
2945 2945
     $post_type_info = get_post_type_object($gd_post_type);
2946 2946
 
2947 2947
     $pt_name = '';
2948
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2948
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
2949 2949
 
2950 2950
     if (is_search()) {
2951
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2951
+        $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2952 2952
 
2953 2953
     }
2954 2954
     /** This action is documented in geodirectory_template_actions.php */
2955 2955
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2956 2956
     /** This action is documented in geodirectory_template_actions.php */
2957 2957
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2958
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2958
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2959 2959
         /** This action is documented in geodirectory_template_actions.php */
2960
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2960
+        apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
2961 2961
 }
2962 2962
 
2963 2963
 // action for adding the listings page top widget area
@@ -3361,7 +3361,7 @@  discard block
 block discarded – undo
3361 3361
         $gd_post_type = geodir_get_current_posttype();
3362 3362
         $post_type_info = get_post_type_object($gd_post_type);
3363 3363
 
3364
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3364
+        $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
3365 3365
     }
3366 3366
     return $list_title;
3367 3367
 }
@@ -3377,7 +3377,7 @@  discard block
 block discarded – undo
3377 3377
  * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'.
3378 3378
  * @param string $gd_page The geodirectory page type. Default null.
3379 3379
  */
3380
-function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3380
+function geodir_add_page_content($position = 'before', $gd_page = '') {
3381 3381
     global $post;
3382 3382
         
3383 3383
     $gd_page_id = NULL;
Please login to merge, or discard this patch.