Passed
Push — master ( a05170...33cec2 )
by Stiofan
13:33
created
geodirectory_template_actions.php 1 patch
Indentation   +1728 added lines, -1728 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,176 +1090,176 @@  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
-            foreach ($post_tags as $post_term) {
1135
-
1136
-                // fix slug creation order for tags & location
1137
-                $post_term = trim($post_term);
1138
-
1139
-                $priority_location = false;
1140
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1141
-                    $term = get_term_by('name', $post_term, $post_type . '_tags');
1142
-                } else {
1143
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1144
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1145
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1146
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1147
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1148
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1149
-                    if ($match_country || $match_region || $match_city) {
1150
-                        $priority_location = true;
1151
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1152
-                    } else {
1153
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1154
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1155
-                    }
1156
-                }
1157
-
1158
-                if (!is_wp_error($term) && is_object($term)) {
1159
-
1160
-                    // fix tag link on detail page
1161
-                    if ($priority_location) {
1162
-
1163
-                        $tag_link = "<a href=''>$post_term</a>";
1164
-                        /**
1165
-                         * Filter the tag name on the details page.
1166
-                         *
1167
-                         * @since 1.5.6
1168
-                         * @param string $tag_link The tag link html.
1169
-                         * @param object $term The tag term object.
1170
-                         */
1171
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
-                        $links[] = $tag_link;
1173
-                    } else {
1174
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
-                        /** This action is documented in geodirectory-template_actions.php */
1176
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
-                        $links[] = $tag_link;
1178
-                    }
1179
-                    $terms[] = $term;
1180
-                }
1181
-                //
1182
-            }
1183
-            if (!isset($listing_label)) {
1184
-                $listing_label = '';
1185
-            }
1186
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1187
-        endif;
1188
-
1189
-    }
1190
-
1191
-    if (!empty($post->{$post_taxonomy})) {
1192
-        $links = array();
1193
-        $terms = array();
1194
-        $termsOrdered = array();
1195
-        if (!is_array($post->{$post_taxonomy})) {
1196
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1197
-        } else {
1198
-            $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
+			foreach ($post_tags as $post_term) {
1135
+
1136
+				// fix slug creation order for tags & location
1137
+				$post_term = trim($post_term);
1138
+
1139
+				$priority_location = false;
1140
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1141
+					$term = get_term_by('name', $post_term, $post_type . '_tags');
1142
+				} else {
1143
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1144
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1145
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1146
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1147
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1148
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1149
+					if ($match_country || $match_region || $match_city) {
1150
+						$priority_location = true;
1151
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1152
+					} else {
1153
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1154
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1155
+					}
1156
+				}
1157
+
1158
+				if (!is_wp_error($term) && is_object($term)) {
1159
+
1160
+					// fix tag link on detail page
1161
+					if ($priority_location) {
1162
+
1163
+						$tag_link = "<a href=''>$post_term</a>";
1164
+						/**
1165
+						 * Filter the tag name on the details page.
1166
+						 *
1167
+						 * @since 1.5.6
1168
+						 * @param string $tag_link The tag link html.
1169
+						 * @param object $term The tag term object.
1170
+						 */
1171
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
+						$links[] = $tag_link;
1173
+					} else {
1174
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
+						/** This action is documented in geodirectory-template_actions.php */
1176
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
+						$links[] = $tag_link;
1178
+					}
1179
+					$terms[] = $term;
1180
+				}
1181
+				//
1182
+			}
1183
+			if (!isset($listing_label)) {
1184
+				$listing_label = '';
1185
+			}
1186
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1187
+		endif;
1188
+
1189
+	}
1190
+
1191
+	if (!empty($post->{$post_taxonomy})) {
1192
+		$links = array();
1193
+		$terms = array();
1194
+		$termsOrdered = array();
1195
+		if (!is_array($post->{$post_taxonomy})) {
1196
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1197
+		} else {
1198
+			$post_term = $post->{$post_taxonomy};
1199 1199
 			
1200 1200
 			if ($preview && !$is_backend_preview) {
1201 1201
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1202 1202
 			}
1203
-        }
1204
-
1205
-        $post_term = array_unique($post_term);
1206
-        if (!empty($post_term)) {
1207
-            foreach ($post_term as $post_term) {
1208
-                $post_term = trim($post_term);
1209
-
1210
-                if ($post_term != ''):
1211
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1212
-
1213
-                    if (is_object($term)) {
1214
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
-                        /**
1216
-                         * Filter the category name on the details page.
1217
-                         *
1218
-                         * @since 1.5.6
1219
-                         * @param string $term_link The link html to the category.
1220
-                         * @param object $term The category term object.
1221
-                         */
1222
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
-                        $links[] = $term_link;
1224
-                        $terms[] = $term;
1225
-                    }
1226
-                endif;
1227
-            }
1228
-            // order alphabetically
1229
-            asort($links);
1230
-            foreach (array_keys($links) as $key) {
1231
-                $termsOrdered[$key] = $terms[$key];
1232
-            }
1233
-            $terms = $termsOrdered;
1203
+		}
1204
+
1205
+		$post_term = array_unique($post_term);
1206
+		if (!empty($post_term)) {
1207
+			foreach ($post_term as $post_term) {
1208
+				$post_term = trim($post_term);
1209
+
1210
+				if ($post_term != ''):
1211
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1212
+
1213
+					if (is_object($term)) {
1214
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
+						/**
1216
+						 * Filter the category name on the details page.
1217
+						 *
1218
+						 * @since 1.5.6
1219
+						 * @param string $term_link The link html to the category.
1220
+						 * @param object $term The category term object.
1221
+						 */
1222
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
+						$links[] = $term_link;
1224
+						$terms[] = $term;
1225
+					}
1226
+				endif;
1227
+			}
1228
+			// order alphabetically
1229
+			asort($links);
1230
+			foreach (array_keys($links) as $key) {
1231
+				$termsOrdered[$key] = $terms[$key];
1232
+			}
1233
+			$terms = $termsOrdered;
1234 1234
 
1235
-        }
1235
+		}
1236 1236
 
1237
-        if (!isset($listing_label)) {
1238
-            $listing_label = '';
1239
-        }
1240
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1237
+		if (!isset($listing_label)) {
1238
+			$listing_label = '';
1239
+		}
1240
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1241 1241
 
1242
-    }
1242
+	}
1243 1243
 
1244
-    /**
1245
-     * Filter the taxonomies array before output.
1246
-     *
1247
-     * @since 1.5.9
1248
-     * @param array $taxonomies The array of cats and tags.
1249
-     * @param string $post_type The post type being output.
1250
-     * @param string $listing_label The post type label.
1251
-     * @param string $listing_label The post type label with ucwords function.
1252
-     */
1253
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1244
+	/**
1245
+	 * Filter the taxonomies array before output.
1246
+	 *
1247
+	 * @since 1.5.9
1248
+	 * @param array $taxonomies The array of cats and tags.
1249
+	 * @param string $post_type The post type being output.
1250
+	 * @param string $listing_label The post type label.
1251
+	 * @param string $listing_label The post type label with ucwords function.
1252
+	 */
1253
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1254 1254
 
1255
-    if (isset($taxonomies[$post_taxonomy])) {
1256
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1257
-    }
1255
+	if (isset($taxonomies[$post_taxonomy])) {
1256
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1257
+	}
1258 1258
 
1259
-    if (isset($taxonomies[$post_type . '_tags']))
1260
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1259
+	if (isset($taxonomies[$post_type . '_tags']))
1260
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1261 1261
 
1262
-    ?>
1262
+	?>
1263 1263
     </p><?php
1264 1264
 }
1265 1265
 
@@ -1281,127 +1281,127 @@  discard block
 block discarded – undo
1281 1281
 function geodir_action_details_micordata($post='')
1282 1282
 {
1283 1283
 
1284
-    global $preview;
1285
-    if(empty($post)){global $post;}
1286
-    if ($preview || !geodir_is_page('detail')) {
1287
-        return;
1288
-    }
1289
-
1290
-    // url
1291
-    $c_url = geodir_curPageURL();
1292
-
1293
-    // post reviews
1294
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1295
-    if (empty($post_reviews)) {
1296
-        $reviews = '';
1297
-    } else {
1298
-        foreach ($post_reviews as $review) {
1299
-            $reviews[] = array(
1300
-                "@type" => "Review",
1301
-                "author" => $review->comment_author,
1302
-                "datePublished" => $review->comment_date,
1303
-                "description" => $review->comment_content,
1304
-                "reviewRating" => array(
1305
-                    "@type" => "Rating",
1306
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1307
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1308
-                    "worstRating" => "1"
1309
-                )
1310
-            );
1311
-        }
1312
-
1313
-    }
1314
-
1315
-    // post images
1316
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1317
-    if (empty($post_images)) {
1318
-        $images = '';
1319
-    } else {
1320
-        $i_arr = array();
1321
-        foreach ($post_images as $img) {
1322
-            $i_arr[] = $img->src;
1323
-        }
1324
-
1325
-        if (count($i_arr) == 1) {
1326
-            $images = $i_arr[0];
1327
-        } else {
1328
-            $images = $i_arr;
1329
-        }
1330
-
1331
-    }
1332
-    //print_r($post);
1333
-    // external links
1334
-    $external_links =  array();
1335
-    $external_links[] = $post->geodir_website;
1336
-    $external_links[] = $post->geodir_twitter;
1337
-    $external_links[] = $post->geodir_facebook;
1338
-    $external_links = array_filter($external_links);
1339
-
1340
-    if(!empty($external_links)){
1341
-        $external_links = array_values($external_links);
1342
-    }
1343
-
1344
-    // reviews
1345
-    $comment_count = geodir_get_review_count_total($post->ID);
1346
-    $post_avgratings = geodir_get_post_rating($post->ID);
1347
-
1348
-    // schema type
1349
-    $schema_type = 'LocalBusiness';
1350
-    if(isset($post->default_category) && $post->default_category){
1351
-        $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1352
-        if($cat_schema){$schema_type = $cat_schema;}
1353
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1354
-    }
1355
-
1356
-    $schema = array();
1357
-    $schema['@context'] = "http://schema.org";
1358
-    $schema['@type'] = $schema_type;
1359
-    $schema['name'] = $post->post_name;
1360
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1361
-    $schema['telephone'] = $post->geodir_contact;
1362
-    $schema['url'] = $c_url;
1363
-    $schema['sameAs'] = $external_links;
1364
-    $schema['image'] = $images;
1365
-    $schema['address'] = array(
1366
-        "@type" => "PostalAddress",
1367
-        "streetAddress" => $post->post_address,
1368
-        "addressLocality" => $post->post_city,
1369
-        "addressRegion" => $post->post_region,
1370
-        "addressCountry" => $post->post_country,
1371
-        "postalCode" => $post->post_zip
1372
-    );
1373
-
1374
-    if($post->post_latitude && $post->post_longitude) {
1375
-        $schema['geo'] = array(
1376
-            "@type" => "GeoCoordinates",
1377
-            "latitude" => $post->post_latitude,
1378
-            "longitude" => $post->post_longitude
1379
-        );
1380
-    }
1381
-
1382
-    if($post_avgratings) {
1383
-        $schema['aggregateRating'] = array(
1384
-            "@type" => "AggregateRating",
1385
-            "ratingValue" => $post_avgratings,
1386
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1387
-            "worstRating" => "1",
1388
-            "ratingCount" => $comment_count
1389
-        );
1390
-    }
1391
-    $schema['review'] = $reviews;
1392
-
1393
-    /**
1394
-     * Allow the schema JSON-LD info to be filtered.
1395
-     *
1396
-     * @since 1.5.4
1397
-     * @since 1.5.7 Added $post variable.
1398
-     * @param array $schema The array of schema data to be filtered.
1399
-     * @param object $post The post object.
1400
-     */
1401
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1402
-
1403
-
1404
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1284
+	global $preview;
1285
+	if(empty($post)){global $post;}
1286
+	if ($preview || !geodir_is_page('detail')) {
1287
+		return;
1288
+	}
1289
+
1290
+	// url
1291
+	$c_url = geodir_curPageURL();
1292
+
1293
+	// post reviews
1294
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1295
+	if (empty($post_reviews)) {
1296
+		$reviews = '';
1297
+	} else {
1298
+		foreach ($post_reviews as $review) {
1299
+			$reviews[] = array(
1300
+				"@type" => "Review",
1301
+				"author" => $review->comment_author,
1302
+				"datePublished" => $review->comment_date,
1303
+				"description" => $review->comment_content,
1304
+				"reviewRating" => array(
1305
+					"@type" => "Rating",
1306
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1307
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1308
+					"worstRating" => "1"
1309
+				)
1310
+			);
1311
+		}
1312
+
1313
+	}
1314
+
1315
+	// post images
1316
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1317
+	if (empty($post_images)) {
1318
+		$images = '';
1319
+	} else {
1320
+		$i_arr = array();
1321
+		foreach ($post_images as $img) {
1322
+			$i_arr[] = $img->src;
1323
+		}
1324
+
1325
+		if (count($i_arr) == 1) {
1326
+			$images = $i_arr[0];
1327
+		} else {
1328
+			$images = $i_arr;
1329
+		}
1330
+
1331
+	}
1332
+	//print_r($post);
1333
+	// external links
1334
+	$external_links =  array();
1335
+	$external_links[] = $post->geodir_website;
1336
+	$external_links[] = $post->geodir_twitter;
1337
+	$external_links[] = $post->geodir_facebook;
1338
+	$external_links = array_filter($external_links);
1339
+
1340
+	if(!empty($external_links)){
1341
+		$external_links = array_values($external_links);
1342
+	}
1343
+
1344
+	// reviews
1345
+	$comment_count = geodir_get_review_count_total($post->ID);
1346
+	$post_avgratings = geodir_get_post_rating($post->ID);
1347
+
1348
+	// schema type
1349
+	$schema_type = 'LocalBusiness';
1350
+	if(isset($post->default_category) && $post->default_category){
1351
+		$cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1352
+		if($cat_schema){$schema_type = $cat_schema;}
1353
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1354
+	}
1355
+
1356
+	$schema = array();
1357
+	$schema['@context'] = "http://schema.org";
1358
+	$schema['@type'] = $schema_type;
1359
+	$schema['name'] = $post->post_name;
1360
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1361
+	$schema['telephone'] = $post->geodir_contact;
1362
+	$schema['url'] = $c_url;
1363
+	$schema['sameAs'] = $external_links;
1364
+	$schema['image'] = $images;
1365
+	$schema['address'] = array(
1366
+		"@type" => "PostalAddress",
1367
+		"streetAddress" => $post->post_address,
1368
+		"addressLocality" => $post->post_city,
1369
+		"addressRegion" => $post->post_region,
1370
+		"addressCountry" => $post->post_country,
1371
+		"postalCode" => $post->post_zip
1372
+	);
1373
+
1374
+	if($post->post_latitude && $post->post_longitude) {
1375
+		$schema['geo'] = array(
1376
+			"@type" => "GeoCoordinates",
1377
+			"latitude" => $post->post_latitude,
1378
+			"longitude" => $post->post_longitude
1379
+		);
1380
+	}
1381
+
1382
+	if($post_avgratings) {
1383
+		$schema['aggregateRating'] = array(
1384
+			"@type" => "AggregateRating",
1385
+			"ratingValue" => $post_avgratings,
1386
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1387
+			"worstRating" => "1",
1388
+			"ratingCount" => $comment_count
1389
+		);
1390
+	}
1391
+	$schema['review'] = $reviews;
1392
+
1393
+	/**
1394
+	 * Allow the schema JSON-LD info to be filtered.
1395
+	 *
1396
+	 * @since 1.5.4
1397
+	 * @since 1.5.7 Added $post variable.
1398
+	 * @param array $schema The array of schema data to be filtered.
1399
+	 * @param object $post The post object.
1400
+	 */
1401
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1402
+
1403
+
1404
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1405 1405
 
1406 1406
 }
1407 1407
 
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
  */
1420 1420
 function geodir_action_details_next_prev()
1421 1421
 {
1422
-    ?>
1422
+	?>
1423 1423
     <div class="geodir-pos_navigation clearfix">
1424 1424
     <div
1425 1425
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1437,15 +1437,15 @@  discard block
 block discarded – undo
1437 1437
  */
1438 1438
 function geodir_action_before_single_post()
1439 1439
 {
1440
-    global $post;
1441
-    /**
1442
-     * Called at the very start of the details page output, before the title section.
1443
-     *
1444
-     * @since 1.0.0
1445
-     * @param object $post The current post object.
1446
-     * @global WP_Post|null $post The current post, if available.
1447
-     */
1448
-    do_action('geodir_before_single_post', $post); // extra action	
1440
+	global $post;
1441
+	/**
1442
+	 * Called at the very start of the details page output, before the title section.
1443
+	 *
1444
+	 * @since 1.0.0
1445
+	 * @param object $post The current post object.
1446
+	 * @global WP_Post|null $post The current post, if available.
1447
+	 */
1448
+	do_action('geodir_before_single_post', $post); // extra action	
1449 1449
 }
1450 1450
 
1451 1451
 /**
@@ -1456,13 +1456,13 @@  discard block
 block discarded – undo
1456 1456
  */
1457 1457
 function geodir_action_after_single_post($post)
1458 1458
 {
1459
-    /**
1460
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1461
-     *
1462
-     * @since 1.0.0
1463
-     * @param object $post The current post object.
1464
-     */
1465
-    do_action('geodir_after_single_post', $post); // extra action	
1459
+	/**
1460
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1461
+	 *
1462
+	 * @since 1.0.0
1463
+	 * @param object $post The current post object.
1464
+	 */
1465
+	do_action('geodir_after_single_post', $post); // extra action	
1466 1466
 }
1467 1467
 
1468 1468
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1488,167 +1488,167 @@  discard block
 block discarded – undo
1488 1488
  */
1489 1489
 function geodir_action_listings_title()
1490 1490
 {
1491
-    global $wp, $term;
1492
-
1493
-    $gd_post_type = geodir_get_current_posttype();
1494
-    $post_type_info = get_post_type_object($gd_post_type);
1495
-
1496
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1497
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1498
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1499
-    }
1500
-
1501
-    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1502
-    $single_name = $post_type_info->labels->singular_name;
1503
-
1504
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1505
-
1506
-    $gd_country = get_query_var('gd_country');
1507
-    $gd_region = get_query_var('gd_region');
1508
-    $gd_city = get_query_var('gd_city');
1509
-
1510
-    if (!empty($term)) {
1511
-        $location_name = '';
1512
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1513
-            if ($gd_country != '') {
1514
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1515
-            }
1491
+	global $wp, $term;
1516 1492
 
1517
-            if ($gd_region != '') {
1518
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1519
-            }
1493
+	$gd_post_type = geodir_get_current_posttype();
1494
+	$post_type_info = get_post_type_object($gd_post_type);
1520 1495
 
1521
-            if ($gd_city != '') {
1522
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1523
-            }
1524
-        }
1496
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1497
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1498
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1499
+	}
1525 1500
 
1526
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1527
-        if (!empty($current_term)) {
1528
-            $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1529
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1530
-                $location_last_char = substr($location_name, -1);
1531
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1532
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1533
-            } else {
1534
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1535
-            }
1536
-        } else {
1537
-            if (count($taxonomy) > 1) {
1538
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1539
-
1540
-                if (!empty($current_term)) {
1541
-                    $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1542
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1543
-                        $location_last_char = substr($location_name, -1);
1544
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1545
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1546
-                    } else {
1547
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1548
-                    }
1549
-                }
1550
-            }
1551
-        }
1552
-
1553
-    } else {
1554
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1555
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1556
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1557
-
1558
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1559
-
1560
-        if (function_exists('get_actual_location_name')) {
1561
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1562
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1563
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1564
-        }
1565
-
1566
-        if ($gd_city != '') {
1567
-            if ($gd_city_actual != '') {
1568
-                $gd_city = $gd_city_actual;
1569
-            } else {
1570
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1571
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1572
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1573
-            }
1501
+	$list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1502
+	$single_name = $post_type_info->labels->singular_name;
1574 1503
 
1575
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1576
-        } else if ($gd_region != '') {
1577
-            if ($gd_region_actual != '') {
1578
-                $gd_region = $gd_region_actual;
1579
-            } else {
1580
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1581
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1582
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1583
-            }
1504
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1584 1505
 
1585
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1586
-        } else if ($gd_country != '') {
1587
-            if ($gd_country_actual != '') {
1588
-                $gd_country = $gd_country_actual;
1589
-            } else {
1590
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1591
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1592
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1593
-            }
1506
+	$gd_country = get_query_var('gd_country');
1507
+	$gd_region = get_query_var('gd_region');
1508
+	$gd_city = get_query_var('gd_city');
1594 1509
 
1595
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1596
-        }
1597
-    }
1598
-
1599
-    if (is_search()) {
1600
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1601
-    }
1602
-    /** This action is documented in geodirectory_template_actions.php */
1603
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1604
-    /** This action is documented in geodirectory_template_actions.php */
1605
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1606
-
1607
-
1608
-    $title = $list_title;
1609
-    if(geodir_is_page('pt')){
1610
-        $gd_page = 'pt';
1611
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1612
-    }
1613
-    elseif(geodir_is_page('listing')){
1614
-        $gd_page = 'listing';
1615
-        global $wp_query;
1616
-        $current_term = $wp_query->get_queried_object();
1617
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1618
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1619
-        }else{
1620
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1621
-        }
1510
+	if (!empty($term)) {
1511
+		$location_name = '';
1512
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1513
+			if ($gd_country != '') {
1514
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1515
+			}
1622 1516
 
1623
-    }
1624
-    elseif(geodir_is_page('author')){
1625
-        $gd_page = 'author';
1626
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1627
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1628
-        }else{
1629
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1630
-        }
1517
+			if ($gd_region != '') {
1518
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1519
+			}
1631 1520
 
1632
-    }
1521
+			if ($gd_city != '') {
1522
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1523
+			}
1524
+		}
1525
+
1526
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1527
+		if (!empty($current_term)) {
1528
+			$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1529
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1530
+				$location_last_char = substr($location_name, -1);
1531
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1532
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1533
+			} else {
1534
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1535
+			}
1536
+		} else {
1537
+			if (count($taxonomy) > 1) {
1538
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1539
+
1540
+				if (!empty($current_term)) {
1541
+					$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1542
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1543
+						$location_last_char = substr($location_name, -1);
1544
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1545
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1546
+					} else {
1547
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1548
+					}
1549
+				}
1550
+			}
1551
+		}
1552
+
1553
+	} else {
1554
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1555
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1556
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1557
+
1558
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1559
+
1560
+		if (function_exists('get_actual_location_name')) {
1561
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1562
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1563
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1564
+		}
1565
+
1566
+		if ($gd_city != '') {
1567
+			if ($gd_city_actual != '') {
1568
+				$gd_city = $gd_city_actual;
1569
+			} else {
1570
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1571
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1572
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1573
+			}
1633 1574
 
1575
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1576
+		} else if ($gd_region != '') {
1577
+			if ($gd_region_actual != '') {
1578
+				$gd_region = $gd_region_actual;
1579
+			} else {
1580
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1581
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1582
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1583
+			}
1634 1584
 
1635
-    /**
1636
-     * Filter page title to replace variables.
1637
-     *
1638
-     * @since 1.5.4
1639
-     * @param string $title The page title including variables.
1640
-     * @param string $gd_page The GeoDirectory page type if any.
1641
-     */
1642
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1585
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1586
+		} else if ($gd_country != '') {
1587
+			if ($gd_country_actual != '') {
1588
+				$gd_country = $gd_country_actual;
1589
+			} else {
1590
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1591
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1592
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1593
+			}
1643 1594
 
1644
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1645
-        /**
1646
-         * Filter the listing page title.
1647
-         *
1648
-         * @since 1.0.0
1649
-         * @param string $list_title The title for the category page.
1650
-         */
1651
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1595
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1596
+		}
1597
+	}
1598
+
1599
+	if (is_search()) {
1600
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1601
+	}
1602
+	/** This action is documented in geodirectory_template_actions.php */
1603
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1604
+	/** This action is documented in geodirectory_template_actions.php */
1605
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1606
+
1607
+
1608
+	$title = $list_title;
1609
+	if(geodir_is_page('pt')){
1610
+		$gd_page = 'pt';
1611
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1612
+	}
1613
+	elseif(geodir_is_page('listing')){
1614
+		$gd_page = 'listing';
1615
+		global $wp_query;
1616
+		$current_term = $wp_query->get_queried_object();
1617
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1618
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1619
+		}else{
1620
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1621
+		}
1622
+
1623
+	}
1624
+	elseif(geodir_is_page('author')){
1625
+		$gd_page = 'author';
1626
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1627
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1628
+		}else{
1629
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1630
+		}
1631
+
1632
+	}
1633
+
1634
+
1635
+	/**
1636
+	 * Filter page title to replace variables.
1637
+	 *
1638
+	 * @since 1.5.4
1639
+	 * @param string $title The page title including variables.
1640
+	 * @param string $gd_page The GeoDirectory page type if any.
1641
+	 */
1642
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1643
+
1644
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1645
+		/**
1646
+		 * Filter the listing page title.
1647
+		 *
1648
+		 * @since 1.0.0
1649
+		 * @param string $list_title The title for the category page.
1650
+		 */
1651
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1652 1652
 }
1653 1653
 
1654 1654
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1661,33 +1661,33 @@  discard block
 block discarded – undo
1661 1661
  */
1662 1662
 function geodir_action_listings_description()
1663 1663
 {
1664
-    global $wp_query;
1665
-    $current_term = $wp_query->get_queried_object();
1666
-
1667
-    $gd_post_type = geodir_get_current_posttype();
1668
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1669
-
1670
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1671
-        $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1672
-        if ($term_desc && !$saved_data) {
1673
-            $saved_data = $term_desc;
1674
-        }
1675
-        /**
1676
-         * Apply the core filter `the_content` filter to the variable string.
1677
-         *
1678
-         * This is a WordPress core filter that does many things.
1679
-         *
1680
-         * @since 1.0.0
1681
-         * @param string $var The string to apply the filter to.
1682
-         */
1683
-        $cat_description = apply_filters('the_content', $saved_data);
1684
-        if ($cat_description) {
1685
-            ?>
1664
+	global $wp_query;
1665
+	$current_term = $wp_query->get_queried_object();
1666
+
1667
+	$gd_post_type = geodir_get_current_posttype();
1668
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1669
+
1670
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1671
+		$saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1672
+		if ($term_desc && !$saved_data) {
1673
+			$saved_data = $term_desc;
1674
+		}
1675
+		/**
1676
+		 * Apply the core filter `the_content` filter to the variable string.
1677
+		 *
1678
+		 * This is a WordPress core filter that does many things.
1679
+		 *
1680
+		 * @since 1.0.0
1681
+		 * @param string $var The string to apply the filter to.
1682
+		 */
1683
+		$cat_description = apply_filters('the_content', $saved_data);
1684
+		if ($cat_description) {
1685
+			?>
1686 1686
 
1687 1687
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1688
-        }
1688
+		}
1689 1689
 
1690
-    }
1690
+	}
1691 1691
 }
1692 1692
 
1693 1693
 // action for adding the listings page top widget area
@@ -1706,11 +1706,11 @@  discard block
 block discarded – undo
1706 1706
  */
1707 1707
 function geodir_action_geodir_sidebar_listings_top()
1708 1708
 {
1709
-    if (get_option('geodir_show_listing_top_section')) { ?>
1709
+	if (get_option('geodir_show_listing_top_section')) { ?>
1710 1710
         <div
1711 1711
             class="<?php
1712
-            /** This action is documented in geodirectory_template_actions.php */
1713
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1712
+			/** This action is documented in geodirectory_template_actions.php */
1713
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1714 1714
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1715 1715
         </div><!-- clearfix ends here-->
1716 1716
     <?php }
@@ -1733,35 +1733,35 @@  discard block
 block discarded – undo
1733 1733
  */
1734 1734
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1735 1735
 {
1736
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1737
-        $width_css = 'style="width:' . $width . '%;"';
1738
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1739
-        $width_css = 'style="width:' . $width . '%;"';
1740
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1741
-        $width_css = 'style="width:' . $width . '%;"';
1742
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1743
-        $width_css = 'style="width:' . $width . '%;"';
1744
-    } else {
1745
-        $width_css = '';
1746
-    }
1747
-
1748
-    $tc = get_option('theme_compatibility_setting');
1749
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1750
-        $text = $tc['geodir_sidebar_left_open_replace'];
1751
-    } else {
1752
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1753
-    }
1754
-
1755
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1756
-        $id = $tc['geodir_sidebar_left_open_id'];
1757
-    }
1758
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1759
-        $class = $tc['geodir_sidebar_left_open_class'];
1760
-    }
1761
-
1762
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1763
-
1764
-    echo $text;
1736
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1737
+		$width_css = 'style="width:' . $width . '%;"';
1738
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1739
+		$width_css = 'style="width:' . $width . '%;"';
1740
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1741
+		$width_css = 'style="width:' . $width . '%;"';
1742
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1743
+		$width_css = 'style="width:' . $width . '%;"';
1744
+	} else {
1745
+		$width_css = '';
1746
+	}
1747
+
1748
+	$tc = get_option('theme_compatibility_setting');
1749
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1750
+		$text = $tc['geodir_sidebar_left_open_replace'];
1751
+	} else {
1752
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1753
+	}
1754
+
1755
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1756
+		$id = $tc['geodir_sidebar_left_open_id'];
1757
+	}
1758
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1759
+		$class = $tc['geodir_sidebar_left_open_class'];
1760
+	}
1761
+
1762
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1763
+
1764
+	echo $text;
1765 1765
 }
1766 1766
 
1767 1767
 // action for adding the primary div closing tag
@@ -1777,13 +1777,13 @@  discard block
 block discarded – undo
1777 1777
  */
1778 1778
 function geodir_action_sidebar_left_close($type = '')
1779 1779
 {
1780
-    $tc = get_option('theme_compatibility_setting');
1781
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1782
-        $text = $tc['geodir_sidebar_left_close_replace'];
1783
-    } else {
1784
-        $text = '</aside><!-- sidebar ends here-->';
1785
-    }
1786
-    echo $text;
1780
+	$tc = get_option('theme_compatibility_setting');
1781
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1782
+		$text = $tc['geodir_sidebar_left_close_replace'];
1783
+	} else {
1784
+		$text = '</aside><!-- sidebar ends here-->';
1785
+	}
1786
+	echo $text;
1787 1787
 }
1788 1788
 
1789 1789
 /**
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
  */
1797 1797
 function geodir_listing_left_section()
1798 1798
 {
1799
-    if (get_option('geodir_show_listing_left_section')) { ?>
1799
+	if (get_option('geodir_show_listing_left_section')) { ?>
1800 1800
         <div class="geodir-content-left geodir-sidebar-wrap">
1801 1801
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1802 1802
         </div><!-- end geodir-content-left -->
@@ -1814,20 +1814,20 @@  discard block
 block discarded – undo
1814 1814
  */
1815 1815
 function geodir_action_listings_sidebar_left()
1816 1816
 {
1817
-    if (get_option('geodir_show_listing_left_section')) {
1818
-        /** This action is documented in geodirectory_template_actions.php */
1819
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1820
-        /**
1821
-         * Calls the listings page (category) left sidebar content.
1822
-         *
1823
-         * All the content for the listings page left sidebar is added via this hook.
1824
-         *
1825
-         * @since 1.0.0
1826
-         */
1827
-        do_action('geodir_listings_sidebar_left_inside');
1828
-        /** This action is documented in geodirectory_template_actions.php */
1829
-        do_action('geodir_sidebar_left_close', 'listings-page');
1830
-    }
1817
+	if (get_option('geodir_show_listing_left_section')) {
1818
+		/** This action is documented in geodirectory_template_actions.php */
1819
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1820
+		/**
1821
+		 * Calls the listings page (category) left sidebar content.
1822
+		 *
1823
+		 * All the content for the listings page left sidebar is added via this hook.
1824
+		 *
1825
+		 * @since 1.0.0
1826
+		 */
1827
+		do_action('geodir_listings_sidebar_left_inside');
1828
+		/** This action is documented in geodirectory_template_actions.php */
1829
+		do_action('geodir_sidebar_left_close', 'listings-page');
1830
+	}
1831 1831
 }
1832 1832
 
1833 1833
 /**
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
  */
1841 1841
 function geodir_listing_right_section()
1842 1842
 {
1843
-    if (get_option('geodir_show_listing_right_section')) { ?>
1843
+	if (get_option('geodir_show_listing_right_section')) { ?>
1844 1844
         <div class="geodir-content-right geodir-sidebar-wrap">
1845 1845
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1846 1846
         </div><!-- end geodir-content-right -->
@@ -1858,20 +1858,20 @@  discard block
 block discarded – undo
1858 1858
  */
1859 1859
 function geodir_action_listings_sidebar_right()
1860 1860
 {
1861
-    if (get_option('geodir_show_listing_right_section')) {
1862
-        /** This action is documented in geodirectory_template_actions.php */
1863
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1864
-        /**
1865
-         * Calls the listings page (category) right sidebar content.
1866
-         *
1867
-         * All the content for the listings page right sidebar is added via this hook.
1868
-         *
1869
-         * @since 1.0.0
1870
-         */
1871
-        do_action('geodir_listings_sidebar_right_inside');
1872
-        /** This action is documented in geodirectory_template_actions.php */
1873
-        do_action('geodir_sidebar_right_close', 'listings-page');
1874
-    }
1861
+	if (get_option('geodir_show_listing_right_section')) {
1862
+		/** This action is documented in geodirectory_template_actions.php */
1863
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1864
+		/**
1865
+		 * Calls the listings page (category) right sidebar content.
1866
+		 *
1867
+		 * All the content for the listings page right sidebar is added via this hook.
1868
+		 *
1869
+		 * @since 1.0.0
1870
+		 */
1871
+		do_action('geodir_listings_sidebar_right_inside');
1872
+		/** This action is documented in geodirectory_template_actions.php */
1873
+		do_action('geodir_sidebar_right_close', 'listings-page');
1874
+	}
1875 1875
 }
1876 1876
 
1877 1877
 
@@ -1888,23 +1888,23 @@  discard block
 block discarded – undo
1888 1888
  */
1889 1889
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1890 1890
 {
1891
-    $tc = get_option('theme_compatibility_setting');
1892
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1893
-        $text = $tc['geodir_main_content_open_replace'];
1894
-    } else {
1895
-        $text = '<main id="[id]" class="[class]" role="main">';
1896
-    }
1891
+	$tc = get_option('theme_compatibility_setting');
1892
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1893
+		$text = $tc['geodir_main_content_open_replace'];
1894
+	} else {
1895
+		$text = '<main id="[id]" class="[class]" role="main">';
1896
+	}
1897 1897
 
1898
-    if (!empty($tc['geodir_main_content_open_id'])) {
1899
-        $id = $tc['geodir_main_content_open_id'];
1900
-    }
1901
-    if (!empty($tc['geodir_main_content_open_class'])) {
1902
-        $class = $tc['geodir_main_content_open_class'];
1903
-    }
1898
+	if (!empty($tc['geodir_main_content_open_id'])) {
1899
+		$id = $tc['geodir_main_content_open_id'];
1900
+	}
1901
+	if (!empty($tc['geodir_main_content_open_class'])) {
1902
+		$class = $tc['geodir_main_content_open_class'];
1903
+	}
1904 1904
 
1905
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1905
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1906 1906
 
1907
-    echo $text;
1907
+	echo $text;
1908 1908
 }
1909 1909
 
1910 1910
 // action for adding the primary div closing tag
@@ -1917,13 +1917,13 @@  discard block
 block discarded – undo
1917 1917
  */
1918 1918
 function geodir_action_main_content_close()
1919 1919
 {
1920
-    $tc = get_option('theme_compatibility_setting');
1921
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1922
-        $text = $tc['geodir_main_content_close_replace'];
1923
-    } else {
1924
-        $text = '</main><!-- main ends here-->';
1925
-    }
1926
-    echo $text;
1920
+	$tc = get_option('theme_compatibility_setting');
1921
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1922
+		$text = $tc['geodir_main_content_close_replace'];
1923
+	} else {
1924
+		$text = '</main><!-- main ends here-->';
1925
+	}
1926
+	echo $text;
1927 1927
 }
1928 1928
 
1929 1929
 /**
@@ -1935,14 +1935,14 @@  discard block
 block discarded – undo
1935 1935
  */
1936 1936
 function geodir_action_listings_content_inside()
1937 1937
 {
1938
-    global $gridview_columns;
1939
-    $listing_view = get_option('geodir_listing_view');
1940
-    if (strstr($listing_view, 'gridview')) {
1941
-        $gridview_columns = $listing_view;
1942
-        $listing_view_exp = explode('_', $listing_view);
1943
-        $listing_view = $listing_view_exp[0];
1944
-    }
1945
-    geodir_get_template_part('listing', 'listview');
1938
+	global $gridview_columns;
1939
+	$listing_view = get_option('geodir_listing_view');
1940
+	if (strstr($listing_view, 'gridview')) {
1941
+		$gridview_columns = $listing_view;
1942
+		$listing_view_exp = explode('_', $listing_view);
1943
+		$listing_view = $listing_view_exp[0];
1944
+	}
1945
+	geodir_get_template_part('listing', 'listview');
1946 1946
 }
1947 1947
 
1948 1948
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1958,47 +1958,47 @@  discard block
 block discarded – undo
1958 1958
  */
1959 1959
 function geodir_action_listings_content()
1960 1960
 {
1961
-    /**
1962
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1963
-     *
1964
-     * @since 1.0.0
1965
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1966
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
1967
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1968
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1969
-     */
1970
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1971
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1972
-    echo '<div class="clearfix '.$extra_class.'">';
1973
-    /**
1974
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1975
-     *
1976
-     * @since 1.0.0
1977
-     */
1978
-    do_action('geodir_before_listing');
1979
-    echo '</div>';
1980
-
1981
-    /**
1982
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
1983
-     *
1984
-     * @since 1.0.0
1985
-     */
1986
-    do_action('geodir_listings_content_inside');
1987
-
1988
-    /**
1989
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
1990
-     *
1991
-     * @since 1.0.0
1992
-     */
1993
-    do_action('geodir_after_listing');
1994
-
1995
-    /**
1996
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
1997
-     *
1998
-     * @since 1.0.0
1999
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2000
-     */
2001
-    do_action('geodir_main_content_close', 'listings-page');
1961
+	/**
1962
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1963
+	 *
1964
+	 * @since 1.0.0
1965
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1966
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
1967
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1968
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1969
+	 */
1970
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1971
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1972
+	echo '<div class="clearfix '.$extra_class.'">';
1973
+	/**
1974
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1975
+	 *
1976
+	 * @since 1.0.0
1977
+	 */
1978
+	do_action('geodir_before_listing');
1979
+	echo '</div>';
1980
+
1981
+	/**
1982
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
1983
+	 *
1984
+	 * @since 1.0.0
1985
+	 */
1986
+	do_action('geodir_listings_content_inside');
1987
+
1988
+	/**
1989
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
1990
+	 *
1991
+	 * @since 1.0.0
1992
+	 */
1993
+	do_action('geodir_after_listing');
1994
+
1995
+	/**
1996
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
1997
+	 *
1998
+	 * @since 1.0.0
1999
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2000
+	 */
2001
+	do_action('geodir_main_content_close', 'listings-page');
2002 2002
 }
2003 2003
 
2004 2004
 
@@ -2013,10 +2013,10 @@  discard block
 block discarded – undo
2013 2013
  */
2014 2014
 function geodir_action_sidebar_listings_bottom_section()
2015 2015
 {
2016
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2016
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2017 2017
         <div class="<?php
2018
-            /** This action is documented in geodirectory_template_actions.php */
2019
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2018
+			/** This action is documented in geodirectory_template_actions.php */
2019
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2020 2020
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2021 2021
         </div><!-- clearfix ends here-->
2022 2022
     <?php }
@@ -2036,38 +2036,38 @@  discard block
 block discarded – undo
2036 2036
  */
2037 2037
 function geodir_action_add_listing_page_title()
2038 2038
 {
2039
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2040
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2041
-    /** This action is documented in geodirectory_template_actions.php */
2042
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2043
-    /** This action is documented in geodirectory_template_actions.php */
2044
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2045
-
2046
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2047
-
2048
-    if(geodir_is_page('add-listing')){
2049
-        $gd_page = 'add-listing';
2050
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2051
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2052
-        }elseif(isset($listing_type)){
2053
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2054
-        }
2039
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2040
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2041
+	/** This action is documented in geodirectory_template_actions.php */
2042
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2043
+	/** This action is documented in geodirectory_template_actions.php */
2044
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2045
+
2046
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2047
+
2048
+	if(geodir_is_page('add-listing')){
2049
+		$gd_page = 'add-listing';
2050
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2051
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2052
+		}elseif(isset($listing_type)){
2053
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2054
+		}
2055 2055
 
2056
-    }
2056
+	}
2057 2057
 
2058 2058
 
2059
-    /**
2060
-     * Filter page title to replace variables.
2061
-     *
2062
-     * @since 1.5.4
2063
-     * @param string $title The page title including variables.
2064
-     * @param string $gd_page The GeoDirectory page type if any.
2065
-     */
2066
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2059
+	/**
2060
+	 * Filter page title to replace variables.
2061
+	 *
2062
+	 * @since 1.5.4
2063
+	 * @param string $title The page title including variables.
2064
+	 * @param string $gd_page The GeoDirectory page type if any.
2065
+	 */
2066
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2067 2067
 
2068
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2069
-    echo $title;
2070
-    echo '</h1></header>';
2068
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2069
+	echo $title;
2070
+	echo '</h1></header>';
2071 2071
 }
2072 2072
 
2073 2073
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2098,54 +2098,54 @@  discard block
 block discarded – undo
2098 2098
  */
2099 2099
 function geodir_action_add_listing_form()
2100 2100
 {
2101
-    global $cat_display, $post_cat, $current_user, $gd_session;
2102
-    $page_id = get_the_ID();
2103
-    $post = '';
2104
-    $title = '';
2105
-    $desc = '';
2106
-    $kw_tags = '';
2107
-    $required_msg = '';
2108
-    $submit_button = '';
2109
-
2110
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2111
-
2112
-    $thumb_img_arr = array();
2113
-    $curImages = '';
2114
-
2115
-    if (isset($_REQUEST['backandedit'])) {
2116
-        global $post;
2117
-        $post = (object)$gd_session->get('listing');
2118
-        $listing_type = $post->listing_type;
2119
-        $title = $post->post_title;
2120
-        $desc = $post->post_desc;
2121
-        $post_cat = $post->post_category;
2122
-
2123
-        $kw_tags = $post->post_tags;
2124
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2125
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2126
-        global $post, $post_images;
2127
-
2128
-        $post = geodir_get_post_info($_REQUEST['pid']);
2129
-        $thumb_img_arr = geodir_get_images($post->ID);
2130
-        if ($thumb_img_arr) {
2131
-            foreach ($thumb_img_arr as $post_img) {
2132
-                $curImages .= $post_img->src . ',';
2133
-            }
2134
-        }
2135
-
2136
-        $listing_type = $post->post_type;
2137
-        $title = $post->post_title;
2138
-        $desc = $post->post_content;
2139
-        $kw_tags = $post->post_tags;
2140
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2141
-    } else {
2142
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2143
-    }
2144
-
2145
-    if ($current_user->ID != '0') {
2146
-        $user_login = true;
2147
-    }
2148
-    ?>
2101
+	global $cat_display, $post_cat, $current_user, $gd_session;
2102
+	$page_id = get_the_ID();
2103
+	$post = '';
2104
+	$title = '';
2105
+	$desc = '';
2106
+	$kw_tags = '';
2107
+	$required_msg = '';
2108
+	$submit_button = '';
2109
+
2110
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2111
+
2112
+	$thumb_img_arr = array();
2113
+	$curImages = '';
2114
+
2115
+	if (isset($_REQUEST['backandedit'])) {
2116
+		global $post;
2117
+		$post = (object)$gd_session->get('listing');
2118
+		$listing_type = $post->listing_type;
2119
+		$title = $post->post_title;
2120
+		$desc = $post->post_desc;
2121
+		$post_cat = $post->post_category;
2122
+
2123
+		$kw_tags = $post->post_tags;
2124
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2125
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2126
+		global $post, $post_images;
2127
+
2128
+		$post = geodir_get_post_info($_REQUEST['pid']);
2129
+		$thumb_img_arr = geodir_get_images($post->ID);
2130
+		if ($thumb_img_arr) {
2131
+			foreach ($thumb_img_arr as $post_img) {
2132
+				$curImages .= $post_img->src . ',';
2133
+			}
2134
+		}
2135
+
2136
+		$listing_type = $post->post_type;
2137
+		$title = $post->post_title;
2138
+		$desc = $post->post_content;
2139
+		$kw_tags = $post->post_tags;
2140
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2141
+	} else {
2142
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2143
+	}
2144
+
2145
+	if ($current_user->ID != '0') {
2146
+		$user_login = true;
2147
+	}
2148
+	?>
2149 2149
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2150 2150
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2151 2151
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2156,27 +2156,27 @@  discard block
 block discarded – undo
2156 2156
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2157 2157
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2158 2158
         <?php
2159
-        } 
2160
-        /**
2161
-         * Called at the very top of the add listing page form for frontend.
2162
-         *
2163
-         * This is called just before the "Enter Listing Details" text.
2164
-         *
2165
-         * @since 1.0.0
2166
-         */
2167
-        do_action('geodir_before_detail_fields');
2168
-        ?>
2159
+		} 
2160
+		/**
2161
+		 * Called at the very top of the add listing page form for frontend.
2162
+		 *
2163
+		 * This is called just before the "Enter Listing Details" text.
2164
+		 *
2165
+		 * @since 1.0.0
2166
+		 */
2167
+		do_action('geodir_before_detail_fields');
2168
+		?>
2169 2169
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2170 2170
         <?php
2171
-        /**
2172
-         * Called at the top of the add listing page form for frontend.
2173
-         *
2174
-         * This is called after the "Enter Listing Details" text.
2175
-         *
2176
-         * @since 1.0.0
2177
-         */
2178
-        do_action('geodir_before_main_form_fields');
2179
-        ?>
2171
+		/**
2172
+		 * Called at the top of the add listing page form for frontend.
2173
+		 *
2174
+		 * This is called after the "Enter Listing Details" text.
2175
+		 *
2176
+		 * @since 1.0.0
2177
+		 */
2178
+		do_action('geodir_before_main_form_fields');
2179
+		?>
2180 2180
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2181 2181
             <label><?php echo PLACE_TITLE_TEXT;?><span>*</span> </label>
2182 2182
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
@@ -2184,57 +2184,57 @@  discard block
 block discarded – undo
2184 2184
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2185 2185
         </div>
2186 2186
         <?php
2187
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2188
-
2189
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2190
-        $desc_limit = '';
2191
-        /**
2192
-         * Filter the add listing description field character limit number.
2193
-         *
2194
-         * @since 1.0.0
2195
-         * @param int $desc_limit The amount of characters to limit the description to.
2196
-         */
2197
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2198
-        /**
2199
-         * Filter the add listing description field text.
2200
-         *
2201
-         * @since 1.0.0
2202
-         * @param string $desc The text for the description field.
2203
-         * @param int $desc_limit The character limit number if any.
2204
-         */
2205
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2206
-        $desc_limit_msg = '';
2207
-        /**
2208
-         * Filter the add listing description limit message.
2209
-         *
2210
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2211
-         *
2212
-         * @since 1.0.0
2213
-         * @param string $desc_limit_msg The limit message string if any.
2214
-         * @param int $desc_limit The character limit numer if any.
2215
-         */
2216
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2187
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2188
+
2189
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2190
+		$desc_limit = '';
2191
+		/**
2192
+		 * Filter the add listing description field character limit number.
2193
+		 *
2194
+		 * @since 1.0.0
2195
+		 * @param int $desc_limit The amount of characters to limit the description to.
2196
+		 */
2197
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2198
+		/**
2199
+		 * Filter the add listing description field text.
2200
+		 *
2201
+		 * @since 1.0.0
2202
+		 * @param string $desc The text for the description field.
2203
+		 * @param int $desc_limit The character limit number if any.
2204
+		 */
2205
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2206
+		$desc_limit_msg = '';
2207
+		/**
2208
+		 * Filter the add listing description limit message.
2209
+		 *
2210
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2211
+		 *
2212
+		 * @since 1.0.0
2213
+		 * @param string $desc_limit_msg The limit message string if any.
2214
+		 * @param int $desc_limit The character limit numer if any.
2215
+		 */
2216
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2217 2217
         
2218
-        $desc_class = '';
2219
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2220
-            /**
2221
-             * Called on the add listing page form for frontend just before the description field.
2222
-             *
2223
-             * @since 1.0.0
2224
-             */
2225
-            do_action('geodir_before_description_field');
2218
+		$desc_class = '';
2219
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2220
+			/**
2221
+			 * Called on the add listing page form for frontend just before the description field.
2222
+			 *
2223
+			 * @since 1.0.0
2224
+			 */
2225
+			do_action('geodir_before_description_field');
2226 2226
             
2227
-            $desc_class = ' required_field';
2228
-        } else {
2229
-            $desc_class = ' hidden';
2230
-        }
2231
-        ?>
2227
+			$desc_class = ' required_field';
2228
+		} else {
2229
+			$desc_class = ' hidden';
2230
+		}
2231
+		?>
2232 2232
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2233 2233
             <label><?php echo PLACE_DESC_TEXT;?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2234 2234
             <?php
2235
-            if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2236
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2237
-            ?>
2235
+			if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2236
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2237
+			?>
2238 2238
                 <div class="editor" field_id="post_desc" field_type="editor">
2239 2239
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2240 2240
                 </div>
@@ -2248,56 +2248,56 @@  discard block
 block discarded – undo
2248 2248
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2249 2249
         </div>
2250 2250
         <?php
2251
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2252
-            /**
2253
-             * Called on the add listing page form for frontend just after the description field.
2254
-             *
2255
-             * @since 1.0.0
2256
-             */
2257
-            do_action('geodir_after_description_field');
2258
-        }
2251
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2252
+			/**
2253
+			 * Called on the add listing page form for frontend just after the description field.
2254
+			 *
2255
+			 * @since 1.0.0
2256
+			 */
2257
+			do_action('geodir_after_description_field');
2258
+		}
2259 2259
         
2260
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2261
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2262
-        $kw_tags_msg = TAGKW_MSG;
2263
-        /**
2264
-         * Filter the add listing tags character limit.
2265
-         *
2266
-         * @since 1.0.0
2267
-         * @param int $kw_tags_count The character count limit if any.
2268
-         */
2269
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2270
-        /**
2271
-         * Filter the add listing tags field value.
2272
-         *
2273
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2274
-         *
2275
-         * @since 1.0.0
2276
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2277
-         * @param int $kw_tags_count The character count limit if any.
2278
-         */
2279
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2280
-        /**
2281
-         * Filter the add listing tags field message text.
2282
-         *
2283
-         * @since 1.0.0
2284
-         * @param string $kw_tags_msg The message shown under the field.
2285
-         * @param int $kw_tags_count The character count limit if any.
2286
-         */
2287
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2260
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2261
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2262
+		$kw_tags_msg = TAGKW_MSG;
2263
+		/**
2264
+		 * Filter the add listing tags character limit.
2265
+		 *
2266
+		 * @since 1.0.0
2267
+		 * @param int $kw_tags_count The character count limit if any.
2268
+		 */
2269
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2270
+		/**
2271
+		 * Filter the add listing tags field value.
2272
+		 *
2273
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2274
+		 *
2275
+		 * @since 1.0.0
2276
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2277
+		 * @param int $kw_tags_count The character count limit if any.
2278
+		 */
2279
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2280
+		/**
2281
+		 * Filter the add listing tags field message text.
2282
+		 *
2283
+		 * @since 1.0.0
2284
+		 * @param string $kw_tags_msg The message shown under the field.
2285
+		 * @param int $kw_tags_count The character count limit if any.
2286
+		 */
2287
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2288 2288
         
2289
-        $tags_class = '';
2290
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2291
-            /**
2292
-             * Called on the add listing page form for frontend just before the tags field.
2293
-             *
2294
-             * @since 1.0.0
2295
-             */
2296
-            do_action('geodir_before_listing_tags_field');
2297
-        } else {
2298
-            $tags_class = ' hidden';
2299
-        }
2300
-        ?>
2289
+		$tags_class = '';
2290
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2291
+			/**
2292
+			 * Called on the add listing page form for frontend just before the tags field.
2293
+			 *
2294
+			 * @since 1.0.0
2295
+			 */
2296
+			do_action('geodir_before_listing_tags_field');
2297
+		} else {
2298
+			$tags_class = ' hidden';
2299
+		}
2300
+		?>
2301 2301
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2302 2302
             <label><?php echo TAGKW_TEXT; ?></label>
2303 2303
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2305,90 +2305,90 @@  discard block
 block discarded – undo
2305 2305
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2306 2306
         </div>
2307 2307
         <?php
2308
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2309
-            /**
2310
-             * Called on the add listing page form for frontend just after the tags field.
2311
-             *
2312
-             * @since 1.0.0
2313
-             */
2314
-            do_action('geodir_after_listing_tags_field');
2315
-        }
2308
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2309
+			/**
2310
+			 * Called on the add listing page form for frontend just after the tags field.
2311
+			 *
2312
+			 * @since 1.0.0
2313
+			 */
2314
+			do_action('geodir_after_listing_tags_field');
2315
+		}
2316 2316
         
2317
-        $package_info = array();
2318
-        $package_info = geodir_post_package_info($package_info, $post);
2317
+		$package_info = array();
2318
+		$package_info = geodir_post_package_info($package_info, $post);
2319 2319
         
2320
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2320
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2321 2321
         
2322
-        // adjust values here
2323
-        $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
2322
+		// adjust values here
2323
+		$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
2324 2324
 
2325
-        $multiple = true; // allow multiple files upload
2325
+		$multiple = true; // allow multiple files upload
2326 2326
 
2327
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2327
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2328 2328
 
2329
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2329
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2330 2330
 
2331
-        $thumb_img_arr = array();
2332
-        $totImg = 0;
2333
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2334
-            $post = (object)$gd_session->get('listing');
2335
-            if (isset($post->post_images))
2336
-                $curImages = trim($post->post_images, ",");
2331
+		$thumb_img_arr = array();
2332
+		$totImg = 0;
2333
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2334
+			$post = (object)$gd_session->get('listing');
2335
+			if (isset($post->post_images))
2336
+				$curImages = trim($post->post_images, ",");
2337 2337
 
2338 2338
 
2339
-            if ($curImages != '') {
2340
-                $curImages_array = explode(',', $curImages);
2341
-                $totImg = count($curImages_array);
2342
-            }
2343
-
2344
-            $listing_type = $post->listing_type;
2339
+			if ($curImages != '') {
2340
+				$curImages_array = explode(',', $curImages);
2341
+				$totImg = count($curImages_array);
2342
+			}
2345 2343
 
2346
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2347
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2348
-            $listing_type = $post->post_type;
2349
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2344
+			$listing_type = $post->listing_type;
2350 2345
 
2351
-        } else {
2352
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2353
-        }
2346
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2347
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2348
+			$listing_type = $post->post_type;
2349
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2354 2350
 
2351
+		} else {
2352
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2353
+		}
2355 2354
 
2356
-        if (!empty($thumb_img_arr)) {
2357
-            foreach ($thumb_img_arr as $img) {
2358
-                //$curImages = $img->src.",";
2359
-            }
2360 2355
 
2361
-            $totImg = count((array)$thumb_img_arr);
2362
-        }
2356
+		if (!empty($thumb_img_arr)) {
2357
+			foreach ($thumb_img_arr as $img) {
2358
+				//$curImages = $img->src.",";
2359
+			}
2363 2360
 
2364
-        if ($curImages != '')
2365
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2366
-        else
2367
-            $svalue = '';
2368
-
2369
-        $image_limit = $package_info->image_limit;
2370
-        $show_image_input_box = ($image_limit != '0');
2371
-        /**
2372
-         * Filter to be able to show/hide the image upload section of the add listing form.
2373
-         *
2374
-         * @since 1.0.0
2375
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2376
-         * @param string $listing_type The custom post type slug.
2377
-         */
2378
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2379
-        if ($show_image_input_box) {
2380
-            ?>
2361
+			$totImg = count((array)$thumb_img_arr);
2362
+		}
2363
+
2364
+		if ($curImages != '')
2365
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2366
+		else
2367
+			$svalue = '';
2368
+
2369
+		$image_limit = $package_info->image_limit;
2370
+		$show_image_input_box = ($image_limit != '0');
2371
+		/**
2372
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2373
+		 *
2374
+		 * @since 1.0.0
2375
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2376
+		 * @param string $listing_type The custom post type slug.
2377
+		 */
2378
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2379
+		if ($show_image_input_box) {
2380
+			?>
2381 2381
 
2382 2382
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2383 2383
                 <?php if ($image_limit == 1) {
2384
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2385
-                } ?>
2384
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2385
+				} ?>
2386 2386
                 <?php if ($image_limit > 1) {
2387
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2388
-                } ?>
2387
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2388
+				} ?>
2389 2389
                 <?php if ($image_limit == '') {
2390
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2391
-                } ?>
2390
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2391
+				} ?>
2392 2392
             </h5>
2393 2393
 
2394 2394
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2426,12 +2426,12 @@  discard block
 block discarded – undo
2426 2426
         <?php } ?>
2427 2427
 
2428 2428
         <?php
2429
-        /**
2430
-         * Called on the add listing page form for frontend just after the image upload field.
2431
-         *
2432
-         * @since 1.0.0
2433
-         */
2434
-        do_action('geodir_after_main_form_fields');?>
2429
+		/**
2430
+		 * Called on the add listing page form for frontend just after the image upload field.
2431
+		 *
2432
+		 * @since 1.0.0
2433
+		 */
2434
+		do_action('geodir_after_main_form_fields');?>
2435 2435
 
2436 2436
 
2437 2437
         <!-- add captcha code -->
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
 
2461 2461
     </form>
2462 2462
     <?php
2463
-    wp_reset_query();
2463
+	wp_reset_query();
2464 2464
 }
2465 2465
 
2466 2466
 /**
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
  */
2472 2472
 function geodir_add_listing_sidebar_widget_area()
2473 2473
 {
2474
-    dynamic_sidebar('geodir_add_listing_sidebar');
2474
+	dynamic_sidebar('geodir_add_listing_sidebar');
2475 2475
 }
2476 2476
 
2477 2477
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2486,16 +2486,16 @@  discard block
 block discarded – undo
2486 2486
  */
2487 2487
 function geodir_action_add_listing_sidebar()
2488 2488
 {
2489
-    /** This action is documented in geodirectory_template_actions.php */
2490
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2491
-    /**
2492
-     * This is used to add the content to the add listing page sidebar.
2493
-     *
2494
-     * @since 1.0.0
2495
-     */
2496
-    do_action('geodir_add_listing_sidebar_inside');
2497
-    /** This action is documented in geodirectory_template_actions.php */
2498
-    do_action('geodir_sidebar_right_close', 'details-page');
2489
+	/** This action is documented in geodirectory_template_actions.php */
2490
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2491
+	/**
2492
+	 * This is used to add the content to the add listing page sidebar.
2493
+	 *
2494
+	 * @since 1.0.0
2495
+	 */
2496
+	do_action('geodir_add_listing_sidebar_inside');
2497
+	/** This action is documented in geodirectory_template_actions.php */
2498
+	do_action('geodir_sidebar_right_close', 'details-page');
2499 2499
 }
2500 2500
 
2501 2501
 ###############################################
@@ -2512,11 +2512,11 @@  discard block
 block discarded – undo
2512 2512
  */
2513 2513
 function geodir_action_geodir_sidebar_signup_top()
2514 2514
 {
2515
-    ?>
2515
+	?>
2516 2516
     <div
2517 2517
         class="<?php
2518
-        /** This action is documented in geodirectory_template_actions.php */
2519
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2518
+		/** This action is documented in geodirectory_template_actions.php */
2519
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2520 2520
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2521 2521
     </div><!-- clearfix ends here-->
2522 2522
 <?php
@@ -2535,9 +2535,9 @@  discard block
 block discarded – undo
2535 2535
 function geodir_action_signup_forms()
2536 2536
 {
2537 2537
 
2538
-    global $user_login;
2538
+	global $user_login;
2539 2539
 
2540
-    ?>
2540
+	?>
2541 2541
     <script type="text/javascript">
2542 2542
         <?php if ( $user_login ) { ?>
2543 2543
         setTimeout(function () {
@@ -2573,65 +2573,65 @@  discard block
 block discarded – undo
2573 2573
         <?php } ?>
2574 2574
     </script><?php
2575 2575
 
2576
-    global $errors;
2577
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2578
-        $errors->add('claim_login', LOGIN_CLAIM);
2579
-
2580
-    if (!empty($errors)) {
2581
-        foreach ($errors as $errorsObj) {
2582
-            foreach ($errorsObj as $key => $val) {
2583
-                for ($i = 0; $i < count($val); $i++) {
2584
-                    echo "<div class=sucess_msg>" . $val[$i] . '</div>';
2585
-                    $registration_error_msg = 1;
2586
-                }
2587
-            }
2588
-        }
2589
-    }
2576
+	global $errors;
2577
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2578
+		$errors->add('claim_login', LOGIN_CLAIM);
2579
+
2580
+	if (!empty($errors)) {
2581
+		foreach ($errors as $errorsObj) {
2582
+			foreach ($errorsObj as $key => $val) {
2583
+				for ($i = 0; $i < count($val); $i++) {
2584
+					echo "<div class=sucess_msg>" . $val[$i] . '</div>';
2585
+					$registration_error_msg = 1;
2586
+				}
2587
+			}
2588
+		}
2589
+	}
2590 2590
 
2591
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2592
-        ?>
2591
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2592
+		?>
2593 2593
 
2594 2594
         <div class="login_form">
2595 2595
             <?php
2596
-            /**
2597
-             * Contains login form template.
2598
-             *
2599
-             * @since 1.0.0
2600
-             */
2601
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2596
+			/**
2597
+			 * Contains login form template.
2598
+			 *
2599
+			 * @since 1.0.0
2600
+			 */
2601
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2602 2602
         </div>
2603 2603
 
2604 2604
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
2605 2605
 
2606 2606
         <div class="registration_form">
2607 2607
             <?php
2608
-            /**
2609
-             * Contains registration form template.
2610
-             *
2611
-             * @since 1.0.0
2612
-             */
2613
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2608
+			/**
2609
+			 * Contains registration form template.
2610
+			 *
2611
+			 * @since 1.0.0
2612
+			 */
2613
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2614 2614
         </div>
2615 2615
 
2616 2616
     <?php } else { ?>
2617 2617
 
2618 2618
         <div class="login_form_l">
2619 2619
             <?php
2620
-            /**
2621
-             * Contains login form template.
2622
-             *
2623
-             * @since 1.0.0
2624
-             */
2625
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2620
+			/**
2621
+			 * Contains login form template.
2622
+			 *
2623
+			 * @since 1.0.0
2624
+			 */
2625
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2626 2626
         </div>
2627 2627
         <div class="registration_form_r">
2628 2628
             <?php
2629
-            /**
2630
-             * Contains registration form template.
2631
-             *
2632
-             * @since 1.0.0
2633
-             */
2634
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2629
+			/**
2630
+			 * Contains registration form template.
2631
+			 *
2632
+			 * @since 1.0.0
2633
+			 */
2634
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2635 2635
         </div>
2636 2636
 
2637 2637
     <?php }?>
@@ -2662,66 +2662,66 @@  discard block
 block discarded – undo
2662 2662
  */
2663 2663
 function geodir_action_author_page_title()
2664 2664
 {
2665
-    global $term;
2665
+	global $term;
2666 2666
 
2667
-    $gd_post_type = geodir_get_current_posttype();
2668
-    $post_type_info = get_post_type_object($gd_post_type);
2667
+	$gd_post_type = geodir_get_current_posttype();
2668
+	$post_type_info = get_post_type_object($gd_post_type);
2669 2669
 
2670
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2671
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2672
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2673
-    }
2670
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2671
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2672
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2673
+	}
2674 2674
 
2675
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2676
-    $single_name = $post_type_info->labels->singular_name;
2675
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2676
+	$single_name = $post_type_info->labels->singular_name;
2677 2677
 
2678
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2678
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2679 2679
 
2680
-    if (!empty($term)) {
2681
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2682
-        if (!empty($current_term))
2683
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2684
-    }
2680
+	if (!empty($term)) {
2681
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2682
+		if (!empty($current_term))
2683
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2684
+	}
2685 2685
 
2686 2686
 
2687
-    if (is_search()) {
2688
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2687
+	if (is_search()) {
2688
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2689 2689
 
2690
-    }
2691
-    /** This action is documented in geodirectory_template_actions.php */
2692
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2693
-    /** This action is documented in geodirectory_template_actions.php */
2694
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2690
+	}
2691
+	/** This action is documented in geodirectory_template_actions.php */
2692
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2693
+	/** This action is documented in geodirectory_template_actions.php */
2694
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2695 2695
 
2696
-    $title = $list_title;
2697
-    if(geodir_is_page('author')){
2698
-        $gd_page = 'author';
2699
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2700
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2701
-        }else{
2702
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2703
-        }
2696
+	$title = $list_title;
2697
+	if(geodir_is_page('author')){
2698
+		$gd_page = 'author';
2699
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2700
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2701
+		}else{
2702
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2703
+		}
2704 2704
 
2705
-    }
2705
+	}
2706 2706
 
2707 2707
 
2708
-    /**
2709
-     * Filter page title to replace variables.
2710
-     *
2711
-     * @since 1.5.4
2712
-     * @param string $title The page title including variables.
2713
-     * @param string $gd_page The GeoDirectory page type if any.
2714
-     */
2715
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2708
+	/**
2709
+	 * Filter page title to replace variables.
2710
+	 *
2711
+	 * @since 1.5.4
2712
+	 * @param string $title The page title including variables.
2713
+	 * @param string $gd_page The GeoDirectory page type if any.
2714
+	 */
2715
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2716 2716
 
2717
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2718
-        /**
2719
-         * Filter the author page title text.
2720
-         *
2721
-         * @since 1.0.0
2722
-         * @param string $list_title The title for the page.
2723
-         */
2724
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2717
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2718
+		/**
2719
+		 * Filter the author page title text.
2720
+		 *
2721
+		 * @since 1.0.0
2722
+		 * @param string $list_title The title for the page.
2723
+		 */
2724
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2725 2725
 }
2726 2726
 
2727 2727
 
@@ -2739,11 +2739,11 @@  discard block
 block discarded – undo
2739 2739
  */
2740 2740
 function geodir_action_geodir_sidebar_author_top()
2741 2741
 {
2742
-    if (get_option('geodir_show_author_top_section')) { ?>
2742
+	if (get_option('geodir_show_author_top_section')) { ?>
2743 2743
         <div
2744 2744
             class="<?php
2745
-            /** This action is documented in geodirectory_template_actions.php */
2746
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2745
+			/** This action is documented in geodirectory_template_actions.php */
2746
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2747 2747
             <?php dynamic_sidebar('geodir_author_top'); ?>
2748 2748
         </div><!-- clearfix ends here-->
2749 2749
     <?php }
@@ -2759,7 +2759,7 @@  discard block
 block discarded – undo
2759 2759
  */
2760 2760
 function geodir_author_left_section()
2761 2761
 {
2762
-    if (get_option('geodir_show_author_left_section')) { ?>
2762
+	if (get_option('geodir_show_author_left_section')) { ?>
2763 2763
         <div class="geodir-content-left geodir-sidebar-wrap">
2764 2764
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2765 2765
         </div><!-- end geodir-content-left -->
@@ -2780,19 +2780,19 @@  discard block
 block discarded – undo
2780 2780
  */
2781 2781
 function geodir_action_author_sidebar_left()
2782 2782
 {
2783
-    if (get_option('geodir_show_author_left_section')) {
2783
+	if (get_option('geodir_show_author_left_section')) {
2784 2784
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2785
-        /** This action is documented in geodirectory_template_actions.php */
2786
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2787
-        /**
2788
-         * This is used to add the content to the author page left sidebar (if active).
2789
-         *
2790
-         * @since 1.0.0
2791
-         */
2792
-        do_action('geodir_author_sidebar_left_inside');
2793
-        /** This action is documented in geodirectory_template_actions.php */
2794
-        do_action('geodir_sidebar_left_close', 'author-page');
2795
-    }
2785
+		/** This action is documented in geodirectory_template_actions.php */
2786
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2787
+		/**
2788
+		 * This is used to add the content to the author page left sidebar (if active).
2789
+		 *
2790
+		 * @since 1.0.0
2791
+		 */
2792
+		do_action('geodir_author_sidebar_left_inside');
2793
+		/** This action is documented in geodirectory_template_actions.php */
2794
+		do_action('geodir_sidebar_left_close', 'author-page');
2795
+	}
2796 2796
 }
2797 2797
 
2798 2798
 /**
@@ -2805,7 +2805,7 @@  discard block
 block discarded – undo
2805 2805
  */
2806 2806
 function geodir_author_right_section()
2807 2807
 {
2808
-    if (get_option('geodir_show_author_right_section')) { ?>
2808
+	if (get_option('geodir_show_author_right_section')) { ?>
2809 2809
         <div class="geodir-content-right geodir-sidebar-wrap">
2810 2810
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2811 2811
         </div><!-- end geodir-content-right -->
@@ -2825,18 +2825,18 @@  discard block
 block discarded – undo
2825 2825
  */
2826 2826
 function geodir_action_author_sidebar_right()
2827 2827
 {
2828
-    if (get_option('geodir_show_author_right_section')) {
2829
-        /** This action is documented in geodirectory_template_actions.php */
2830
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2831
-        /**
2832
-         * This is used to add the content to the author page right sidebar (if active).
2833
-         *
2834
-         * @since 1.0.0
2835
-         */
2836
-        do_action('geodir_author_sidebar_right_inside');
2837
-        /** This action is documented in geodirectory_template_actions.php */
2838
-        do_action('geodir_sidebar_right_close', 'author-page');
2839
-    }
2828
+	if (get_option('geodir_show_author_right_section')) {
2829
+		/** This action is documented in geodirectory_template_actions.php */
2830
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2831
+		/**
2832
+		 * This is used to add the content to the author page right sidebar (if active).
2833
+		 *
2834
+		 * @since 1.0.0
2835
+		 */
2836
+		do_action('geodir_author_sidebar_right_inside');
2837
+		/** This action is documented in geodirectory_template_actions.php */
2838
+		do_action('geodir_sidebar_right_close', 'author-page');
2839
+	}
2840 2840
 }
2841 2841
 
2842 2842
 /**
@@ -2848,14 +2848,14 @@  discard block
 block discarded – undo
2848 2848
  */
2849 2849
 function geodir_action_author_content_inside()
2850 2850
 {
2851
-    global $gridview_columns;
2852
-    $listing_view = get_option('geodir_author_view');
2853
-    if (strstr($listing_view, 'gridview')) {
2854
-        $gridview_columns = $listing_view;
2855
-        $listing_view_exp = explode('_', $listing_view);
2856
-        $listing_view = $listing_view_exp[0];
2857
-    }
2858
-    geodir_get_template_part('listing', 'listview');
2851
+	global $gridview_columns;
2852
+	$listing_view = get_option('geodir_author_view');
2853
+	if (strstr($listing_view, 'gridview')) {
2854
+		$gridview_columns = $listing_view;
2855
+		$listing_view_exp = explode('_', $listing_view);
2856
+		$listing_view = $listing_view_exp[0];
2857
+	}
2858
+	geodir_get_template_part('listing', 'listview');
2859 2859
 }
2860 2860
 
2861 2861
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2870,22 +2870,22 @@  discard block
 block discarded – undo
2870 2870
  */
2871 2871
 function geodir_action_author_content()
2872 2872
 {
2873
-    /** This action is documented in geodirectory_template_actions.php */
2874
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2875
-    echo '<div class="clearfix">';
2876
-    /** This action is documented in geodirectory_template_actions.php */
2877
-    do_action('geodir_before_listing');
2878
-    echo '</div>';
2879
-    /**
2880
-     * This is used to add the content to the author page main content.
2881
-     *
2882
-     * @since 1.0.0
2883
-     */
2884
-    do_action('geodir_author_content_inside');
2885
-    /** This action is documented in geodirectory_template_actions.php */
2886
-    do_action('geodir_after_listing');
2887
-    /** This action is documented in geodirectory_template_actions.php */
2888
-    do_action('geodir_main_content_close', 'author-page');
2873
+	/** This action is documented in geodirectory_template_actions.php */
2874
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2875
+	echo '<div class="clearfix">';
2876
+	/** This action is documented in geodirectory_template_actions.php */
2877
+	do_action('geodir_before_listing');
2878
+	echo '</div>';
2879
+	/**
2880
+	 * This is used to add the content to the author page main content.
2881
+	 *
2882
+	 * @since 1.0.0
2883
+	 */
2884
+	do_action('geodir_author_content_inside');
2885
+	/** This action is documented in geodirectory_template_actions.php */
2886
+	do_action('geodir_after_listing');
2887
+	/** This action is documented in geodirectory_template_actions.php */
2888
+	do_action('geodir_main_content_close', 'author-page');
2889 2889
 }
2890 2890
 
2891 2891
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2899,11 +2899,11 @@  discard block
 block discarded – undo
2899 2899
  */
2900 2900
 function geodir_action_sidebar_author_bottom_section()
2901 2901
 {
2902
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2902
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2903 2903
         <div
2904 2904
             class="<?php
2905
-            /** This action is documented in geodirectory_template_actions.php */
2906
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2905
+			/** This action is documented in geodirectory_template_actions.php */
2906
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2907 2907
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2908 2908
         </div><!-- clearfix ends here-->
2909 2909
     <?php }
@@ -2922,23 +2922,23 @@  discard block
 block discarded – undo
2922 2922
  */
2923 2923
 function geodir_action_search_page_title()
2924 2924
 {
2925
-    $gd_post_type = geodir_get_current_posttype();
2926
-    $post_type_info = get_post_type_object($gd_post_type);
2925
+	$gd_post_type = geodir_get_current_posttype();
2926
+	$post_type_info = get_post_type_object($gd_post_type);
2927 2927
 
2928
-    $pt_name = '';
2929
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2928
+	$pt_name = '';
2929
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2930 2930
 
2931
-    if (is_search()) {
2932
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2931
+	if (is_search()) {
2932
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2933 2933
 
2934
-    }
2935
-    /** This action is documented in geodirectory_template_actions.php */
2936
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2937
-    /** This action is documented in geodirectory_template_actions.php */
2938
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2939
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2940
-        /** This action is documented in geodirectory_template_actions.php */
2941
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2934
+	}
2935
+	/** This action is documented in geodirectory_template_actions.php */
2936
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2937
+	/** This action is documented in geodirectory_template_actions.php */
2938
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2939
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2940
+		/** This action is documented in geodirectory_template_actions.php */
2941
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2942 2942
 }
2943 2943
 
2944 2944
 // action for adding the listings page top widget area
@@ -2954,11 +2954,11 @@  discard block
 block discarded – undo
2954 2954
  */
2955 2955
 function geodir_action_geodir_sidebar_search_top()
2956 2956
 {
2957
-    if (get_option('geodir_show_search_top_section')) { ?>
2957
+	if (get_option('geodir_show_search_top_section')) { ?>
2958 2958
         <div
2959 2959
             class="<?php
2960
-            /** This action is documented in geodirectory_template_actions.php */
2961
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2960
+			/** This action is documented in geodirectory_template_actions.php */
2961
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2962 2962
             <?php dynamic_sidebar('geodir_search_top'); ?>
2963 2963
         </div><!-- clearfix ends here-->
2964 2964
     <?php }
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
  */
2975 2975
 function geodir_search_left_section()
2976 2976
 {
2977
-    if (get_option('geodir_show_search_left_section')) { ?>
2977
+	if (get_option('geodir_show_search_left_section')) { ?>
2978 2978
         <div class="geodir-content-left geodir-sidebar-wrap">
2979 2979
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
2980 2980
         </div><!-- end geodir-content-left -->
@@ -2994,19 +2994,19 @@  discard block
 block discarded – undo
2994 2994
  */
2995 2995
 function geodir_action_search_sidebar_left()
2996 2996
 {
2997
-    if (get_option('geodir_show_search_left_section')) {
2997
+	if (get_option('geodir_show_search_left_section')) {
2998 2998
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2999
-        /** This action is documented in geodirectory_template_actions.php */
3000
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3001
-        /**
3002
-         * This is used to add the content to the search page left sidebar (if active).
3003
-         *
3004
-         * @since 1.0.0
3005
-         */
3006
-        do_action('geodir_search_sidebar_left_inside');
3007
-        /** This action is documented in geodirectory_template_actions.php */
3008
-        do_action('geodir_sidebar_left_close', 'search-page');
3009
-    }
2999
+		/** This action is documented in geodirectory_template_actions.php */
3000
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3001
+		/**
3002
+		 * This is used to add the content to the search page left sidebar (if active).
3003
+		 *
3004
+		 * @since 1.0.0
3005
+		 */
3006
+		do_action('geodir_search_sidebar_left_inside');
3007
+		/** This action is documented in geodirectory_template_actions.php */
3008
+		do_action('geodir_sidebar_left_close', 'search-page');
3009
+	}
3010 3010
 }
3011 3011
 
3012 3012
 /**
@@ -3019,7 +3019,7 @@  discard block
 block discarded – undo
3019 3019
  */
3020 3020
 function geodir_search_right_section()
3021 3021
 {
3022
-    if (get_option('geodir_show_search_right_section')) { ?>
3022
+	if (get_option('geodir_show_search_right_section')) { ?>
3023 3023
         <div class="geodir-content-right geodir-sidebar-wrap">
3024 3024
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3025 3025
         </div><!-- end geodir-content-right -->
@@ -3039,18 +3039,18 @@  discard block
 block discarded – undo
3039 3039
  */
3040 3040
 function geodir_action_search_sidebar_right()
3041 3041
 {
3042
-    if (get_option('geodir_show_search_right_section')) {
3043
-        /** This action is documented in geodirectory_template_actions.php */
3044
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3045
-        /**
3046
-         * This is used to add the content to the search page right sidebar (if active).
3047
-         *
3048
-         * @since 1.0.0
3049
-         */
3050
-        do_action('geodir_search_sidebar_right_inside');
3051
-        /** This action is documented in geodirectory_template_actions.php */
3052
-        do_action('geodir_sidebar_right_close', 'search-page');
3053
-    }
3042
+	if (get_option('geodir_show_search_right_section')) {
3043
+		/** This action is documented in geodirectory_template_actions.php */
3044
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3045
+		/**
3046
+		 * This is used to add the content to the search page right sidebar (if active).
3047
+		 *
3048
+		 * @since 1.0.0
3049
+		 */
3050
+		do_action('geodir_search_sidebar_right_inside');
3051
+		/** This action is documented in geodirectory_template_actions.php */
3052
+		do_action('geodir_sidebar_right_close', 'search-page');
3053
+	}
3054 3054
 }
3055 3055
 
3056 3056
 
@@ -3065,11 +3065,11 @@  discard block
 block discarded – undo
3065 3065
  */
3066 3066
 function geodir_action_sidebar_search_bottom_section()
3067 3067
 {
3068
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3068
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3069 3069
         <div
3070 3070
             class="<?php
3071
-            /** This action is documented in geodirectory_template_actions.php */
3072
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3071
+			/** This action is documented in geodirectory_template_actions.php */
3072
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3073 3073
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3074 3074
         </div><!-- clearfix ends here-->
3075 3075
     <?php }
@@ -3084,14 +3084,14 @@  discard block
 block discarded – undo
3084 3084
  */
3085 3085
 function geodir_action_search_content_inside()
3086 3086
 {
3087
-    global $gridview_columns;
3088
-    $listing_view = get_option('geodir_search_view');
3089
-    if (strstr($listing_view, 'gridview')) {
3090
-        $gridview_columns = $listing_view;
3091
-        $listing_view_exp = explode('_', $listing_view);
3092
-        $listing_view = $listing_view_exp[0];
3093
-    }
3094
-    geodir_get_template_part('listing', 'listview');
3087
+	global $gridview_columns;
3088
+	$listing_view = get_option('geodir_search_view');
3089
+	if (strstr($listing_view, 'gridview')) {
3090
+		$gridview_columns = $listing_view;
3091
+		$listing_view_exp = explode('_', $listing_view);
3092
+		$listing_view = $listing_view_exp[0];
3093
+	}
3094
+	geodir_get_template_part('listing', 'listview');
3095 3095
 }
3096 3096
 
3097 3097
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3107,22 +3107,22 @@  discard block
 block discarded – undo
3107 3107
  */
3108 3108
 function geodir_action_search_content()
3109 3109
 {
3110
-    /** This action is documented in geodirectory_template_actions.php */
3111
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3112
-    echo '<div class="clearfix">';
3113
-    /** This action is documented in geodirectory_template_actions.php */
3114
-    do_action('geodir_before_listing');
3115
-    echo '</div>';
3116
-    /**
3117
-     * This is used to add the content to the search page main content.
3118
-     *
3119
-     * @since 1.0.0
3120
-     */
3121
-    do_action('geodir_search_content_inside');
3122
-    /** This action is documented in geodirectory_template_actions.php */
3123
-    do_action('geodir_after_listing');
3124
-    /** This action is documented in geodirectory_template_actions.php */
3125
-    do_action('geodir_main_content_close', 'search-page');
3110
+	/** This action is documented in geodirectory_template_actions.php */
3111
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3112
+	echo '<div class="clearfix">';
3113
+	/** This action is documented in geodirectory_template_actions.php */
3114
+	do_action('geodir_before_listing');
3115
+	echo '</div>';
3116
+	/**
3117
+	 * This is used to add the content to the search page main content.
3118
+	 *
3119
+	 * @since 1.0.0
3120
+	 */
3121
+	do_action('geodir_search_content_inside');
3122
+	/** This action is documented in geodirectory_template_actions.php */
3123
+	do_action('geodir_after_listing');
3124
+	/** This action is documented in geodirectory_template_actions.php */
3125
+	do_action('geodir_main_content_close', 'search-page');
3126 3126
 }
3127 3127
 
3128 3128
 ###############################################
@@ -3145,11 +3145,11 @@  discard block
 block discarded – undo
3145 3145
  */
3146 3146
 function geodir_action_geodir_sidebar_home_top()
3147 3147
 {
3148
-    if (get_option('geodir_show_home_top_section')) { ?>
3148
+	if (get_option('geodir_show_home_top_section')) { ?>
3149 3149
         <div
3150 3150
             class="<?php
3151
-            /** This action is documented in geodirectory_template_actions.php */
3152
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3151
+			/** This action is documented in geodirectory_template_actions.php */
3152
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3153 3153
             <?php dynamic_sidebar('geodir_home_top'); ?>
3154 3154
         </div><!-- clearfix ends here-->
3155 3155
     <?php }
@@ -3165,7 +3165,7 @@  discard block
 block discarded – undo
3165 3165
  */
3166 3166
 function geodir_home_left_section()
3167 3167
 {
3168
-    if (get_option('geodir_show_home_left_section')) { ?>
3168
+	if (get_option('geodir_show_home_left_section')) { ?>
3169 3169
         <div class="geodir-content-left geodir-sidebar-wrap">
3170 3170
             <?php dynamic_sidebar('geodir_home_left'); ?>
3171 3171
         </div><!-- end geodir-content-left -->
@@ -3187,19 +3187,19 @@  discard block
 block discarded – undo
3187 3187
  */
3188 3188
 function geodir_action_home_sidebar_left()
3189 3189
 {
3190
-    if (get_option('geodir_show_home_left_section')) {
3190
+	if (get_option('geodir_show_home_left_section')) {
3191 3191
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3192
-        /** This action is documented in geodirectory_template_actions.php */
3193
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3194
-        /**
3195
-         * This is used to add the content to the home page left sidebar (if active).
3196
-         *
3197
-         * @since 1.0.0
3198
-         */
3199
-        do_action('geodir_home_sidebar_left_inside');
3200
-        /** This action is documented in geodirectory_template_actions.php */
3201
-        do_action('geodir_sidebar_left_close', 'home-page');
3202
-    }
3192
+		/** This action is documented in geodirectory_template_actions.php */
3193
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3194
+		/**
3195
+		 * This is used to add the content to the home page left sidebar (if active).
3196
+		 *
3197
+		 * @since 1.0.0
3198
+		 */
3199
+		do_action('geodir_home_sidebar_left_inside');
3200
+		/** This action is documented in geodirectory_template_actions.php */
3201
+		do_action('geodir_sidebar_left_close', 'home-page');
3202
+	}
3203 3203
 }
3204 3204
 
3205 3205
 /**
@@ -3212,7 +3212,7 @@  discard block
 block discarded – undo
3212 3212
  */
3213 3213
 function geodir_home_right_section()
3214 3214
 {
3215
-    if (get_option('geodir_show_home_right_section')) { ?>
3215
+	if (get_option('geodir_show_home_right_section')) { ?>
3216 3216
         <div class="geodir-content-right geodir-sidebar-wrap">
3217 3217
             <?php dynamic_sidebar('geodir_home_right'); ?>
3218 3218
         </div><!-- end geodir-content-right -->
@@ -3233,18 +3233,18 @@  discard block
 block discarded – undo
3233 3233
  */
3234 3234
 function geodir_action_home_sidebar_right()
3235 3235
 {
3236
-    if (get_option('geodir_show_home_right_section')) {
3237
-        /** This action is documented in geodirectory_template_actions.php */
3238
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3239
-        /**
3240
-         * This is used to add the content to the home page right sidebar (if active).
3241
-         *
3242
-         * @since 1.0.0
3243
-         */
3244
-        do_action('geodir_home_sidebar_right_inside');
3245
-        /** This action is documented in geodirectory_template_actions.php */
3246
-        do_action('geodir_sidebar_right_close', 'home-page');
3247
-    }
3236
+	if (get_option('geodir_show_home_right_section')) {
3237
+		/** This action is documented in geodirectory_template_actions.php */
3238
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3239
+		/**
3240
+		 * This is used to add the content to the home page right sidebar (if active).
3241
+		 *
3242
+		 * @since 1.0.0
3243
+		 */
3244
+		do_action('geodir_home_sidebar_right_inside');
3245
+		/** This action is documented in geodirectory_template_actions.php */
3246
+		do_action('geodir_sidebar_right_close', 'home-page');
3247
+	}
3248 3248
 }
3249 3249
 
3250 3250
 /**
@@ -3255,7 +3255,7 @@  discard block
 block discarded – undo
3255 3255
  */
3256 3256
 function geodir_action_home_content_inside()
3257 3257
 {
3258
-    dynamic_sidebar('geodir_home_content');
3258
+	dynamic_sidebar('geodir_home_content');
3259 3259
 }
3260 3260
 
3261 3261
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3270,28 +3270,28 @@  discard block
 block discarded – undo
3270 3270
  */
3271 3271
 function geodir_action_home_content()
3272 3272
 {
3273
-    /** This action is documented in geodirectory_template_actions.php */
3274
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3275
-    /**
3276
-     * This called before the home page main content.
3277
-     *
3278
-     * @since 1.0.0
3279
-     */
3280
-    do_action('geodir_before_home_content');
3281
-    /**
3282
-     * This is used to add the content to the home page main content.
3283
-     *
3284
-     * @since 1.0.0
3285
-     */
3286
-    do_action('geodir_home_content_inside');
3287
-    /**
3288
-     * This is called after the homepage main content.
3289
-     *
3290
-     * @since 1.0.0
3291
-     */
3292
-    do_action('geodir_after_home_content');
3293
-    /** This action is documented in geodirectory_template_actions.php */
3294
-    do_action('geodir_main_content_close', 'home-page');
3273
+	/** This action is documented in geodirectory_template_actions.php */
3274
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3275
+	/**
3276
+	 * This called before the home page main content.
3277
+	 *
3278
+	 * @since 1.0.0
3279
+	 */
3280
+	do_action('geodir_before_home_content');
3281
+	/**
3282
+	 * This is used to add the content to the home page main content.
3283
+	 *
3284
+	 * @since 1.0.0
3285
+	 */
3286
+	do_action('geodir_home_content_inside');
3287
+	/**
3288
+	 * This is called after the homepage main content.
3289
+	 *
3290
+	 * @since 1.0.0
3291
+	 */
3292
+	do_action('geodir_after_home_content');
3293
+	/** This action is documented in geodirectory_template_actions.php */
3294
+	do_action('geodir_main_content_close', 'home-page');
3295 3295
 }
3296 3296
 
3297 3297
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3306,11 +3306,11 @@  discard block
 block discarded – undo
3306 3306
  */
3307 3307
 function geodir_action_sidebar_home_bottom_section()
3308 3308
 {
3309
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3309
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3310 3310
         <div
3311 3311
             class="<?php
3312
-            /** This action is documented in geodirectory_template_actions.php */
3313
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3312
+			/** This action is documented in geodirectory_template_actions.php */
3313
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3314 3314
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3315 3315
         </div><!-- clearfix ends here-->
3316 3316
     <?php }
@@ -3338,13 +3338,13 @@  discard block
 block discarded – undo
3338 3338
  */
3339 3339
 function geodir_filter_listing_page_title($list_title)
3340 3340
 {
3341
-    if (is_search() && trim(get_search_query()) == '') {
3342
-        $gd_post_type = geodir_get_current_posttype();
3343
-        $post_type_info = get_post_type_object($gd_post_type);
3341
+	if (is_search() && trim(get_search_query()) == '') {
3342
+		$gd_post_type = geodir_get_current_posttype();
3343
+		$post_type_info = get_post_type_object($gd_post_type);
3344 3344
 
3345
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3346
-    }
3347
-    return $list_title;
3345
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3346
+	}
3347
+	return $list_title;
3348 3348
 }
3349 3349
 
3350 3350
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3359,61 +3359,61 @@  discard block
 block discarded – undo
3359 3359
  * @param string $gd_page The geodirectory page type. Default null.
3360 3360
  */
3361 3361
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3362
-    global $post;
3362
+	global $post;
3363 3363
         
3364
-    $gd_page_id = NULL;
3365
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3366
-        $gd_page_id = geodir_home_page_id();
3367
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3368
-        $gd_page_id = geodir_preview_page_id();
3369
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3370
-        $gd_page_id = geodir_add_listing_page_id();
3371
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3372
-        $gd_page_id = geodir_success_page_id();
3373
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3374
-        $gd_page_id = geodir_location_page_id();
3375
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3376
-        $gd_page_id = geodir_info_page_id();
3377
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3378
-        $gd_page_id = geodir_login_page_id();
3379
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3380
-        $gd_page_id = geodir_payment_checkout_page_id();
3381
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3382
-        $gd_page_id = geodir_payment_invoices_page_id();
3383
-    }
3364
+	$gd_page_id = NULL;
3365
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3366
+		$gd_page_id = geodir_home_page_id();
3367
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3368
+		$gd_page_id = geodir_preview_page_id();
3369
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3370
+		$gd_page_id = geodir_add_listing_page_id();
3371
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3372
+		$gd_page_id = geodir_success_page_id();
3373
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3374
+		$gd_page_id = geodir_location_page_id();
3375
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3376
+		$gd_page_id = geodir_info_page_id();
3377
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3378
+		$gd_page_id = geodir_login_page_id();
3379
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3380
+		$gd_page_id = geodir_payment_checkout_page_id();
3381
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3382
+		$gd_page_id = geodir_payment_invoices_page_id();
3383
+	}
3384 3384
     
3385
-    if (!$gd_page_id > 0) {
3386
-        return;
3387
-    }
3385
+	if (!$gd_page_id > 0) {
3386
+		return;
3387
+	}
3388 3388
     
3389
-    $display = 'before';
3390
-    /**
3391
-     * Filter the position to display the page content.
3392
-     *
3393
-     * @since 1.6.3
3394
-     *
3395
-     * @param string $display Position to add the post content.
3396
-     * @param string $gd_page The geodirectory page type.
3397
-     */
3398
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3389
+	$display = 'before';
3390
+	/**
3391
+	 * Filter the position to display the page content.
3392
+	 *
3393
+	 * @since 1.6.3
3394
+	 *
3395
+	 * @param string $display Position to add the post content.
3396
+	 * @param string $gd_page The geodirectory page type.
3397
+	 */
3398
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3399 3399
     
3400
-    if ($position !== $display) {
3401
-        return;
3402
-    }
3400
+	if ($position !== $display) {
3401
+		return;
3402
+	}
3403 3403
         
3404
-    $gd_post = $post;
3404
+	$gd_post = $post;
3405 3405
     
3406
-    setup_postdata(get_post($gd_page_id));
3406
+	setup_postdata(get_post($gd_page_id));
3407 3407
     
3408
-    if (get_the_content()) {
3409
-        ?>
3408
+	if (get_the_content()) {
3409
+		?>
3410 3410
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3411 3411
         <?php
3412
-    }
3412
+	}
3413 3413
     
3414
-    $post = $gd_post;
3415
-    if (!empty($gd_post) && is_object($gd_post)) {
3416
-        setup_postdata($gd_post);
3417
-    }
3414
+	$post = $gd_post;
3415
+	if (!empty($gd_post) && is_object($gd_post)) {
3416
+		setup_postdata($gd_post);
3417
+	}
3418 3418
 }
3419 3419
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
3420 3420
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/cat_meta.php 1 patch
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -11,142 +11,142 @@  discard block
 block discarded – undo
11 11
 //include the main class file
12 12
 require_once("Tax-meta-class.php");
13 13
 if (is_admin()) {
14
-    /*
14
+	/*
15 15
      * prefix of meta keys, optional
16 16
      * use underscore (_) at the beginning to make keys hidden, for example $prefix = '_ba_';
17 17
      *  you also can make prefix empty to disable it
18 18
      *
19 19
      */
20 20
 
21
-    $prefix = 'ct_';
22
-    /*
21
+	$prefix = 'ct_';
22
+	/*
23 23
      * configure your meta box
24 24
      */
25 25
 
26
-    $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
-        'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
-    );
26
+	$config = array(
27
+		'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
+		'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
+		'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
+		'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
+		'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
+		'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
+		'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
+	);
35 35
 
36 36
 
37
-    /*
37
+	/*
38 38
      * Initiate your meta box
39 39
      */
40
-    $my_meta = new Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
-    /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45
-
46
-    $my_meta->addSelect($prefix . 'cat_schema',
47
-    /*
40
+	$my_meta = new Tax_Meta_Class($config);
41
+	$my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+	$my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+	$my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
+	/*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45
+
46
+	$my_meta->addSelect($prefix . 'cat_schema',
47
+	/*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-        apply_filters('geodir_cat_schemas',array(
53
-            '' => __('Default (LocalBusiness)', 'geodirectory'),
54
-            'AccountingService' => 'AccountingService',
55
-            'Attorney' => 'Attorney',
56
-            'AutoBodyShop' => 'AutoBodyShop',
57
-            'AutoDealer' => 'AutoDealer',
58
-            'AutoPartsStore' => 'AutoPartsStore',
59
-            'AutoRental' => 'AutoRental',
60
-            'AutoRepair' => 'AutoRepair',
61
-            'AutoWash' => 'AutoWash',
62
-            'Bakery' => 'Bakery',
63
-            'BarOrPub' => 'BarOrPub',
64
-            'BeautySalon' => 'BeautySalon',
65
-            'BedAndBreakfast' => 'BedAndBreakfast',
66
-            'BikeStore' => 'BikeStore',
67
-            'BookStore' => 'BookStore',
68
-            'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
-            'Campground' => 'Campground',
70
-            'ChildCare' => 'ChildCare',
71
-            'ClothingStore' => 'ClothingStore',
72
-            'ComputerStore' => 'ComputerStore',
73
-            'DaySpa' => 'DaySpa',
74
-            'Dentist' => 'Dentist',
75
-            'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
-            'Electrician' => 'Electrician',
77
-            'ElectronicsStore' => 'ElectronicsStore',
78
-            'EmergencyService' => 'EmergencyService',
79
-            'EntertainmentBusiness' => 'EntertainmentBusiness',
80
-            'Event' => 'Event',
81
-            'EventVenue' => 'EventVenue',
82
-            'ExerciseGym' => 'ExerciseGym',
83
-            'FinancialService' => 'FinancialService',
84
-            'Florist' => 'Florist',
85
-            'FoodEstablishment' => 'FoodEstablishment',
86
-            'FurnitureStore' => 'FurnitureStore',
87
-            'GardenStore' => 'GardenStore',
88
-            'GeneralContractor' => 'GeneralContractor',
89
-            'GolfCourse' => 'GolfCourse',
90
-            'HairSalon' => 'HairSalon',
91
-            'HardwareStore' => 'HardwareStore',
92
-            'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
-            'HobbyShop' => 'HobbyShop',
94
-            'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
-            'HomeGoodsStore' => 'HomeGoodsStore',
96
-            'Hospital' => 'Hospital',
97
-            'Hostel' => 'Hostel',
98
-            'Hotel' => 'Hotel',
99
-            'HousePainter' => 'HousePainter',
100
-            'HVACBusiness' => 'HVACBusiness',
101
-            'InsuranceAgency' => 'InsuranceAgency',
102
-            'JewelryStore' => 'JewelryStore',
103
-            'LiquorStore' => 'LiquorStore',
104
-            'Locksmith' => 'Locksmith',
105
-            'LodgingBusiness' => 'LodgingBusiness',
106
-            'MedicalClinic' => 'MedicalClinic',
107
-            'MensClothingStore' => 'MensClothingStore',
108
-            'MobilePhoneStore' => 'MobilePhoneStore',
109
-            'Motel' => 'Motel',
110
-            'MotorcycleDealer' => 'MotorcycleDealer',
111
-            'MotorcycleRepair' => 'MotorcycleRepair',
112
-            'MovingCompany' => 'MovingCompany',
113
-            'MusicStore' => 'MusicStore',
114
-            'NailSalon' => 'NailSalon',
115
-            'NightClub' => 'NightClub',
116
-            'Notary' => 'Notary',
117
-            'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
-            'Optician' => 'Optician',
119
-            'PetStore' => 'PetStore',
120
-            'Physician' => 'Physician',
121
-            'Plumber' => 'Plumber',
122
-            'ProfessionalService' => 'ProfessionalService',
123
-            'RealEstateAgent' => 'RealEstateAgent',
124
-            'Residence' => 'Residence',
125
-            'Restaurant' => 'Restaurant',
126
-            'RoofingContractor' => 'RoofingContractor',
127
-            'RVPark' => 'RVPark',
128
-            'School' => 'School',
129
-            'SelfStorage' => 'SelfStorage',
130
-            'ShoeStore' => 'ShoeStore',
131
-            'SkiResort' => 'SkiResort',
132
-            'SportingGoodsStore' => 'SportingGoodsStore',
133
-            'SportsClub' => 'SportsClub',
134
-            'Store' => 'Store',
135
-            'TattooParlor' => 'TattooParlor',
136
-            'Taxi' => 'Taxi',
137
-            'TennisComplex' => 'TennisComplex',
138
-            'TireShop' => 'TireShop',
139
-            'TouristAttraction' => 'TouristAttraction',
140
-            'ToyStore' => 'ToyStore',
141
-            'TravelAgency' => 'TravelAgency',
142
-            //'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
-            'VeterinaryCare' => 'VeterinaryCare',
144
-            'WholesaleStore' => 'WholesaleStore',
145
-            'Winery' => 'Winery'
146
-        )),
147
-        array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
148
-
149
-    /*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'),
52
+		apply_filters('geodir_cat_schemas',array(
53
+			'' => __('Default (LocalBusiness)', 'geodirectory'),
54
+			'AccountingService' => 'AccountingService',
55
+			'Attorney' => 'Attorney',
56
+			'AutoBodyShop' => 'AutoBodyShop',
57
+			'AutoDealer' => 'AutoDealer',
58
+			'AutoPartsStore' => 'AutoPartsStore',
59
+			'AutoRental' => 'AutoRental',
60
+			'AutoRepair' => 'AutoRepair',
61
+			'AutoWash' => 'AutoWash',
62
+			'Bakery' => 'Bakery',
63
+			'BarOrPub' => 'BarOrPub',
64
+			'BeautySalon' => 'BeautySalon',
65
+			'BedAndBreakfast' => 'BedAndBreakfast',
66
+			'BikeStore' => 'BikeStore',
67
+			'BookStore' => 'BookStore',
68
+			'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
+			'Campground' => 'Campground',
70
+			'ChildCare' => 'ChildCare',
71
+			'ClothingStore' => 'ClothingStore',
72
+			'ComputerStore' => 'ComputerStore',
73
+			'DaySpa' => 'DaySpa',
74
+			'Dentist' => 'Dentist',
75
+			'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
+			'Electrician' => 'Electrician',
77
+			'ElectronicsStore' => 'ElectronicsStore',
78
+			'EmergencyService' => 'EmergencyService',
79
+			'EntertainmentBusiness' => 'EntertainmentBusiness',
80
+			'Event' => 'Event',
81
+			'EventVenue' => 'EventVenue',
82
+			'ExerciseGym' => 'ExerciseGym',
83
+			'FinancialService' => 'FinancialService',
84
+			'Florist' => 'Florist',
85
+			'FoodEstablishment' => 'FoodEstablishment',
86
+			'FurnitureStore' => 'FurnitureStore',
87
+			'GardenStore' => 'GardenStore',
88
+			'GeneralContractor' => 'GeneralContractor',
89
+			'GolfCourse' => 'GolfCourse',
90
+			'HairSalon' => 'HairSalon',
91
+			'HardwareStore' => 'HardwareStore',
92
+			'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
+			'HobbyShop' => 'HobbyShop',
94
+			'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
+			'HomeGoodsStore' => 'HomeGoodsStore',
96
+			'Hospital' => 'Hospital',
97
+			'Hostel' => 'Hostel',
98
+			'Hotel' => 'Hotel',
99
+			'HousePainter' => 'HousePainter',
100
+			'HVACBusiness' => 'HVACBusiness',
101
+			'InsuranceAgency' => 'InsuranceAgency',
102
+			'JewelryStore' => 'JewelryStore',
103
+			'LiquorStore' => 'LiquorStore',
104
+			'Locksmith' => 'Locksmith',
105
+			'LodgingBusiness' => 'LodgingBusiness',
106
+			'MedicalClinic' => 'MedicalClinic',
107
+			'MensClothingStore' => 'MensClothingStore',
108
+			'MobilePhoneStore' => 'MobilePhoneStore',
109
+			'Motel' => 'Motel',
110
+			'MotorcycleDealer' => 'MotorcycleDealer',
111
+			'MotorcycleRepair' => 'MotorcycleRepair',
112
+			'MovingCompany' => 'MovingCompany',
113
+			'MusicStore' => 'MusicStore',
114
+			'NailSalon' => 'NailSalon',
115
+			'NightClub' => 'NightClub',
116
+			'Notary' => 'Notary',
117
+			'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
+			'Optician' => 'Optician',
119
+			'PetStore' => 'PetStore',
120
+			'Physician' => 'Physician',
121
+			'Plumber' => 'Plumber',
122
+			'ProfessionalService' => 'ProfessionalService',
123
+			'RealEstateAgent' => 'RealEstateAgent',
124
+			'Residence' => 'Residence',
125
+			'Restaurant' => 'Restaurant',
126
+			'RoofingContractor' => 'RoofingContractor',
127
+			'RVPark' => 'RVPark',
128
+			'School' => 'School',
129
+			'SelfStorage' => 'SelfStorage',
130
+			'ShoeStore' => 'ShoeStore',
131
+			'SkiResort' => 'SkiResort',
132
+			'SportingGoodsStore' => 'SportingGoodsStore',
133
+			'SportsClub' => 'SportsClub',
134
+			'Store' => 'Store',
135
+			'TattooParlor' => 'TattooParlor',
136
+			'Taxi' => 'Taxi',
137
+			'TennisComplex' => 'TennisComplex',
138
+			'TireShop' => 'TireShop',
139
+			'TouristAttraction' => 'TouristAttraction',
140
+			'ToyStore' => 'ToyStore',
141
+			'TravelAgency' => 'TravelAgency',
142
+			//'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
+			'VeterinaryCare' => 'VeterinaryCare',
144
+			'WholesaleStore' => 'WholesaleStore',
145
+			'Winery' => 'Winery'
146
+		)),
147
+		array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
148
+
149
+	/*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'),
150 150
     'random'=>__('Random','geodirectory'),
151 151
     'az'=>__('Alphabetical' , 'geodirectory'),
152 152
     'newest'=>__('Newest','geodirectory'),
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
     'low_review'=>__('Lowest Reviews','geodirectory')),
158 158
     array('name'=> __('Sort By','geodirectory'),'desc' => __('Select the default sort option.' ,'geodirectory'), 'std'=> array('selectkey2')));*/
159 159
 
160
-    // Show options for placecategories only
161
-    /*	if(isset($_REQUEST['taxonomy']) && in_array($_REQUEST['taxonomy'],$config['pages']) ){
160
+	// Show options for placecategories only
161
+	/*	if(isset($_REQUEST['taxonomy']) && in_array($_REQUEST['taxonomy'],$config['pages']) ){
162 162
         // Exclude sort options
163 163
         $my_meta->addCheckbox($prefix.'cat_exclude_rating',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory')));
164 164
         $my_meta->addCheckbox($prefix.'cat_exclude_reviews',array('name'=> __('<b>Exclude</b> Reviews sort option','geodirectory')));
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 
171 171
         }*/
172 172
 
173
-    //Finish Meta Box Declaration
174
-    $my_meta->Finish();
173
+	//Finish Meta Box Declaration
174
+	$my_meta->Finish();
175 175
 }
176 176
 
177 177
 
@@ -180,82 +180,82 @@  discard block
 block discarded – undo
180 180
 ##############################################################
181 181
 $gd_taxonomies = geodir_get_taxonomies();
182 182
 if (!empty($gd_taxonomies)) {
183
-    foreach ($gd_taxonomies as $gd_taxonomy) {
183
+	foreach ($gd_taxonomies as $gd_taxonomy) {
184 184
 
185
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
186
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
185
+		add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
186
+		add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
187 187
 
188
-    }
188
+	}
189 189
 }
190 190
 
191 191
 function addCat_column($columns)
192 192
 {
193
-    if (isset($columns['description']) && $posts = $columns['description']) {
194
-        unset($columns['description']);
195
-    }
196
-
197
-    $columns['cat_icon'] = 'Icon';
198
-    $columns['cat_default_img'] = __('Default Image', 'geodirectory');
199
-    $columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
200
-    return $columns;
193
+	if (isset($columns['description']) && $posts = $columns['description']) {
194
+		unset($columns['description']);
195
+	}
196
+
197
+	$columns['cat_icon'] = 'Icon';
198
+	$columns['cat_default_img'] = __('Default Image', 'geodirectory');
199
+	$columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
200
+	return $columns;
201 201
 }
202 202
 
203 203
 #############################################################
204 204
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
205 205
 {
206
-    if ($column_name == 'cat_ID_num')
207
-        echo $term_id;
206
+	if ($column_name == 'cat_ID_num')
207
+		echo $term_id;
208 208
 
209
-    if ($column_name == 'cat_icon') {
210
-        $term_icon_url = get_tax_meta($term_id, 'ct_cat_icon');
209
+	if ($column_name == 'cat_icon') {
210
+		$term_icon_url = get_tax_meta($term_id, 'ct_cat_icon');
211 211
 
212
-        if ($term_icon_url != '') {
212
+		if ($term_icon_url != '') {
213 213
 
214
-            $file_info = pathinfo($term_icon_url['src']);
214
+			$file_info = pathinfo($term_icon_url['src']);
215 215
 
216
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..')
217
-                $sub_dir = $file_info['dirname'];
218
-            else{$sub_dir = '';}
216
+			if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..')
217
+				$sub_dir = $file_info['dirname'];
218
+			else{$sub_dir = '';}
219 219
 
220
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
221
-            $uploads_baseurl = $uploads['baseurl'];
222
-            $uploads_path = $uploads['path'];
220
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
221
+			$uploads_baseurl = $uploads['baseurl'];
222
+			$uploads_path = $uploads['path'];
223 223
 
224
-            $file_name = $file_info['basename'];
224
+			$file_name = $file_info['basename'];
225 225
 
226
-            $sub_dir = str_replace($uploads_baseurl, '', $sub_dir);
226
+			$sub_dir = str_replace($uploads_baseurl, '', $sub_dir);
227 227
 
228
-            $uploads_url = $uploads_baseurl . $sub_dir;
228
+			$uploads_url = $uploads_baseurl . $sub_dir;
229 229
 
230
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
231
-            echo '<img src="' . $term_icon_url['src'] . '" />';
230
+			$term_icon_url['src'] = $uploads_url . '/' . $file_name;
231
+			echo '<img src="' . $term_icon_url['src'] . '" />';
232 232
 
233
-        }
234
-    }
233
+		}
234
+	}
235 235
 
236
-    if ($column_name == 'cat_default_img') {
237
-        $cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img');
238
-        if ($cat_default_img != '')
239
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
236
+	if ($column_name == 'cat_default_img') {
237
+		$cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img');
238
+		if ($cat_default_img != '')
239
+			echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
240 240
 
241
-    }
241
+	}
242 242
 }
243 243
 
244 244
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
245 245
 {
246 246
 
247
-    if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
248
-        return $cat_default_img;
249
-    else
250
-        return false;
247
+	if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
248
+		return $cat_default_img;
249
+	else
250
+		return false;
251 251
 }
252 252
 
253 253
 //Clear custom fields
254 254
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
255 255
 function geodir_tax_meta_clear_custom_field()
256 256
 {
257
-    if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
258
-        ?>
257
+	if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
258
+		?>
259 259
         <script type="text/javascript">
260 260
             jQuery(document).ready(function () {
261 261
                 jQuery('#addtag #submit').click(function () {
@@ -276,5 +276,5 @@  discard block
 block discarded – undo
276 276
             });
277 277
         </script>
278 278
     <?php
279
-    endif;
279
+	endif;
280 280
 }
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/Tax-meta-class.php 1 patch
Indentation   +2028 added lines, -2028 removed lines patch added patch discarded remove patch
@@ -28,260 +28,260 @@  discard block
 block discarded – undo
28 28
 
29 29
 if (!class_exists('Tax_Meta_Class')) :
30 30
 
31
-    /**
32
-     * All Types Meta Box class.
33
-     *
34
-     * @package All Types Meta Box
35
-     * @since 1.0
36
-     *
37
-     * @todo Nothing.
38
-     */
39
-
40
-
41
-    class Tax_Meta_Class
42
-    {
43
-
44
-        /**
45
-         * Holds meta box object
46
-         *
47
-         * @var object
48
-         * @access protected
49
-         */
50
-        protected $_meta_box;
51
-
52
-        /**
53
-         * Holds meta box fields.
54
-         *
55
-         * @var array
56
-         * @access protected
57
-         */
58
-        protected $_prefix;
59
-
60
-        /**
61
-         * Holds Prefix for meta box fields.
62
-         *
63
-         * @var array
64
-         * @access protected
65
-         */
66
-        protected $_fields;
67
-
68
-        /**
69
-         * Use local images.
70
-         *
71
-         * @var bool
72
-         * @access protected
73
-         */
74
-        protected $_Local_images;
75
-
76
-        /**
77
-         * What form is this? edit or new term.
78
-         *
79
-         * @var string
80
-         * @access protected
81
-         * $since 1.0
82
-         */
83
-        protected $_form_type;
84
-        /**
85
-         * SelfPath to allow themes as well as plugins.
86
-         *
87
-         * @var string
88
-         * @access protected
89
-         * $since 1.0
90
-         */
91
-        protected $SelfPath;
92
-
93
-        /**
94
-         * Constructor
95
-         *
96
-         * @since 1.0
97
-         * @access public
98
-         *
99
-         * @param array $meta_box
100
-         */
101
-        public function __construct($meta_box)
102
-        {
103
-
104
-            // If we are not in admin area exit.
105
-            if (!is_admin())
106
-                return;
107
-
108
-            // Assign meta box values to local variables and add it's missed values.
109
-            $this->_meta_box = $meta_box;
110
-            $this->_prefix = (isset($meta_box['prefix'])) ? $meta_box['prefix'] : '';
111
-            $this->_fields = &$this->_meta_box['fields'];
112
-            $this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113
-            $this->add_missed_values();
114
-            if (isset($meta_box['use_with_theme']))
115
-                if ($meta_box['use_with_theme'] === true) {
116
-                    $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
117
-                } elseif ($meta_box['use_with_theme'] === false) {
118
-                    $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119
-                } else {
120
-                    $this->SelfPath = $meta_box['use_with_theme'];
121
-                }
122
-            else {
123
-                $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124
-            }
125
-
126
-
127
-            // Add Actions
128
-            add_action('admin_init', array(&$this, 'add'));
129
-
130
-            // Check for special fields and add needed actions for them.
131
-            $this->check_field_upload();
132
-            $this->check_field_color();
133
-            $this->check_field_date();
134
-            $this->check_field_time();
135
-
136
-            // Load common js, css files
137
-            // Must enqueue for all pages as we need js for the media upload, too.
138
-            add_action('admin_print_styles', array(&$this, 'load_scripts_styles'));
139
-
140
-        }
141
-
142
-        /**
143
-         * Load all Javascript and CSS
144
-         *
145
-         * @since 1.0
146
-         * @access public
147
-         */
148
-        public function load_scripts_styles()
149
-        {
150
-
151
-            // Get Plugin Path
152
-            $plugin_path = $this->SelfPath;
153
-            //only load styles and js when needed
154
-            /* 
31
+	/**
32
+	 * All Types Meta Box class.
33
+	 *
34
+	 * @package All Types Meta Box
35
+	 * @since 1.0
36
+	 *
37
+	 * @todo Nothing.
38
+	 */
39
+
40
+
41
+	class Tax_Meta_Class
42
+	{
43
+
44
+		/**
45
+		 * Holds meta box object
46
+		 *
47
+		 * @var object
48
+		 * @access protected
49
+		 */
50
+		protected $_meta_box;
51
+
52
+		/**
53
+		 * Holds meta box fields.
54
+		 *
55
+		 * @var array
56
+		 * @access protected
57
+		 */
58
+		protected $_prefix;
59
+
60
+		/**
61
+		 * Holds Prefix for meta box fields.
62
+		 *
63
+		 * @var array
64
+		 * @access protected
65
+		 */
66
+		protected $_fields;
67
+
68
+		/**
69
+		 * Use local images.
70
+		 *
71
+		 * @var bool
72
+		 * @access protected
73
+		 */
74
+		protected $_Local_images;
75
+
76
+		/**
77
+		 * What form is this? edit or new term.
78
+		 *
79
+		 * @var string
80
+		 * @access protected
81
+		 * $since 1.0
82
+		 */
83
+		protected $_form_type;
84
+		/**
85
+		 * SelfPath to allow themes as well as plugins.
86
+		 *
87
+		 * @var string
88
+		 * @access protected
89
+		 * $since 1.0
90
+		 */
91
+		protected $SelfPath;
92
+
93
+		/**
94
+		 * Constructor
95
+		 *
96
+		 * @since 1.0
97
+		 * @access public
98
+		 *
99
+		 * @param array $meta_box
100
+		 */
101
+		public function __construct($meta_box)
102
+		{
103
+
104
+			// If we are not in admin area exit.
105
+			if (!is_admin())
106
+				return;
107
+
108
+			// Assign meta box values to local variables and add it's missed values.
109
+			$this->_meta_box = $meta_box;
110
+			$this->_prefix = (isset($meta_box['prefix'])) ? $meta_box['prefix'] : '';
111
+			$this->_fields = &$this->_meta_box['fields'];
112
+			$this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113
+			$this->add_missed_values();
114
+			if (isset($meta_box['use_with_theme']))
115
+				if ($meta_box['use_with_theme'] === true) {
116
+					$this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
117
+				} elseif ($meta_box['use_with_theme'] === false) {
118
+					$this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119
+				} else {
120
+					$this->SelfPath = $meta_box['use_with_theme'];
121
+				}
122
+			else {
123
+				$this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124
+			}
125
+
126
+
127
+			// Add Actions
128
+			add_action('admin_init', array(&$this, 'add'));
129
+
130
+			// Check for special fields and add needed actions for them.
131
+			$this->check_field_upload();
132
+			$this->check_field_color();
133
+			$this->check_field_date();
134
+			$this->check_field_time();
135
+
136
+			// Load common js, css files
137
+			// Must enqueue for all pages as we need js for the media upload, too.
138
+			add_action('admin_print_styles', array(&$this, 'load_scripts_styles'));
139
+
140
+		}
141
+
142
+		/**
143
+		 * Load all Javascript and CSS
144
+		 *
145
+		 * @since 1.0
146
+		 * @access public
147
+		 */
148
+		public function load_scripts_styles()
149
+		{
150
+
151
+			// Get Plugin Path
152
+			$plugin_path = $this->SelfPath;
153
+			//only load styles and js when needed
154
+			/* 
155 155
 		 * since 1.0
156 156
 		 */
157
-            $taxnow = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : '';
158
-
159
-            if (!empty($this->_meta_box['pages'])) {
160
-                if (in_array($taxnow, $this->_meta_box['pages'])) {
161
-                    // Enqueue Meta Box Style
162
-                    //wp_enqueue_style( 'tax-meta-clss', $plugin_path . '/css/Tax-meta-class.css' );
163
-                    // Enqueue Meta Box Scripts
164
-                    //wp_enqueue_script( 'tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array( 'jquery' ), null, true );
165
-
166
-                }
167
-            }
168
-
169
-        }
170
-
171
-        /**
172
-         * Check the Field Upload, Add needed Actions
173
-         *
174
-         * @since 1.0
175
-         * @access public
176
-         */
177
-        public function enqueue_tax_meta_scripts()
178
-        {
179
-            // Make upload feature work event when custom post type doesn't support 'editor'
180
-            wp_enqueue_script('media-upload');
181
-            wp_enqueue_script('thickbox');
182
-            add_thickbox();
183
-            wp_enqueue_script('jquery-ui-core');
184
-            wp_enqueue_script('jquery-ui-sortable');
185
-
186
-
187
-        }
188
-
189
-        public function check_field_upload()
190
-        {
191
-
192
-            // Check if the field is an image or file. If not, return.
193
-            if (!$this->has_field('image') && !$this->has_field('file'))
194
-                return;
195
-
196
-
197
-            add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
198
-
199
-            // Add data encoding type for file uploading.	
200
-            add_action('post_edit_form_tag', array(&$this, 'add_enctype'));
201
-
202
-
203
-            // Add filters for media upload.
204
-            add_filter('media_upload_gallery', array(&$this, 'insert_images'));
205
-            add_filter('media_upload_library', array(&$this, 'insert_images'));
206
-            add_filter('media_upload_image', array(&$this, 'insert_images'));
207
-
208
-            // Delete all attachments when delete custom post type.
209
-            add_action('wp_ajax_at_delete_file', array(&$this, 'delete_file'));
210
-            add_action('wp_ajax_at_reorder_images', array(&$this, 'reorder_images'));
211
-            // Delete file via Ajax
212
-            add_action('wp_ajax_at_delete_mupload', array($this, 'wp_ajax_delete_image'));
213
-        }
214
-
215
-        /**
216
-         * Add data encoding type for file uploading
217
-         *
218
-         * @since 1.0
219
-         * @access public
220
-         */
221
-        public function add_enctype()
222
-        {
223
-            echo ' enctype="multipart/form-data"';
224
-        }
225
-
226
-        /**
227
-         * Process images added to meta field.
228
-         *
229
-         * Modified from Faster Image Insert plugin.
230
-         *
231
-         * @return void
232
-         * @author Cory Crowley
233
-         */
234
-        public function insert_images()
235
-        {
236
-
237
-            // If post variables are empty, return.
238
-            if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
-                return;
240
-
241
-            // Security Check
242
-            check_admin_referer('media-form');
243
-
244
-            // Create Security Nonce
245
-            $nonce = wp_create_nonce('at_ajax_delete');
246
-
247
-            // Get Post Id and Field Id
248
-            $term_id = $_POST['post_id'];
249
-            $id = $_POST['field_id'];
250
-
251
-            // Modify the insertion string
252
-            $html = '';
253
-            foreach ($_POST['attachments'] as $attachment_id => $attachment) {
254
-
255
-                // Strip Slashes
256
-                $attachment = stripslashes_deep($attachment);
257
-
258
-                // If not selected or url is empty, continue in loop.
259
-                if (empty($attachment['selected']) || empty($attachment['url']))
260
-                    continue;
261
-
262
-                $li = "<li id='item_{$attachment_id}'>";
263
-                $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264
-                //$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
-                $li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
266
-                $li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267
-                $li .= "</li>";
268
-                $html .= $li;
269
-
270
-            } // End For Each
271
-
272
-            return media_send_to_editor($html);
273
-
274
-        }
275
-
276
-        /**
277
-         * Delete attachments associated with the post.
278
-         *
279
-         * @since 1.0
280
-         * @access public
281
-         *
282
-         * @param int|string $term_id The term ID.
283
-         */
284
-        /*public function delete_attachments( $term_id ) {
157
+			$taxnow = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : '';
158
+
159
+			if (!empty($this->_meta_box['pages'])) {
160
+				if (in_array($taxnow, $this->_meta_box['pages'])) {
161
+					// Enqueue Meta Box Style
162
+					//wp_enqueue_style( 'tax-meta-clss', $plugin_path . '/css/Tax-meta-class.css' );
163
+					// Enqueue Meta Box Scripts
164
+					//wp_enqueue_script( 'tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array( 'jquery' ), null, true );
165
+
166
+				}
167
+			}
168
+
169
+		}
170
+
171
+		/**
172
+		 * Check the Field Upload, Add needed Actions
173
+		 *
174
+		 * @since 1.0
175
+		 * @access public
176
+		 */
177
+		public function enqueue_tax_meta_scripts()
178
+		{
179
+			// Make upload feature work event when custom post type doesn't support 'editor'
180
+			wp_enqueue_script('media-upload');
181
+			wp_enqueue_script('thickbox');
182
+			add_thickbox();
183
+			wp_enqueue_script('jquery-ui-core');
184
+			wp_enqueue_script('jquery-ui-sortable');
185
+
186
+
187
+		}
188
+
189
+		public function check_field_upload()
190
+		{
191
+
192
+			// Check if the field is an image or file. If not, return.
193
+			if (!$this->has_field('image') && !$this->has_field('file'))
194
+				return;
195
+
196
+
197
+			add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
198
+
199
+			// Add data encoding type for file uploading.	
200
+			add_action('post_edit_form_tag', array(&$this, 'add_enctype'));
201
+
202
+
203
+			// Add filters for media upload.
204
+			add_filter('media_upload_gallery', array(&$this, 'insert_images'));
205
+			add_filter('media_upload_library', array(&$this, 'insert_images'));
206
+			add_filter('media_upload_image', array(&$this, 'insert_images'));
207
+
208
+			// Delete all attachments when delete custom post type.
209
+			add_action('wp_ajax_at_delete_file', array(&$this, 'delete_file'));
210
+			add_action('wp_ajax_at_reorder_images', array(&$this, 'reorder_images'));
211
+			// Delete file via Ajax
212
+			add_action('wp_ajax_at_delete_mupload', array($this, 'wp_ajax_delete_image'));
213
+		}
214
+
215
+		/**
216
+		 * Add data encoding type for file uploading
217
+		 *
218
+		 * @since 1.0
219
+		 * @access public
220
+		 */
221
+		public function add_enctype()
222
+		{
223
+			echo ' enctype="multipart/form-data"';
224
+		}
225
+
226
+		/**
227
+		 * Process images added to meta field.
228
+		 *
229
+		 * Modified from Faster Image Insert plugin.
230
+		 *
231
+		 * @return void
232
+		 * @author Cory Crowley
233
+		 */
234
+		public function insert_images()
235
+		{
236
+
237
+			// If post variables are empty, return.
238
+			if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
+				return;
240
+
241
+			// Security Check
242
+			check_admin_referer('media-form');
243
+
244
+			// Create Security Nonce
245
+			$nonce = wp_create_nonce('at_ajax_delete');
246
+
247
+			// Get Post Id and Field Id
248
+			$term_id = $_POST['post_id'];
249
+			$id = $_POST['field_id'];
250
+
251
+			// Modify the insertion string
252
+			$html = '';
253
+			foreach ($_POST['attachments'] as $attachment_id => $attachment) {
254
+
255
+				// Strip Slashes
256
+				$attachment = stripslashes_deep($attachment);
257
+
258
+				// If not selected or url is empty, continue in loop.
259
+				if (empty($attachment['selected']) || empty($attachment['url']))
260
+					continue;
261
+
262
+				$li = "<li id='item_{$attachment_id}'>";
263
+				$li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264
+				//$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
+				$li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
266
+				$li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267
+				$li .= "</li>";
268
+				$html .= $li;
269
+
270
+			} // End For Each
271
+
272
+			return media_send_to_editor($html);
273
+
274
+		}
275
+
276
+		/**
277
+		 * Delete attachments associated with the post.
278
+		 *
279
+		 * @since 1.0
280
+		 * @access public
281
+		 *
282
+		 * @param int|string $term_id The term ID.
283
+		 */
284
+		/*public function delete_attachments( $term_id ) {
285 285
 		
286 286
 		// Get Attachments
287 287
 		$attachments = get_posts( array( 'numberposts' => -1, 'post_type' => 'attachment', 'post_parent' => $term_id ) );
@@ -295,349 +295,349 @@  discard block
 block discarded – undo
295 295
 		
296 296
 	}*/
297 297
 
298
-        /**
299
-         * Ajax callback for deleting files.
300
-         *
301
-         * Modified from a function used by "Verve Meta Boxes" plugin ( http://goo.gl/aw64H )
302
-         *
303
-         * @since 1.0
304
-         * @access public
305
-         */
306
-        public function delete_file()
307
-        {
308
-
309
-
310
-            // If data is not set, die.
311
-            if (!isset($_POST['data']))
312
-                die();
313
-
314
-            list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315
-
316
-            if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
-                die('1');
318
-
319
-            $this->delete_tax_meta($term_id, $key, $attach_id);
320
-
321
-            die('0');
322
-
323
-        }
324
-
325
-        /**
326
-         * Ajax callback for deleting files.
327
-         * Modified from a function used by "Verve Meta Boxes" plugin (http://goo.gl/LzYSq)
328
-         * @since 1.0
329
-         * @access public
330
-         */
331
-        public function wp_ajax_delete_image()
332
-        {
333
-            $term_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0;
334
-            $field_id = isset($_GET['field_id']) ? $_GET['field_id'] : 0;
335
-            $attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336
-            $ok = false;
337
-            if (strpos($field_id, '[') === false) {
338
-                check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
-                if ($term_id > 0)
340
-                    $this->delete_tax_meta($term_id, $field_id);
341
-                //$ok = wp_delete_attachment( $attachment_id );
342
-                $ok = 1;
343
-            } else {
344
-                $f = explode('[', urldecode($field_id));
345
-                $f_fiexed = array();
346
-                foreach ($f as $k => $v) {
347
-                    $f[$k] = str_replace(']', '', $v);
348
-                }
349
-                $saved = $this->get_tax_meta($term_id, $f[0], true);
350
-                if (isset($saved[$f[1]][$f[2]])) {
351
-                    unset($saved[$f[1]][$f[2]]);
352
-                    if ($term_id > 0)
353
-                        update_post_meta($term_id, $f[0], $saved);
354
-                    //$ok = wp_delete_attachment( $attachment_id );
355
-                    $ok = 1;
356
-                }
357
-            }
358
-
359
-
360
-            if ($ok) {
361
-                echo json_encode(array('status' => 'success'));
362
-                die();
363
-            } else {
364
-                echo json_encode(array('message' => __('Cannot delete file. Something\'s wrong.', 'geodirectory')));
365
-                die();
366
-            }
367
-        }
368
-
369
-        /**
370
-         * Ajax callback for reordering Images.
371
-         *
372
-         * @since 1.0
373
-         * @access public
374
-         */
375
-        public function reorder_images()
376
-        {
377
-
378
-            if (!isset($_POST['data']))
379
-                die();
380
-
381
-            list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382
-
383
-            if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
-                die('1');
385
-
386
-            parse_str($order, $items);
387
-            $items = $items['item'];
388
-            $order = 1;
389
-            foreach ($items as $item) {
390
-                wp_update_post(array('ID' => $item, 'post_parent' => $term_id, 'menu_order' => $order));
391
-                $order++;
392
-            }
393
-
394
-            die('0');
395
-
396
-        }
397
-
398
-        /**
399
-         * Check Field Color
400
-         *
401
-         * @since 1.0
402
-         * @access public
403
-         */
404
-        public function check_field_color()
405
-        {
406
-
407
-            if ($this->has_field('color') && $this->is_edit_page()) {
408
-                // Enqueu built-in script and style for color picker.
409
-                wp_enqueue_style('farbtastic');
410
-                wp_enqueue_script('farbtastic');
411
-            }
412
-
413
-        }
414
-
415
-        /**
416
-         * Check Field Date
417
-         *
418
-         * @since 1.0
419
-         * @access public
420
-         */
421
-        public function check_field_date()
422
-        {
423
-
424
-            if ($this->has_field('date') && $this->is_edit_page()) {
425
-                // Enqueu JQuery UI, use proper version.
426
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
428
-            }
429
-
430
-        }
431
-
432
-        /**
433
-         * Check Field Time
434
-         *
435
-         * @since 1.0
436
-         * @access public
437
-         */
438
-        public function check_field_time()
439
-        {
440
-
441
-            if ($this->has_field('time') && $this->is_edit_page()) {
442
-
443
-                // Enqueu JQuery UI, use proper version.
444
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
446
-                wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447
-
448
-            }
449
-
450
-        }
451
-
452
-        /**
453
-         * Add Meta Box for multiple post types.
454
-         *
455
-         * @since 1.0
456
-         * @access public
457
-         */
458
-        public function add()
459
-        {
460
-
461
-            // Loop through array
462
-            if (!empty($this->_meta_box['pages'])) {
463
-                foreach ($this->_meta_box['pages'] as $page) {
464
-                    //add fields to edit form
465
-                    add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
466
-                    //add fields to add new form
467
-                    add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
468
-                    // this saves the edit fields
469
-                    add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
470
-                    // this saves the add fields
471
-                    add_action('created_' . $page, array(&$this, 'save'), 10, 2);
472
-                }
473
-            }
474
-
475
-        }
476
-
477
-        /**
478
-         * Callback function to show fields on add new taxonomy term form.
479
-         *
480
-         * @since 1.0
481
-         * @access public
482
-         */
483
-        public function show_new_form($term_id)
484
-        {
485
-            $this->_form_type = 'new';
486
-            $this->show($term_id);
487
-        }
488
-
489
-        /**
490
-         * Callback function to show fields on term edit form.
491
-         *
492
-         * @since 1.0
493
-         * @access public
494
-         */
495
-        public function show_edit_form($term_id)
496
-        {
497
-            $this->_form_type = 'edit';
498
-            $this->show($term_id);
499
-        }
500
-
501
-
502
-        /**
503
-         * Callback function to show fields in meta box.
504
-         *
505
-         * @since 1.0
506
-         * @access public
507
-         */
508
-        public function show($term_id)
509
-        {
510
-
511
-            wp_nonce_field(basename(__FILE__), 'tax_meta_class_nonce');
512
-
513
-            foreach ($this->_fields as $field) {
514
-                $meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515
-                $meta = ($meta !== '') ? $meta : $field['std'];
516
-                if ('image' != $field['type'] && $field['type'] != 'repeater')
517
-                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518
-
519
-                if ($field['validate_func']) {
520
-                    echo '<tr class="form-field form-required ' . $field['style'] . '">';
521
-                } else {
522
-                    echo '<tr class="form-field ' . $field['style'] . '">';
523
-                }
524
-
525
-                // Call Separated methods for displaying each type of field.
526
-                call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
527
-                echo '</tr>';
528
-            }
529
-            echo '</table>';
530
-        }
531
-
532
-        /**
533
-         * Show Repeater Fields.
534
-         *
535
-         * @param string $field
536
-         * @param string $meta
537
-         * @since 1.0
538
-         * @access public
539
-         */
540
-        public function show_field_repeater($field, $meta)
541
-        {
542
-            // Get Plugin Path
543
-            $plugin_path = $this->SelfPath;
544
-            $this->show_field_begin($field, $meta);
545
-            echo "<div class='at-repeat' id='{$field['id']}'>";
546
-
547
-            $c = 0;
548
-
549
-            if (count($meta) > 0 && is_array($meta)) {
550
-                foreach ($meta as $me) {
551
-                    //for labling toggles
552
-                    $mmm = $me[$field['fields'][0]['id']];
553
-                    echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
554
-                    if ($field['inline']) {
555
-                        echo '<tr class="at-inline" VALIGN="top">';
556
-                    }
557
-                    foreach ($field['fields'] as $f) {
558
-                        //reset var $id for repeater
559
-                        $id = '';
560
-                        $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561
-                        $m = $me[$f['id']];
562
-                        $m = ($m !== '') ? $m : $f['std'];
563
-                        if ('image' != $f['type'] && $f['type'] != 'repeater')
564
-                            $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
565
-                        //set new id for field in array format
566
-                        $f['id'] = $id;
567
-                        if (!$field['inline']) {
568
-                            echo '<tr>';
569
-                        }
570
-                        call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
571
-                        if (!$field['inline']) {
572
-                            echo '</tr>';
573
-                        }
574
-                    }
575
-                    if ($field['inline']) {
576
-                        echo '</tr>';
577
-                    }
578
-                    echo '</table>
298
+		/**
299
+		 * Ajax callback for deleting files.
300
+		 *
301
+		 * Modified from a function used by "Verve Meta Boxes" plugin ( http://goo.gl/aw64H )
302
+		 *
303
+		 * @since 1.0
304
+		 * @access public
305
+		 */
306
+		public function delete_file()
307
+		{
308
+
309
+
310
+			// If data is not set, die.
311
+			if (!isset($_POST['data']))
312
+				die();
313
+
314
+			list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315
+
316
+			if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
+				die('1');
318
+
319
+			$this->delete_tax_meta($term_id, $key, $attach_id);
320
+
321
+			die('0');
322
+
323
+		}
324
+
325
+		/**
326
+		 * Ajax callback for deleting files.
327
+		 * Modified from a function used by "Verve Meta Boxes" plugin (http://goo.gl/LzYSq)
328
+		 * @since 1.0
329
+		 * @access public
330
+		 */
331
+		public function wp_ajax_delete_image()
332
+		{
333
+			$term_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0;
334
+			$field_id = isset($_GET['field_id']) ? $_GET['field_id'] : 0;
335
+			$attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336
+			$ok = false;
337
+			if (strpos($field_id, '[') === false) {
338
+				check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
+				if ($term_id > 0)
340
+					$this->delete_tax_meta($term_id, $field_id);
341
+				//$ok = wp_delete_attachment( $attachment_id );
342
+				$ok = 1;
343
+			} else {
344
+				$f = explode('[', urldecode($field_id));
345
+				$f_fiexed = array();
346
+				foreach ($f as $k => $v) {
347
+					$f[$k] = str_replace(']', '', $v);
348
+				}
349
+				$saved = $this->get_tax_meta($term_id, $f[0], true);
350
+				if (isset($saved[$f[1]][$f[2]])) {
351
+					unset($saved[$f[1]][$f[2]]);
352
+					if ($term_id > 0)
353
+						update_post_meta($term_id, $f[0], $saved);
354
+					//$ok = wp_delete_attachment( $attachment_id );
355
+					$ok = 1;
356
+				}
357
+			}
358
+
359
+
360
+			if ($ok) {
361
+				echo json_encode(array('status' => 'success'));
362
+				die();
363
+			} else {
364
+				echo json_encode(array('message' => __('Cannot delete file. Something\'s wrong.', 'geodirectory')));
365
+				die();
366
+			}
367
+		}
368
+
369
+		/**
370
+		 * Ajax callback for reordering Images.
371
+		 *
372
+		 * @since 1.0
373
+		 * @access public
374
+		 */
375
+		public function reorder_images()
376
+		{
377
+
378
+			if (!isset($_POST['data']))
379
+				die();
380
+
381
+			list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382
+
383
+			if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
+				die('1');
385
+
386
+			parse_str($order, $items);
387
+			$items = $items['item'];
388
+			$order = 1;
389
+			foreach ($items as $item) {
390
+				wp_update_post(array('ID' => $item, 'post_parent' => $term_id, 'menu_order' => $order));
391
+				$order++;
392
+			}
393
+
394
+			die('0');
395
+
396
+		}
397
+
398
+		/**
399
+		 * Check Field Color
400
+		 *
401
+		 * @since 1.0
402
+		 * @access public
403
+		 */
404
+		public function check_field_color()
405
+		{
406
+
407
+			if ($this->has_field('color') && $this->is_edit_page()) {
408
+				// Enqueu built-in script and style for color picker.
409
+				wp_enqueue_style('farbtastic');
410
+				wp_enqueue_script('farbtastic');
411
+			}
412
+
413
+		}
414
+
415
+		/**
416
+		 * Check Field Date
417
+		 *
418
+		 * @since 1.0
419
+		 * @access public
420
+		 */
421
+		public function check_field_date()
422
+		{
423
+
424
+			if ($this->has_field('date') && $this->is_edit_page()) {
425
+				// Enqueu JQuery UI, use proper version.
426
+				wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
+				wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
428
+			}
429
+
430
+		}
431
+
432
+		/**
433
+		 * Check Field Time
434
+		 *
435
+		 * @since 1.0
436
+		 * @access public
437
+		 */
438
+		public function check_field_time()
439
+		{
440
+
441
+			if ($this->has_field('time') && $this->is_edit_page()) {
442
+
443
+				// Enqueu JQuery UI, use proper version.
444
+				wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
+				wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
446
+				wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447
+
448
+			}
449
+
450
+		}
451
+
452
+		/**
453
+		 * Add Meta Box for multiple post types.
454
+		 *
455
+		 * @since 1.0
456
+		 * @access public
457
+		 */
458
+		public function add()
459
+		{
460
+
461
+			// Loop through array
462
+			if (!empty($this->_meta_box['pages'])) {
463
+				foreach ($this->_meta_box['pages'] as $page) {
464
+					//add fields to edit form
465
+					add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
466
+					//add fields to add new form
467
+					add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
468
+					// this saves the edit fields
469
+					add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
470
+					// this saves the add fields
471
+					add_action('created_' . $page, array(&$this, 'save'), 10, 2);
472
+				}
473
+			}
474
+
475
+		}
476
+
477
+		/**
478
+		 * Callback function to show fields on add new taxonomy term form.
479
+		 *
480
+		 * @since 1.0
481
+		 * @access public
482
+		 */
483
+		public function show_new_form($term_id)
484
+		{
485
+			$this->_form_type = 'new';
486
+			$this->show($term_id);
487
+		}
488
+
489
+		/**
490
+		 * Callback function to show fields on term edit form.
491
+		 *
492
+		 * @since 1.0
493
+		 * @access public
494
+		 */
495
+		public function show_edit_form($term_id)
496
+		{
497
+			$this->_form_type = 'edit';
498
+			$this->show($term_id);
499
+		}
500
+
501
+
502
+		/**
503
+		 * Callback function to show fields in meta box.
504
+		 *
505
+		 * @since 1.0
506
+		 * @access public
507
+		 */
508
+		public function show($term_id)
509
+		{
510
+
511
+			wp_nonce_field(basename(__FILE__), 'tax_meta_class_nonce');
512
+
513
+			foreach ($this->_fields as $field) {
514
+				$meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515
+				$meta = ($meta !== '') ? $meta : $field['std'];
516
+				if ('image' != $field['type'] && $field['type'] != 'repeater')
517
+					$meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518
+
519
+				if ($field['validate_func']) {
520
+					echo '<tr class="form-field form-required ' . $field['style'] . '">';
521
+				} else {
522
+					echo '<tr class="form-field ' . $field['style'] . '">';
523
+				}
524
+
525
+				// Call Separated methods for displaying each type of field.
526
+				call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
527
+				echo '</tr>';
528
+			}
529
+			echo '</table>';
530
+		}
531
+
532
+		/**
533
+		 * Show Repeater Fields.
534
+		 *
535
+		 * @param string $field
536
+		 * @param string $meta
537
+		 * @since 1.0
538
+		 * @access public
539
+		 */
540
+		public function show_field_repeater($field, $meta)
541
+		{
542
+			// Get Plugin Path
543
+			$plugin_path = $this->SelfPath;
544
+			$this->show_field_begin($field, $meta);
545
+			echo "<div class='at-repeat' id='{$field['id']}'>";
546
+
547
+			$c = 0;
548
+
549
+			if (count($meta) > 0 && is_array($meta)) {
550
+				foreach ($meta as $me) {
551
+					//for labling toggles
552
+					$mmm = $me[$field['fields'][0]['id']];
553
+					echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
554
+					if ($field['inline']) {
555
+						echo '<tr class="at-inline" VALIGN="top">';
556
+					}
557
+					foreach ($field['fields'] as $f) {
558
+						//reset var $id for repeater
559
+						$id = '';
560
+						$id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561
+						$m = $me[$f['id']];
562
+						$m = ($m !== '') ? $m : $f['std'];
563
+						if ('image' != $f['type'] && $f['type'] != 'repeater')
564
+							$m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
565
+						//set new id for field in array format
566
+						$f['id'] = $id;
567
+						if (!$field['inline']) {
568
+							echo '<tr>';
569
+						}
570
+						call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
571
+						if (!$field['inline']) {
572
+							echo '</tr>';
573
+						}
574
+					}
575
+					if ($field['inline']) {
576
+						echo '</tr>';
577
+					}
578
+					echo '</table>
579 579
 				<span class="at-re-toggle"><img src="';
580
-                    if ($this->_Local_images) {
581
-                        echo $plugin_path . '/images/edit.png';
582
-                    } else {
583
-                        echo 'http://i.imgur.com/ka0E2.png';
584
-                    }
585
-                    echo '" alt="Edit" title="Edit"/></span> 
580
+					if ($this->_Local_images) {
581
+						echo $plugin_path . '/images/edit.png';
582
+					} else {
583
+						echo 'http://i.imgur.com/ka0E2.png';
584
+					}
585
+					echo '" alt="Edit" title="Edit"/></span> 
586 586
 				<img src="';
587
-                    if ($this->_Local_images) {
588
-                        echo $plugin_path . '/images/remove.png';
589
-                    } else {
590
-                        echo 'http://i.imgur.com/g8Duj.png';
591
-                    }
592
-                    echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
593
-                    $c = $c + 1;
594
-
595
-                }
596
-                $this->show_field_end($field, $meta);
597
-            }
598
-
599
-            echo '<img src="';
600
-            if ($this->_Local_images) {
601
-                echo $plugin_path . '/images/add.png';
602
-            } else {
603
-                echo 'http://i.imgur.com/w5Tuc.png';
604
-            }
605
-            echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
606
-
607
-            //create all fields once more for js function and catch with object buffer
608
-            ob_start();
609
-            echo '<div class="at-repater-block"><table class="repeater-table">';
610
-            if ($field['inline']) {
611
-                echo '<tr class="at-inline" VALIGN="top">';
612
-            }
613
-            foreach ($field['fields'] as $f) {
614
-                //reset var $id for repeater
615
-                $id = '';
616
-                $id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
617
-                $f['id'] = $id;
618
-                if (!$field['inline']) {
619
-                    echo '<tr>';
620
-                }
621
-                call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
622
-                if (!$field['inline']) {
623
-                    echo '</tr>';
624
-                }
625
-            }
626
-            if ($field['inline']) {
627
-                echo '</tr>';
628
-            }
629
-            echo '</table><img src="';
630
-            if ($this->_Local_images) {
631
-                echo $plugin_path . '/images/remove.png';
632
-            } else {
633
-                echo 'http://i.imgur.com/g8Duj.png';
634
-            }
635
-            echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
-            $counter = 'countadd_' . $field['id'];
637
-            $js_code = ob_get_clean();
638
-            $js_code = str_replace("'", "\"", $js_code);
639
-            $js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
640
-            echo '<script>
587
+					if ($this->_Local_images) {
588
+						echo $plugin_path . '/images/remove.png';
589
+					} else {
590
+						echo 'http://i.imgur.com/g8Duj.png';
591
+					}
592
+					echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
593
+					$c = $c + 1;
594
+
595
+				}
596
+				$this->show_field_end($field, $meta);
597
+			}
598
+
599
+			echo '<img src="';
600
+			if ($this->_Local_images) {
601
+				echo $plugin_path . '/images/add.png';
602
+			} else {
603
+				echo 'http://i.imgur.com/w5Tuc.png';
604
+			}
605
+			echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
606
+
607
+			//create all fields once more for js function and catch with object buffer
608
+			ob_start();
609
+			echo '<div class="at-repater-block"><table class="repeater-table">';
610
+			if ($field['inline']) {
611
+				echo '<tr class="at-inline" VALIGN="top">';
612
+			}
613
+			foreach ($field['fields'] as $f) {
614
+				//reset var $id for repeater
615
+				$id = '';
616
+				$id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
617
+				$f['id'] = $id;
618
+				if (!$field['inline']) {
619
+					echo '<tr>';
620
+				}
621
+				call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
622
+				if (!$field['inline']) {
623
+					echo '</tr>';
624
+				}
625
+			}
626
+			if ($field['inline']) {
627
+				echo '</tr>';
628
+			}
629
+			echo '</table><img src="';
630
+			if ($this->_Local_images) {
631
+				echo $plugin_path . '/images/remove.png';
632
+			} else {
633
+				echo 'http://i.imgur.com/g8Duj.png';
634
+			}
635
+			echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
+			$counter = 'countadd_' . $field['id'];
637
+			$js_code = ob_get_clean();
638
+			$js_code = str_replace("'", "\"", $js_code);
639
+			$js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
640
+			echo '<script>
641 641
 				jQuery(document).ready(function() {
642 642
 					var ' . $counter . ' = ' . $c . ';
643 643
 					jQuery("#add-' . $field['id'] . '").live(\'click\', function() {
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         			});
651 651
     			});
652 652
     		</script>';
653
-            echo '<br/><style>
653
+			echo '<br/><style>
654 654
 .at-inline{line-height: 1 !important;}
655 655
 .at-inline .at-field{border: 0px !important;}
656 656
 .at-inline .at-label{margin: 0 0 1px !important;}
@@ -658,532 +658,532 @@  discard block
 block discarded – undo
658 658
 .at-inline .at-textarea{width: 100px; height: 75px;}
659 659
 .at-repater-block{background-color: #FFFFFF;border: 1px solid;margin: 2px;}
660 660
 </style>';
661
-            $this->show_field_end($field, $meta);
662
-        }
663
-
664
-        /**
665
-         * Begin Field.
666
-         *
667
-         * @param string $field
668
-         * @param string $meta
669
-         * @since 1.0
670
-         * @access public
671
-         */
672
-        public function show_field_begin($field, $meta)
673
-        {
674
-            if (isset($field['group'])) {
675
-                if ($field['group'] == "start") {
676
-                    echo "<td class='at-field'>";
677
-                }
678
-            } else {
679
-                if ($this->_form_type == 'edit') {
680
-                    echo '<th valign="top" scope="row">';
681
-                } else {
682
-                    if ($field['validate_func']) {
683
-                        echo '<td><div class="form-field form-required">';
684
-                    } else {
685
-                        echo '<td><div class="form-field">';
686
-                    }
687
-                }
688
-            }
689
-            if ($field['name'] != '' || $field['name'] != FALSE) {
690
-                //echo "<div class='at-label'>";
691
-                echo "<label for='{$field['id']}'>{$field['name']}</label>";
692
-                //echo "</div>";
693
-            }
694
-            if ($this->_form_type == 'edit') {
695
-                echo '</th><td>';
696
-            }
697
-        }
698
-
699
-        /**
700
-         * End Field.
701
-         *
702
-         * @param string $field
703
-         * @param string $meta
704
-         * @since 1.0
705
-         * @access public
706
-         */
707
-        public function show_field_end($field, $meta = NULL, $group = false)
708
-        {
709
-            if (isset($field['group'])) {
710
-                if ($group == 'end') {
711
-                    if ($field['desc'] != '') {
712
-                        echo "<p class='desc-field'>{$field['desc']}</p></td>";
713
-                    } else {
714
-                        echo "</td>";
715
-                    }
716
-                } else {
717
-                    if ($field['desc'] != '') {
718
-                        echo "<p class='desc-field'>{$field['desc']}</p><br/>";
719
-                    } else {
720
-                        echo '<br/>';
721
-                    }
722
-                }
723
-            } else {
724
-                if ($field['desc'] != '') {
725
-                    echo "<p class='desc-field'>{$field['desc']}</p>";
726
-                }
727
-                if ($this->_form_type == 'edit') {
728
-                    echo '</td>';
729
-                } else {
730
-                    echo '</td></div>';
731
-                }
732
-            }
733
-        }
734
-
735
-        /**
736
-         * Show Field Text.
737
-         *
738
-         * @param string $field
739
-         * @param string $meta
740
-         * @since 1.0
741
-         * @access public
742
-         */
743
-        public function show_field_text($field, $meta)
744
-        {
745
-            $this->show_field_begin($field, $meta);
746
-            echo "<input type='text' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='30' />";
747
-            $this->show_field_end($field, $meta);
748
-        }
749
-
750
-        /**
751
-         * Show Field hidden.
752
-         *
753
-         * @param string $field
754
-         * @param string|mixed $meta
755
-         * @since 0.1.3
756
-         * @access public
757
-         */
758
-        public function show_field_hidden($field, $meta)
759
-        {
760
-            //$this->show_field_begin( $field, $meta );
761
-            echo "<input type='hidden' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}'/>";
762
-            //$this->show_field_end( $field, $meta );
763
-        }
764
-
765
-        /**
766
-         * Show Field Paragraph.
767
-         *
768
-         * @param string $field
769
-         * @since 0.1.3
770
-         * @access public
771
-         */
772
-        public function show_field_paragraph($field)
773
-        {
774
-            //$this->show_field_begin( $field, $meta );
775
-            echo '<p>' . $field['value'] . '</p>';
776
-            //$this->show_field_end( $field, $meta );
777
-        }
778
-
779
-        /**
780
-         * Show Field Textarea.
781
-         *
782
-         * @param string $field
783
-         * @param string $meta
784
-         * @since 1.0
785
-         * @access public
786
-         */
787
-        public function show_field_textarea($field, $meta)
788
-        {
789
-            $this->show_field_begin($field, $meta);
790
-            echo "<textarea class='at-textarea large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
791
-            $this->show_field_end($field, $meta);
792
-        }
793
-
794
-        /**
795
-         * Show Field Select.
796
-         *
797
-         * @param string $field
798
-         * @param string $meta
799
-         * @since 1.0
800
-         * @access public
801
-         */
802
-        public function show_field_select($field, $meta)
803
-        {
804
-
805
-            if (!is_array($meta))
806
-                $meta = (array)$meta;
807
-
808
-            $this->show_field_begin($field, $meta);
809
-            echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
810
-            foreach ($field['options'] as $key => $value) {
811
-                echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
812
-            }
813
-            echo "</select>";
814
-            $this->show_field_end($field, $meta);
815
-
816
-        }
817
-
818
-        /**
819
-         * Show Radio Field.
820
-         *
821
-         * @param string $field
822
-         * @param string $meta
823
-         * @since 1.0
824
-         * @access public
825
-         */
826
-        public function show_field_radio($field, $meta)
827
-        {
828
-
829
-            if (!is_array($meta))
830
-                $meta = (array)$meta;
831
-
832
-            $this->show_field_begin($field, $meta);
833
-            foreach ($field['options'] as $key => $value) {
834
-                echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
835
-            }
836
-            $this->show_field_end($field, $meta);
837
-        }
838
-
839
-        /**
840
-         * Show Checkbox Field.
841
-         *
842
-         * @param string $field
843
-         * @param string $meta
844
-         * @since 1.0
845
-         * @access public
846
-         */
847
-        public function show_field_checkbox($field, $meta)
848
-        {
849
-
850
-            $this->show_field_begin($field, $meta);
851
-            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
852
-            $this->show_field_end($field, $meta);
853
-        }
854
-
855
-        /**
856
-         * Show Wysiwig Field.
857
-         *
858
-         * @param string $field
859
-         * @param string $meta
860
-         * @since 1.0
861
-         * @access public
862
-         */
863
-        public function show_field_wysiwyg($field, $meta)
864
-        {
865
-            $this->show_field_begin($field, $meta);
866
-            // Add TinyMCE script for WP version < 3.3
867
-            global $wp_version;
868
-
869
-            if (version_compare($wp_version, '3.2.1') < 1) {
870
-                echo "<textarea class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
871
-            } else {
872
-                // Use new wp_editor() since WP 3.3
873
-                wp_editor(stripslashes(html_entity_decode($meta)), $field['id'], array('editor_class' => 'at-wysiwyg'));
874
-            }
875
-            $this->show_field_end($field, $meta);
876
-        }
877
-
878
-        /**
879
-         * Show File Field.
880
-         *
881
-         * @global object $post The current post object.
882
-         * @param string $field
883
-         * @param string $meta
884
-         * @since 1.0
885
-         * @access public
886
-         */
887
-        public function show_field_file($field, $meta)
888
-        {
889
-
890
-            global $post;
891
-
892
-            if (!is_array($meta))
893
-                $meta = (array)$meta;
894
-
895
-            $this->show_field_begin($field, $meta);
896
-            echo "{$field['desc']}<br />";
897
-
898
-            if (!empty($meta)) {
899
-                $nonce = wp_create_nonce('at_ajax_delete');
900
-                echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
901
-                echo '<ol class="at-upload">';
902
-                foreach ($meta as $att) {
903
-                    // if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
-                    echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
905
-                }
906
-                echo '</ol>';
907
-            }
908
-
909
-            // show form upload
910
-
911
-            echo "<div class='at-file-upload-label'>";
912
-            echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
913
-            echo "</div>";
914
-            echo "<div class='new-files'>";
915
-            echo "<div class='file-input'>";
916
-            echo "<input type='file' name='{$field['id']}[]' />";
917
-            echo "</div><!-- End .file-input -->";
918
-            echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
919
-            echo "</div><!-- End .new-files -->";
920
-            echo "</td>";
921
-            $this->show_field_end($field, $meta);
922
-        }
923
-
924
-        /**
925
-         * Show Image Field.
926
-         *
927
-         * @param array $field
928
-         * @param array $meta
929
-         * @since 1.0
930
-         * @access public
931
-         */
932
-        public function show_field_image($field, $meta)
933
-        {
934
-            $this->show_field_begin($field, $meta);
935
-            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936
-            if (is_array($meta)) {
937
-                if (isset($meta[0]) && is_array($meta[0]))
938
-                    $meta = $meta[0];
939
-            }
940
-
941
-            $uploads = wp_upload_dir();
942
-            if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943
-
944
-                $file_info = pathinfo($meta['src']);
945
-
946
-                //print_r($meta);
947
-                //print_r($uploads);
948
-                //print_r($file_info);
949
-
950
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
951
-                    $sub_dir = $file_info['dirname'];
952
-
953
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs	
954
-                $uploads_baseurl = $uploads['baseurl'];
955
-                $uploads_path = $uploads['path'];
956
-
957
-                $file_name = $file_info['basename'];
958
-
959
-                $sub_dir = str_replace($uploads_baseurl, '', $sub_dir);
960
-
961
-                $uploads_url = $uploads_baseurl . $sub_dir;
962
-
963
-                $meta['src'] = $uploads_url . '/' . $file_name;
964
-
965
-
966
-                $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
967
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
968
-                $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
969
-                $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
970
-            } else {
971
-                $html .= "<span class='mupload_img_holder'></span>";
972
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
973
-                $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
974
-                $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
975
-            }
976
-            echo $html;
977
-            $this->show_field_end($field, $meta);
978
-        }
979
-
980
-        /**
981
-         * Show Color Field.
982
-         *
983
-         * @param string $field
984
-         * @param string $meta
985
-         * @since 1.0
986
-         * @access public
987
-         */
988
-        public function show_field_color($field, $meta)
989
-        {
990
-
991
-            if (empty($meta))
992
-                $meta = '#';
993
-
994
-            $this->show_field_begin($field, $meta);
995
-
996
-            echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
997
-            //	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
998
-            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
999
-            echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
1000
-            $this->show_field_end($field, $meta);
1001
-
1002
-        }
1003
-
1004
-        /**
1005
-         * Show Checkbox List Field
1006
-         *
1007
-         * @param string $field
1008
-         * @param string $meta
1009
-         * @since 1.0
1010
-         * @access public
1011
-         */
1012
-        public function show_field_checkbox_list($field, $meta)
1013
-        {
1014
-
1015
-            if (!is_array($meta))
1016
-                $meta = (array)$meta;
1017
-
1018
-            $this->show_field_begin($field, $meta);
1019
-
1020
-            $html = array();
1021
-
1022
-            foreach ($field['options'] as $key => $value) {
1023
-                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1024
-            }
1025
-
1026
-            echo implode('<br />', $html);
1027
-
1028
-            $this->show_field_end($field, $meta);
1029
-
1030
-        }
1031
-
1032
-        /**
1033
-         * Show Date Field.
1034
-         *
1035
-         * @param string $field
1036
-         * @param string $meta
1037
-         * @since 1.0
1038
-         * @access public
1039
-         */
1040
-        public function show_field_date($field, $meta)
1041
-        {
1042
-            $this->show_field_begin($field, $meta);
1043
-            echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1044
-            $this->show_field_end($field, $meta);
1045
-        }
1046
-
1047
-        /**
1048
-         * Show time field.
1049
-         *
1050
-         * @param string $field
1051
-         * @param string $meta
1052
-         * @since 1.0
1053
-         * @access public
1054
-         */
1055
-        public function show_field_time($field, $meta)
1056
-        {
1057
-            $this->show_field_begin($field, $meta);
1058
-            echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1059
-            $this->show_field_end($field, $meta);
1060
-        }
1061
-
1062
-        /**
1063
-         * Show Posts field.
1064
-         * used creating a posts/pages/custom types checkboxlist or a select dropdown
1065
-         *
1066
-         * @global object $post The current post object.
1067
-         * @param string $field
1068
-         * @param string $meta
1069
-         * @since 1.0
1070
-         * @access public
1071
-         */
1072
-        public function show_field_posts($field, $meta)
1073
-        {
1074
-            global $post;
1075
-
1076
-            if (!is_array($meta)) $meta = (array)$meta;
1077
-            $this->show_field_begin($field, $meta);
1078
-            $options = $field['options'];
1079
-            $posts = get_posts($options['args']);
1080
-
1081
-            // checkbox_list
1082
-            if ('checkbox_list' == $options['type']) {
1083
-                foreach ($posts as $p) {
1084
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1085
-                }
1086
-            } // select
1087
-            else {
1088
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1089
-                foreach ($posts as $p) {
1090
-                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1091
-                }
1092
-                echo "</select>";
1093
-            }
1094
-
1095
-            $this->show_field_end($field, $meta);
1096
-        }
1097
-
1098
-        /**
1099
-         * Show Taxonomy field.
1100
-         * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1101
-         *
1102
-         * @global object $post The current post object.
1103
-         * @param string $field
1104
-         * @param string $meta
1105
-         * @since 1.0
1106
-         * @access public
1107
-         *
1108
-         * @uses get_terms()
1109
-         */
1110
-        public function show_field_taxonomy($field, $meta)
1111
-        {
1112
-            global $post;
1113
-
1114
-            if (!is_array($meta)) $meta = (array)$meta;
1115
-            $this->show_field_begin($field, $meta);
1116
-            $options = $field['options'];
1117
-            $terms = get_terms($options['taxonomy'], $options['args']);
1118
-
1119
-            // checkbox_list
1120
-            if ('checkbox_list' == $options['type']) {
1121
-                foreach ($terms as $term) {
1122
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1123
-                }
1124
-            } // select
1125
-            else {
1126
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1127
-                foreach ($terms as $term) {
1128
-                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1129
-                }
1130
-                echo "</select>";
1131
-            }
1132
-
1133
-            $this->show_field_end($field, $meta);
1134
-        }
1135
-
1136
-        /**
1137
-         * Save Data from Metabox
1138
-         *
1139
-         * @param string $term_id The term ID.
1140
-         * @since 1.0
1141
-         * @access public
1142
-         * @return string
1143
-         */
1144
-        public function save($term_id)
1145
-        {
1146
-
1147
-            $taxnow = '';
1148
-            if (isset($_POST['taxonomy']))
1149
-                $taxnow = $_POST['taxonomy'];
1150
-
1151
-            if (!isset($term_id)                                                        // Check Revision
1152
-                || (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1153
-                || (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1154
-                || (!current_user_can('manage_categories'))
1155
-            )                                // Check permission
1156
-            {
1157
-                return $term_id;
1158
-            }
1159
-
1160
-
1161
-            foreach ($this->_fields as $field) {
1162
-
1163
-                $name = $field['id'];
1164
-                $type = $field['type'];
1165
-                $old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1166
-                $new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1167
-
1168
-                // Validate meta value
1169
-                if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1170
-                    $new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1171
-                }
1172
-
1173
-
1174
-                if ($name == 'ct_cat_icon') {
1175
-
1176
-                    $upload_dir = wp_upload_dir();
1177
-
1178
-                    $image_name_arr = explode('/', $new['src']);
1179
-                    //$old_filename = end($image_name_arr);
1180
-                    //$img_name_arr = explode('.',$old_filename);
1181
-
1182
-                    //$old_filename = $upload_dir['path'].'/'.$old_filename;
1183
-
1184
-                    $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1185
-
1186
-                    /*rename($old_filename, $new_filename);
661
+			$this->show_field_end($field, $meta);
662
+		}
663
+
664
+		/**
665
+		 * Begin Field.
666
+		 *
667
+		 * @param string $field
668
+		 * @param string $meta
669
+		 * @since 1.0
670
+		 * @access public
671
+		 */
672
+		public function show_field_begin($field, $meta)
673
+		{
674
+			if (isset($field['group'])) {
675
+				if ($field['group'] == "start") {
676
+					echo "<td class='at-field'>";
677
+				}
678
+			} else {
679
+				if ($this->_form_type == 'edit') {
680
+					echo '<th valign="top" scope="row">';
681
+				} else {
682
+					if ($field['validate_func']) {
683
+						echo '<td><div class="form-field form-required">';
684
+					} else {
685
+						echo '<td><div class="form-field">';
686
+					}
687
+				}
688
+			}
689
+			if ($field['name'] != '' || $field['name'] != FALSE) {
690
+				//echo "<div class='at-label'>";
691
+				echo "<label for='{$field['id']}'>{$field['name']}</label>";
692
+				//echo "</div>";
693
+			}
694
+			if ($this->_form_type == 'edit') {
695
+				echo '</th><td>';
696
+			}
697
+		}
698
+
699
+		/**
700
+		 * End Field.
701
+		 *
702
+		 * @param string $field
703
+		 * @param string $meta
704
+		 * @since 1.0
705
+		 * @access public
706
+		 */
707
+		public function show_field_end($field, $meta = NULL, $group = false)
708
+		{
709
+			if (isset($field['group'])) {
710
+				if ($group == 'end') {
711
+					if ($field['desc'] != '') {
712
+						echo "<p class='desc-field'>{$field['desc']}</p></td>";
713
+					} else {
714
+						echo "</td>";
715
+					}
716
+				} else {
717
+					if ($field['desc'] != '') {
718
+						echo "<p class='desc-field'>{$field['desc']}</p><br/>";
719
+					} else {
720
+						echo '<br/>';
721
+					}
722
+				}
723
+			} else {
724
+				if ($field['desc'] != '') {
725
+					echo "<p class='desc-field'>{$field['desc']}</p>";
726
+				}
727
+				if ($this->_form_type == 'edit') {
728
+					echo '</td>';
729
+				} else {
730
+					echo '</td></div>';
731
+				}
732
+			}
733
+		}
734
+
735
+		/**
736
+		 * Show Field Text.
737
+		 *
738
+		 * @param string $field
739
+		 * @param string $meta
740
+		 * @since 1.0
741
+		 * @access public
742
+		 */
743
+		public function show_field_text($field, $meta)
744
+		{
745
+			$this->show_field_begin($field, $meta);
746
+			echo "<input type='text' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='30' />";
747
+			$this->show_field_end($field, $meta);
748
+		}
749
+
750
+		/**
751
+		 * Show Field hidden.
752
+		 *
753
+		 * @param string $field
754
+		 * @param string|mixed $meta
755
+		 * @since 0.1.3
756
+		 * @access public
757
+		 */
758
+		public function show_field_hidden($field, $meta)
759
+		{
760
+			//$this->show_field_begin( $field, $meta );
761
+			echo "<input type='hidden' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}'/>";
762
+			//$this->show_field_end( $field, $meta );
763
+		}
764
+
765
+		/**
766
+		 * Show Field Paragraph.
767
+		 *
768
+		 * @param string $field
769
+		 * @since 0.1.3
770
+		 * @access public
771
+		 */
772
+		public function show_field_paragraph($field)
773
+		{
774
+			//$this->show_field_begin( $field, $meta );
775
+			echo '<p>' . $field['value'] . '</p>';
776
+			//$this->show_field_end( $field, $meta );
777
+		}
778
+
779
+		/**
780
+		 * Show Field Textarea.
781
+		 *
782
+		 * @param string $field
783
+		 * @param string $meta
784
+		 * @since 1.0
785
+		 * @access public
786
+		 */
787
+		public function show_field_textarea($field, $meta)
788
+		{
789
+			$this->show_field_begin($field, $meta);
790
+			echo "<textarea class='at-textarea large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
791
+			$this->show_field_end($field, $meta);
792
+		}
793
+
794
+		/**
795
+		 * Show Field Select.
796
+		 *
797
+		 * @param string $field
798
+		 * @param string $meta
799
+		 * @since 1.0
800
+		 * @access public
801
+		 */
802
+		public function show_field_select($field, $meta)
803
+		{
804
+
805
+			if (!is_array($meta))
806
+				$meta = (array)$meta;
807
+
808
+			$this->show_field_begin($field, $meta);
809
+			echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
810
+			foreach ($field['options'] as $key => $value) {
811
+				echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
812
+			}
813
+			echo "</select>";
814
+			$this->show_field_end($field, $meta);
815
+
816
+		}
817
+
818
+		/**
819
+		 * Show Radio Field.
820
+		 *
821
+		 * @param string $field
822
+		 * @param string $meta
823
+		 * @since 1.0
824
+		 * @access public
825
+		 */
826
+		public function show_field_radio($field, $meta)
827
+		{
828
+
829
+			if (!is_array($meta))
830
+				$meta = (array)$meta;
831
+
832
+			$this->show_field_begin($field, $meta);
833
+			foreach ($field['options'] as $key => $value) {
834
+				echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
835
+			}
836
+			$this->show_field_end($field, $meta);
837
+		}
838
+
839
+		/**
840
+		 * Show Checkbox Field.
841
+		 *
842
+		 * @param string $field
843
+		 * @param string $meta
844
+		 * @since 1.0
845
+		 * @access public
846
+		 */
847
+		public function show_field_checkbox($field, $meta)
848
+		{
849
+
850
+			$this->show_field_begin($field, $meta);
851
+			echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
852
+			$this->show_field_end($field, $meta);
853
+		}
854
+
855
+		/**
856
+		 * Show Wysiwig Field.
857
+		 *
858
+		 * @param string $field
859
+		 * @param string $meta
860
+		 * @since 1.0
861
+		 * @access public
862
+		 */
863
+		public function show_field_wysiwyg($field, $meta)
864
+		{
865
+			$this->show_field_begin($field, $meta);
866
+			// Add TinyMCE script for WP version < 3.3
867
+			global $wp_version;
868
+
869
+			if (version_compare($wp_version, '3.2.1') < 1) {
870
+				echo "<textarea class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
871
+			} else {
872
+				// Use new wp_editor() since WP 3.3
873
+				wp_editor(stripslashes(html_entity_decode($meta)), $field['id'], array('editor_class' => 'at-wysiwyg'));
874
+			}
875
+			$this->show_field_end($field, $meta);
876
+		}
877
+
878
+		/**
879
+		 * Show File Field.
880
+		 *
881
+		 * @global object $post The current post object.
882
+		 * @param string $field
883
+		 * @param string $meta
884
+		 * @since 1.0
885
+		 * @access public
886
+		 */
887
+		public function show_field_file($field, $meta)
888
+		{
889
+
890
+			global $post;
891
+
892
+			if (!is_array($meta))
893
+				$meta = (array)$meta;
894
+
895
+			$this->show_field_begin($field, $meta);
896
+			echo "{$field['desc']}<br />";
897
+
898
+			if (!empty($meta)) {
899
+				$nonce = wp_create_nonce('at_ajax_delete');
900
+				echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
901
+				echo '<ol class="at-upload">';
902
+				foreach ($meta as $att) {
903
+					// if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
+					echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
905
+				}
906
+				echo '</ol>';
907
+			}
908
+
909
+			// show form upload
910
+
911
+			echo "<div class='at-file-upload-label'>";
912
+			echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
913
+			echo "</div>";
914
+			echo "<div class='new-files'>";
915
+			echo "<div class='file-input'>";
916
+			echo "<input type='file' name='{$field['id']}[]' />";
917
+			echo "</div><!-- End .file-input -->";
918
+			echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
919
+			echo "</div><!-- End .new-files -->";
920
+			echo "</td>";
921
+			$this->show_field_end($field, $meta);
922
+		}
923
+
924
+		/**
925
+		 * Show Image Field.
926
+		 *
927
+		 * @param array $field
928
+		 * @param array $meta
929
+		 * @since 1.0
930
+		 * @access public
931
+		 */
932
+		public function show_field_image($field, $meta)
933
+		{
934
+			$this->show_field_begin($field, $meta);
935
+			$html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936
+			if (is_array($meta)) {
937
+				if (isset($meta[0]) && is_array($meta[0]))
938
+					$meta = $meta[0];
939
+			}
940
+
941
+			$uploads = wp_upload_dir();
942
+			if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943
+
944
+				$file_info = pathinfo($meta['src']);
945
+
946
+				//print_r($meta);
947
+				//print_r($uploads);
948
+				//print_r($file_info);
949
+
950
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
951
+					$sub_dir = $file_info['dirname'];
952
+
953
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs	
954
+				$uploads_baseurl = $uploads['baseurl'];
955
+				$uploads_path = $uploads['path'];
956
+
957
+				$file_name = $file_info['basename'];
958
+
959
+				$sub_dir = str_replace($uploads_baseurl, '', $sub_dir);
960
+
961
+				$uploads_url = $uploads_baseurl . $sub_dir;
962
+
963
+				$meta['src'] = $uploads_url . '/' . $file_name;
964
+
965
+
966
+				$html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
967
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
968
+				$html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
969
+				$html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
970
+			} else {
971
+				$html .= "<span class='mupload_img_holder'></span>";
972
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
973
+				$html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
974
+				$html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
975
+			}
976
+			echo $html;
977
+			$this->show_field_end($field, $meta);
978
+		}
979
+
980
+		/**
981
+		 * Show Color Field.
982
+		 *
983
+		 * @param string $field
984
+		 * @param string $meta
985
+		 * @since 1.0
986
+		 * @access public
987
+		 */
988
+		public function show_field_color($field, $meta)
989
+		{
990
+
991
+			if (empty($meta))
992
+				$meta = '#';
993
+
994
+			$this->show_field_begin($field, $meta);
995
+
996
+			echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
997
+			//	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
998
+			echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
999
+			echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
1000
+			$this->show_field_end($field, $meta);
1001
+
1002
+		}
1003
+
1004
+		/**
1005
+		 * Show Checkbox List Field
1006
+		 *
1007
+		 * @param string $field
1008
+		 * @param string $meta
1009
+		 * @since 1.0
1010
+		 * @access public
1011
+		 */
1012
+		public function show_field_checkbox_list($field, $meta)
1013
+		{
1014
+
1015
+			if (!is_array($meta))
1016
+				$meta = (array)$meta;
1017
+
1018
+			$this->show_field_begin($field, $meta);
1019
+
1020
+			$html = array();
1021
+
1022
+			foreach ($field['options'] as $key => $value) {
1023
+				$html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1024
+			}
1025
+
1026
+			echo implode('<br />', $html);
1027
+
1028
+			$this->show_field_end($field, $meta);
1029
+
1030
+		}
1031
+
1032
+		/**
1033
+		 * Show Date Field.
1034
+		 *
1035
+		 * @param string $field
1036
+		 * @param string $meta
1037
+		 * @since 1.0
1038
+		 * @access public
1039
+		 */
1040
+		public function show_field_date($field, $meta)
1041
+		{
1042
+			$this->show_field_begin($field, $meta);
1043
+			echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1044
+			$this->show_field_end($field, $meta);
1045
+		}
1046
+
1047
+		/**
1048
+		 * Show time field.
1049
+		 *
1050
+		 * @param string $field
1051
+		 * @param string $meta
1052
+		 * @since 1.0
1053
+		 * @access public
1054
+		 */
1055
+		public function show_field_time($field, $meta)
1056
+		{
1057
+			$this->show_field_begin($field, $meta);
1058
+			echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1059
+			$this->show_field_end($field, $meta);
1060
+		}
1061
+
1062
+		/**
1063
+		 * Show Posts field.
1064
+		 * used creating a posts/pages/custom types checkboxlist or a select dropdown
1065
+		 *
1066
+		 * @global object $post The current post object.
1067
+		 * @param string $field
1068
+		 * @param string $meta
1069
+		 * @since 1.0
1070
+		 * @access public
1071
+		 */
1072
+		public function show_field_posts($field, $meta)
1073
+		{
1074
+			global $post;
1075
+
1076
+			if (!is_array($meta)) $meta = (array)$meta;
1077
+			$this->show_field_begin($field, $meta);
1078
+			$options = $field['options'];
1079
+			$posts = get_posts($options['args']);
1080
+
1081
+			// checkbox_list
1082
+			if ('checkbox_list' == $options['type']) {
1083
+				foreach ($posts as $p) {
1084
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1085
+				}
1086
+			} // select
1087
+			else {
1088
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1089
+				foreach ($posts as $p) {
1090
+					echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1091
+				}
1092
+				echo "</select>";
1093
+			}
1094
+
1095
+			$this->show_field_end($field, $meta);
1096
+		}
1097
+
1098
+		/**
1099
+		 * Show Taxonomy field.
1100
+		 * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1101
+		 *
1102
+		 * @global object $post The current post object.
1103
+		 * @param string $field
1104
+		 * @param string $meta
1105
+		 * @since 1.0
1106
+		 * @access public
1107
+		 *
1108
+		 * @uses get_terms()
1109
+		 */
1110
+		public function show_field_taxonomy($field, $meta)
1111
+		{
1112
+			global $post;
1113
+
1114
+			if (!is_array($meta)) $meta = (array)$meta;
1115
+			$this->show_field_begin($field, $meta);
1116
+			$options = $field['options'];
1117
+			$terms = get_terms($options['taxonomy'], $options['args']);
1118
+
1119
+			// checkbox_list
1120
+			if ('checkbox_list' == $options['type']) {
1121
+				foreach ($terms as $term) {
1122
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1123
+				}
1124
+			} // select
1125
+			else {
1126
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1127
+				foreach ($terms as $term) {
1128
+					echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1129
+				}
1130
+				echo "</select>";
1131
+			}
1132
+
1133
+			$this->show_field_end($field, $meta);
1134
+		}
1135
+
1136
+		/**
1137
+		 * Save Data from Metabox
1138
+		 *
1139
+		 * @param string $term_id The term ID.
1140
+		 * @since 1.0
1141
+		 * @access public
1142
+		 * @return string
1143
+		 */
1144
+		public function save($term_id)
1145
+		{
1146
+
1147
+			$taxnow = '';
1148
+			if (isset($_POST['taxonomy']))
1149
+				$taxnow = $_POST['taxonomy'];
1150
+
1151
+			if (!isset($term_id)                                                        // Check Revision
1152
+				|| (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1153
+				|| (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1154
+				|| (!current_user_can('manage_categories'))
1155
+			)                                // Check permission
1156
+			{
1157
+				return $term_id;
1158
+			}
1159
+
1160
+
1161
+			foreach ($this->_fields as $field) {
1162
+
1163
+				$name = $field['id'];
1164
+				$type = $field['type'];
1165
+				$old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1166
+				$new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1167
+
1168
+				// Validate meta value
1169
+				if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1170
+					$new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1171
+				}
1172
+
1173
+
1174
+				if ($name == 'ct_cat_icon') {
1175
+
1176
+					$upload_dir = wp_upload_dir();
1177
+
1178
+					$image_name_arr = explode('/', $new['src']);
1179
+					//$old_filename = end($image_name_arr);
1180
+					//$img_name_arr = explode('.',$old_filename);
1181
+
1182
+					//$old_filename = $upload_dir['path'].'/'.$old_filename;
1183
+
1184
+					$new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1185
+
1186
+					/*rename($old_filename, $new_filename);
1187 1187
 				
1188 1188
 				//subdir
1189 1189
 				$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 				update_attached_file( $new['id'], $new['src'] );*/
1192 1192
 
1193 1193
 
1194
-                    /*	
1194
+					/*	
1195 1195
 		
1196 1196
 		$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
1197 1197
 		
@@ -1216,67 +1216,67 @@  discard block
 block discarded – undo
1216 1216
 		$attach_id = wp_insert_attachment( $attachment, $filename);*/
1217 1217
 
1218 1218
 
1219
-                }
1220
-
1221
-
1222
-                //skip on Paragraph field
1223
-                if ($type != "paragraph") {
1224
-
1225
-                    // Call defined method to save meta value, if there's no methods, call common one.
1226
-                    $save_func = 'save_field_' . $type;
1227
-                    if (method_exists($this, $save_func)) {
1228
-                        call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1229
-                    } else {
1230
-                        $this->save_field($term_id, $field, $old, $new);
1231
-                    }
1232
-                }
1233
-
1234
-            } // End foreach
1235
-
1236
-        }
1237
-
1238
-        /**
1239
-         * Common function for saving fields.
1240
-         *
1241
-         * @param string $term_id The term ID.
1242
-         * @param string $field
1243
-         * @param string $old
1244
-         * @param string|mixed $new
1245
-         * @since 1.0
1246
-         * @access public
1247
-         */
1248
-        public function save_field($term_id, $field, $old, $new)
1249
-        {
1250
-            $name = $field['id'];
1251
-            $this->delete_tax_meta($term_id, $name);
1252
-            if ($new === '' || $new === array())
1253
-                return;
1254
-
1255
-            $this->update_tax_meta($term_id, $name, $new);
1256
-        }
1257
-
1258
-        /**
1259
-         * function for saving image field.
1260
-         *
1261
-         * @param string $term_id The term ID.
1262
-         * @param string $field
1263
-         * @param string $old
1264
-         * @param string|mixed $new
1265
-         * @since 1.0
1266
-         * @access public
1267
-         */
1268
-        public function save_field_image($term_id, $field, $old, $new)
1269
-        {
1270
-            $name = $field['id'];
1271
-
1272
-            $this->delete_tax_meta($term_id, $name);
1273
-            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1274
-                return;
1275
-
1276
-            $this->update_tax_meta($term_id, $name, $new);
1277
-        }
1278
-
1279
-        /*
1219
+				}
1220
+
1221
+
1222
+				//skip on Paragraph field
1223
+				if ($type != "paragraph") {
1224
+
1225
+					// Call defined method to save meta value, if there's no methods, call common one.
1226
+					$save_func = 'save_field_' . $type;
1227
+					if (method_exists($this, $save_func)) {
1228
+						call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1229
+					} else {
1230
+						$this->save_field($term_id, $field, $old, $new);
1231
+					}
1232
+				}
1233
+
1234
+			} // End foreach
1235
+
1236
+		}
1237
+
1238
+		/**
1239
+		 * Common function for saving fields.
1240
+		 *
1241
+		 * @param string $term_id The term ID.
1242
+		 * @param string $field
1243
+		 * @param string $old
1244
+		 * @param string|mixed $new
1245
+		 * @since 1.0
1246
+		 * @access public
1247
+		 */
1248
+		public function save_field($term_id, $field, $old, $new)
1249
+		{
1250
+			$name = $field['id'];
1251
+			$this->delete_tax_meta($term_id, $name);
1252
+			if ($new === '' || $new === array())
1253
+				return;
1254
+
1255
+			$this->update_tax_meta($term_id, $name, $new);
1256
+		}
1257
+
1258
+		/**
1259
+		 * function for saving image field.
1260
+		 *
1261
+		 * @param string $term_id The term ID.
1262
+		 * @param string $field
1263
+		 * @param string $old
1264
+		 * @param string|mixed $new
1265
+		 * @since 1.0
1266
+		 * @access public
1267
+		 */
1268
+		public function save_field_image($term_id, $field, $old, $new)
1269
+		{
1270
+			$name = $field['id'];
1271
+
1272
+			$this->delete_tax_meta($term_id, $name);
1273
+			if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1274
+				return;
1275
+
1276
+			$this->update_tax_meta($term_id, $name, $new);
1277
+		}
1278
+
1279
+		/*
1280 1280
 	 * Save Wysiwyg Field.
1281 1281
 	 *
1282 1282
 	 * @param string $term_id The term ID. 
@@ -1286,806 +1286,806 @@  discard block
 block discarded – undo
1286 1286
 	 * @since 1.0
1287 1287
 	 * @access public 
1288 1288
 	 */
1289
-        public function save_field_wysiwyg($term_id, $field, $old, $new)
1290
-        {
1291
-            $this->save_field($term_id, $field, $old, $new);
1292
-        }
1293
-
1294
-        /**
1295
-         * Save repeater Fields.
1296
-         *
1297
-         * @param string $term_id The term ID.
1298
-         * @param string $field
1299
-         * @param string|mixed $old
1300
-         * @param string|mixed $new
1301
-         * @since 1.0
1302
-         * @access public
1303
-         */
1304
-        public function save_field_repeater($term_id, $field, $old, $new)
1305
-        {
1306
-            if (is_array($new) && count($new) > 0) {
1307
-                foreach ($new as $n) {
1308
-                    foreach ($field['fields'] as $f) {
1309
-                        $type = $f['type'];
1310
-                        switch ($type) {
1311
-                            case 'wysiwyg':
1312
-                                $n[$f['id']] = wpautop($n[$f['id']]);
1313
-                                break;
1314
-                            case 'file':
1315
-                                $n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1316
-                                break;
1317
-                            default:
1318
-                                break;
1319
-                        }
1320
-                    }
1321
-                    if (!$this->is_array_empty($n))
1322
-                        $temp[] = $n;
1323
-                }
1324
-                if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1325
-                    $this->update_tax_meta($term_id, $field['id'], $temp);
1326
-                } else {
1327
-                    //	remove old meta if exists
1328
-                    delete_post_meta($term_id, $field['id']);
1329
-                }
1330
-            } else {
1331
-                //	remove old meta if exists
1332
-                delete_post_meta($term_id, $field['id']);
1333
-            }
1334
-        }
1335
-
1336
-        /**
1337
-         * Save File Field.
1338
-         *
1339
-         * @param string $term_id The term ID.
1340
-         * @param string $field
1341
-         * @param string $old
1342
-         * @param string $new
1343
-         * @since 1.0
1344
-         * @access public
1345
-         */
1346
-        public function save_field_file($term_id, $field, $old, $new)
1347
-        {
1348
-
1349
-            $name = $field['id'];
1350
-            if (empty($_FILES[$name]))
1351
-                return;
1352
-            $this->fix_file_array($_FILES[$name]);
1353
-            foreach ($_FILES[$name] as $position => $fileitem) {
1354
-
1355
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1356
-                if (empty($file['file']))
1357
-                    continue;
1358
-                $filename = $file['file'];
1359
-
1360
-                $attachment = array(
1361
-                    'post_mime_type' => $file['type'],
1362
-                    'guid' => $file['url'],
1363
-                    'post_parent' => $term_id,
1364
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1365
-                    'post_content' => ''
1366
-                );
1367
-
1368
-                $id = wp_insert_attachment($attachment, $filename, $term_id);
1369
-
1370
-                if (!is_wp_error($id)) {
1371
-
1372
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1373
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1374
-
1375
-                } // End if
1376
-
1377
-            } // End foreach
1378
-
1379
-        }
1380
-
1381
-        /**
1382
-         * Save repeater File Field.
1383
-         * @param string $term_id The term ID.
1384
-         * @param string $field
1385
-         * @param string $old
1386
-         * @param string $new
1387
-         * @since 1.0
1388
-         * @access public
1389
-         * @return int|void
1390
-         */
1391
-        public function save_field_file_repeater($term_id, $field, $old, $new)
1392
-        {
1393
-
1394
-            $name = $field['id'];
1395
-            if (empty($_FILES[$name]))
1396
-                return;
1397
-            $this->fix_file_array($_FILES[$name]);
1398
-            foreach ($_FILES[$name] as $position => $fileitem) {
1399
-
1400
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1401
-                if (empty($file['file']))
1402
-                    continue;
1403
-                $filename = $file['file'];
1404
-
1405
-                $attachment = array(
1406
-                    'post_mime_type' => $file['type'],
1407
-                    'guid' => $file['url'],
1408
-                    'post_parent' => $term_id,
1409
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1410
-                    'post_content' => ''
1411
-                );
1412
-
1413
-                $id = wp_insert_attachment($attachment, $filename);
1414
-
1415
-                if (!is_wp_error($id)) {
1416
-
1417
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1418
-                    return $id;    // return file's url in meta fields
1419
-                } // End if
1420
-            } // End foreach
1421
-        }
1422
-
1423
-        /**
1424
-         * Add missed values for meta box.
1425
-         *
1426
-         * @since 1.0
1427
-         * @access public
1428
-         */
1429
-        public function add_missed_values()
1430
-        {
1431
-
1432
-            // Default values for meta box
1433
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1434
-
1435
-            if(is_array($this->_fields)) {
1436
-                // Default values for fields
1437
-                foreach ($this->_fields as &$field) {
1438
-                    $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1439
-                    $std = $multiple ? array() : '';
1440
-                    $format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1441
-                    $field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1442
-                } // End foreach
1443
-            }
1444
-        }
1445
-
1446
-        /**
1447
-         * Check if field with $type exists.
1448
-         *
1449
-         * @param string $type
1450
-         * @since 1.0
1451
-         * @access public
1452
-         */
1453
-        public function has_field($type)
1454
-        {
1455
-            if(is_array($this->_fields)) {
1456
-                foreach ($this->_fields as $field) {
1457
-                    if ($type == $field['type'])
1458
-                        return true;
1459
-                }
1460
-            }
1461
-            return false;
1462
-        }
1463
-
1464
-        /**
1465
-         * Check if current page is edit page.
1466
-         *
1467
-         * @since 1.0
1468
-         * @access public
1469
-         */
1470
-        public function is_edit_page()
1471
-        {
1472
-            global $pagenow;
1473
-            return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1474
-        }
1475
-
1476
-        /**
1477
-         * Fixes the odd indexing of multiple file uploads.
1478
-         *
1479
-         * Goes from the format:
1480
-         * $_FILES['field']['key']['index']
1481
-         * to
1482
-         * The More standard and appropriate:
1483
-         * $_FILES['field']['index']['key']
1484
-         *
1485
-         * @param string $files
1486
-         * @since 1.0
1487
-         * @access public
1488
-         */
1489
-        public function fix_file_array(&$files)
1490
-        {
1491
-
1492
-            $output = array();
1493
-
1494
-            foreach ($files as $key => $list) {
1495
-                foreach ($list as $index => $value) {
1496
-                    $output[$index][$key] = $value;
1497
-                }
1498
-            }
1499
-
1500
-            return $files = $output;
1501
-
1502
-        }
1503
-
1504
-        /**
1505
-         * Get proper JQuery UI version.
1506
-         *
1507
-         * Used in order to not conflict with WP Admin Scripts.
1508
-         *
1509
-         * @since 1.0
1510
-         * @access public
1511
-         */
1512
-        public function get_jqueryui_ver()
1513
-        {
1514
-
1515
-            global $wp_version;
1516
-
1517
-            if (version_compare($wp_version, '3.1', '>=')) {
1518
-                return '1.8.10';
1519
-            }
1520
-
1521
-            return '1.7.3';
1522
-
1523
-        }
1524
-
1525
-        /**
1526
-         *  Add Field to meta box (generic function)
1527
-         * @author Ohad Raz
1528
-         * @since 1.0
1529
-         * @access public
1530
-         * @param $id string  field id, i.e. the meta key
1531
-         * @param $args mixed|array
1532
-         */
1533
-        public function addField($id, $args)
1534
-        {
1535
-            $new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1536
-            $new_field = array_merge($new_field, $args);
1537
-            $this->_fields[] = $new_field;
1538
-        }
1539
-
1540
-
1541
-        /**
1542
-         *  Add Text Field to meta box
1543
-         * @author Ohad Raz
1544
-         * @since 1.0
1545
-         * @access public
1546
-         * @param $id string  field id, i.e. the meta key
1547
-         * @param $args mixed|array
1548
-         *    'name' => // field name/label string optional
1549
-         *    'desc' => // field description, string optional
1550
-         *    'std' => // default value, string optional
1551
-         *    'style' =>    // custom style for field, string optional
1552
-         *    'validate_func' => // validate function, string optional
1553
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1554
-         */
1555
-        public function addText($id, $args, $repeater = false)
1556
-        {
1557
-            $new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1558
-            $new_field = array_merge($new_field, $args);
1559
-            if (false === $repeater) {
1560
-                $this->_fields[] = $new_field;
1561
-            } else {
1562
-                return $new_field;
1563
-            }
1564
-        }
1565
-
1566
-        /**
1567
-         *  Add Hidden Field to meta box
1568
-         * @author Ohad Raz
1569
-         * @since 0.1.3
1570
-         * @access public
1571
-         * @param $id string  field id, i.e. the meta key
1572
-         * @param $args mixed|array
1573
-         *    'name' => // field name/label string optional
1574
-         *    'desc' => // field description, string optional
1575
-         *    'std' => // default value, string optional
1576
-         *    'style' =>    // custom style for field, string optional
1577
-         *    'validate_func' => // validate function, string optional
1578
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1579
-         */
1580
-        public function addHidden($id, $args, $repeater = false)
1581
-        {
1582
-            $new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1583
-            $new_field = array_merge($new_field, $args);
1584
-            if (false === $repeater) {
1585
-                $this->_fields[] = $new_field;
1586
-            } else {
1587
-                return $new_field;
1588
-            }
1589
-        }
1590
-
1591
-        /**
1592
-         *  Add Paragraph to meta box
1593
-         * @author Ohad Raz
1594
-         * @since 0.1.3
1595
-         * @access public
1596
-         * @param $id string  field id, i.e. the meta key
1597
-         * @param $value  paragraph html
1598
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1599
-         */
1600
-        public function addParagraph($id, $args, $repeater = false)
1601
-        {
1602
-            $new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1603
-            $new_field = array_merge($new_field, $args);
1604
-            if (false === $repeater) {
1605
-                $this->_fields[] = $new_field;
1606
-            } else {
1607
-                return $new_field;
1608
-            }
1609
-        }
1610
-
1611
-        /**
1612
-         *  Add Checkbox Field to meta box
1613
-         * @author Ohad Raz
1614
-         * @since 1.0
1615
-         * @access public
1616
-         * @param $id string  field id, i.e. the meta key
1617
-         * @param $args mixed|array
1618
-         *    'name' => // field name/label string optional
1619
-         *    'desc' => // field description, string optional
1620
-         *    'std' => // default value, string optional
1621
-         *    'validate_func' => // validate function, string optional
1622
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1623
-         */
1624
-        public function addCheckbox($id, $args, $repeater = false)
1625
-        {
1626
-            $new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1627
-            $new_field = array_merge($new_field, $args);
1628
-            if (false === $repeater) {
1629
-                $this->_fields[] = $new_field;
1630
-            } else {
1631
-                return $new_field;
1632
-            }
1633
-        }
1634
-
1635
-        /**
1636
-         *  Add CheckboxList Field to meta box
1637
-         * @author Ohad Raz
1638
-         * @since 1.0
1639
-         * @access public
1640
-         * @param $id string  field id, i.e. the meta key
1641
-         * @param $options (array)  array of key => value pairs for select options
1642
-         * @param $args mixed|array
1643
-         *    'name' => // field name/label string optional
1644
-         *    'desc' => // field description, string optional
1645
-         *    'std' => // default value, string optional
1646
-         *    'validate_func' => // validate function, string optional
1647
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1648
-         *
1649
-         * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1650
-         *   which means the last param as false to get the values in an array
1651
-         */
1652
-        public function addCheckboxList($id, $options, $args, $repeater = false)
1653
-        {
1654
-            $new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1655
-            $new_field = array_merge($new_field, $args);
1656
-            if (false === $repeater) {
1657
-                $this->_fields[] = $new_field;
1658
-            } else {
1659
-                return $new_field;
1660
-            }
1661
-        }
1662
-
1663
-        /**
1664
-         *  Add Textarea Field to meta box
1665
-         * @author Ohad Raz
1666
-         * @since 1.0
1667
-         * @access public
1668
-         * @param $id string  field id, i.e. the meta key
1669
-         * @param $args mixed|array
1670
-         *    'name' => // field name/label string optional
1671
-         *    'desc' => // field description, string optional
1672
-         *    'std' => // default value, string optional
1673
-         *    'style' =>    // custom style for field, string optional
1674
-         *    'validate_func' => // validate function, string optional
1675
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1676
-         */
1677
-        public function addTextarea($id, $args, $repeater = false)
1678
-        {
1679
-            $new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1680
-            $new_field = array_merge($new_field, $args);
1681
-            if (false === $repeater) {
1682
-                $this->_fields[] = $new_field;
1683
-            } else {
1684
-                return $new_field;
1685
-            }
1686
-        }
1687
-
1688
-        /**
1689
-         *  Add Select Field to meta box
1690
-         * @author Ohad Raz
1691
-         * @since 1.0
1692
-         * @access public
1693
-         * @param $id string field id, i.e. the meta key
1694
-         * @param $options (array)  array of key => value pairs for select options
1695
-         * @param $args mixed|array
1696
-         *    'name' => // field name/label string optional
1697
-         *    'desc' => // field description, string optional
1698
-         *    'std' => // default value, (array) optional
1699
-         *    'multiple' => // select multiple values, optional. Default is false.
1700
-         *    'validate_func' => // validate function, string optional
1701
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1702
-         */
1703
-        public function addSelect($id, $options, $args, $repeater = false)
1704
-        {
1705
-            $new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1706
-            $new_field = array_merge($new_field, $args);
1707
-            if (false === $repeater) {
1708
-                $this->_fields[] = $new_field;
1709
-            } else {
1710
-                return $new_field;
1711
-            }
1712
-        }
1713
-
1714
-
1715
-        /**
1716
-         *  Add Radio Field to meta box
1717
-         * @author Ohad Raz
1718
-         * @since 1.0
1719
-         * @access public
1720
-         * @param $id string field id, i.e. the meta key
1721
-         * @param $options (array)  array of key => value pairs for radio options
1722
-         * @param $args mixed|array
1723
-         *    'name' => // field name/label string optional
1724
-         *    'desc' => // field description, string optional
1725
-         *    'std' => // default value, string optional
1726
-         *    'validate_func' => // validate function, string optional
1727
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1728
-         */
1729
-        public function addRadio($id, $options, $args, $repeater = false)
1730
-        {
1731
-            $new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1732
-            $new_field = array_merge($new_field, $args);
1733
-            if (false === $repeater) {
1734
-                $this->_fields[] = $new_field;
1735
-            } else {
1736
-                return $new_field;
1737
-            }
1738
-        }
1739
-
1740
-        /**
1741
-         *  Add Date Field to meta box
1742
-         * @author Ohad Raz
1743
-         * @since 1.0
1744
-         * @access public
1745
-         * @param $id string  field id, i.e. the meta key
1746
-         * @param $args mixed|array
1747
-         *    'name' => // field name/label string optional
1748
-         *    'desc' => // field description, string optional
1749
-         *    'std' => // default value, string optional
1750
-         *    'validate_func' => // validate function, string optional
1751
-         *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1752
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1753
-         */
1754
-        public function addDate($id, $args, $repeater = false)
1755
-        {
1756
-            $new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1757
-            $new_field = array_merge($new_field, $args);
1758
-            if (false === $repeater) {
1759
-                $this->_fields[] = $new_field;
1760
-            } else {
1761
-                return $new_field;
1762
-            }
1763
-        }
1764
-
1765
-        /**
1766
-         *  Add Time Field to meta box
1767
-         * @author Ohad Raz
1768
-         * @since 1.0
1769
-         * @access public
1770
-         * @param $id string- field id, i.e. the meta key
1771
-         * @param $args mixed|array
1772
-         *    'name' => // field name/label string optional
1773
-         *    'desc' => // field description, string optional
1774
-         *    'std' => // default value, string optional
1775
-         *    'validate_func' => // validate function, string optional
1776
-         *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1777
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1778
-         */
1779
-        public function addTime($id, $args, $repeater = false)
1780
-        {
1781
-            $new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1782
-            $new_field = array_merge($new_field, $args);
1783
-            if (false === $repeater) {
1784
-                $this->_fields[] = $new_field;
1785
-            } else {
1786
-                return $new_field;
1787
-            }
1788
-        }
1789
-
1790
-        /**
1791
-         *  Add Color Field to meta box
1792
-         * @author Ohad Raz
1793
-         * @since 1.0
1794
-         * @access public
1795
-         * @param $id string  field id, i.e. the meta key
1796
-         * @param $args mixed|array
1797
-         *    'name' => // field name/label string optional
1798
-         *    'desc' => // field description, string optional
1799
-         *    'std' => // default value, string optional
1800
-         *    'validate_func' => // validate function, string optional
1801
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1802
-         */
1803
-        public function addColor($id, $args, $repeater = false)
1804
-        {
1805
-            $new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1806
-            $new_field = array_merge($new_field, $args);
1807
-            if (false === $repeater) {
1808
-                $this->_fields[] = $new_field;
1809
-            } else {
1810
-                return $new_field;
1811
-            }
1812
-        }
1813
-
1814
-        /**
1815
-         *  Add Image Field to meta box
1816
-         * @author Ohad Raz
1817
-         * @since 1.0
1818
-         * @access public
1819
-         * @param $id string  field id, i.e. the meta key
1820
-         * @param $args mixed|array
1821
-         *    'name' => // field name/label string optional
1822
-         *    'desc' => // field description, string optional
1823
-         *    'validate_func' => // validate function, string optional
1824
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1825
-         */
1826
-        public function addImage($id, $args, $repeater = false)
1827
-        {
1828
-            $new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1829
-            $new_field = array_merge($new_field, $args);
1830
-
1831
-            if (false === $repeater) {
1832
-                $this->_fields[] = $new_field;
1833
-            } else {
1834
-                return $new_field;
1835
-            }
1836
-        }
1837
-
1838
-        /**
1839
-         *  Add File Field to meta box
1840
-         * @author Ohad Raz
1841
-         * @since 1.0
1842
-         * @access public
1843
-         * @param $id string  field id, i.e. the meta key
1844
-         * @param $args mixed|array
1845
-         *    'name' => // field name/label string optional
1846
-         *    'desc' => // field description, string optional
1847
-         *    'validate_func' => // validate function, string optional
1848
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1849
-         */
1850
-        public function addFile($id, $args, $repeater = false)
1851
-        {
1852
-            $new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1853
-            $new_field = array_merge($new_field, $args);
1854
-            if (false === $repeater) {
1855
-                $this->_fields[] = $new_field;
1856
-            } else {
1857
-                return $new_field;
1858
-            }
1859
-        }
1860
-
1861
-        /**
1862
-         *  Add WYSIWYG Field to meta box
1863
-         * @author Ohad Raz
1864
-         * @since 1.0
1865
-         * @access public
1866
-         * @param $id string  field id, i.e. the meta key
1867
-         * @param $args mixed|array
1868
-         *    'name' => // field name/label string optional
1869
-         *    'desc' => // field description, string optional
1870
-         *    'std' => // default value, string optional
1871
-         *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1872
-         *    'validate_func' => // validate function, string optional
1873
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1874
-         */
1875
-        public function addWysiwyg($id, $args, $repeater = false)
1876
-        {
1877
-            $new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1878
-            $new_field = array_merge($new_field, $args);
1879
-            if (false === $repeater) {
1880
-                $this->_fields[] = $new_field;
1881
-            } else {
1882
-                return $new_field;
1883
-            }
1884
-        }
1885
-
1886
-        /**
1887
-         *  Add Taxonomy Field to meta box
1888
-         * @author Ohad Raz
1889
-         * @since 1.0
1890
-         * @access public
1891
-         * @param $id string  field id, i.e. the meta key
1892
-         * @param $options mixed|array options of taxonomy field
1893
-         *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1894
-         * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1895
-         * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1896
-         * @param $args mixed|array
1897
-         *    'name' => // field name/label string optional
1898
-         *    'desc' => // field description, string optional
1899
-         *    'std' => // default value, string optional
1900
-         *    'validate_func' => // validate function, string optional
1901
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1902
-         */
1903
-        public function addTaxonomy($id, $options, $args, $repeater = false)
1904
-        {
1905
-            $q = array('hide_empty' => 0);
1906
-            $tax = 'category';
1907
-            $type = 'select';
1908
-            $temp = array($tax, $type, $q);
1909
-            $options = array_merge($temp, $options);
1910
-            $new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1911
-            $new_field = array_merge($new_field, $args);
1912
-            if (false === $repeater) {
1913
-                $this->_fields[] = $new_field;
1914
-            } else {
1915
-                return $new_field;
1916
-            }
1917
-        }
1918
-
1919
-        /**
1920
-         *  Add posts Field to meta box
1921
-         * @author Ohad Raz
1922
-         * @since 1.0
1923
-         * @access public
1924
-         * @param $id string  field id, i.e. the meta key
1925
-         * @param $options mixed|array options of taxonomy field
1926
-         *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1927
-         * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1928
-         * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1929
-         * @param $args mixed|array
1930
-         *    'name' => // field name/label string optional
1931
-         *    'desc' => // field description, string optional
1932
-         *    'std' => // default value, string optional
1933
-         *    'validate_func' => // validate function, string optional
1934
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1935
-         */
1936
-        public function addPosts($id, $options, $args, $repeater = false)
1937
-        {
1938
-            $q = array('posts_per_page' => -1);
1939
-            $temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1940
-            $options = array_merge($temp, $options);
1941
-            $new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1942
-            $new_field = array_merge($new_field, $args);
1943
-            if (false === $repeater) {
1944
-                $this->_fields[] = $new_field;
1945
-            } else {
1946
-                return $new_field;
1947
-            }
1948
-        }
1949
-
1950
-        /**
1951
-         *  Add repeater Field Block to meta box
1952
-         * @author Ohad Raz
1953
-         * @since 1.0
1954
-         * @access public
1955
-         * @param $id string  field id, i.e. the meta key
1956
-         * @param $args mixed|array
1957
-         *    'name' => // field name/label string optional
1958
-         *    'desc' => // field description, string optional
1959
-         *    'std' => // default value, string optional
1960
-         *    'style' =>    // custom style for field, string optional
1961
-         *    'validate_func' => // validate function, string optional
1962
-         *    'fields' => //fields to repeater
1963
-         */
1964
-        public function addRepeaterBlock($id, $args)
1965
-        {
1966
-            $new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1967
-            $new_field = array_merge($new_field, $args);
1968
-            $this->_fields[] = $new_field;
1969
-        }
1970
-
1971
-
1972
-        /**
1973
-         * Finish Declaration of Meta Box
1974
-         * @author Ohad Raz
1975
-         * @since 1.0
1976
-         * @access public
1977
-         */
1978
-        public function Finish()
1979
-        {
1980
-            $this->add_missed_values();
1981
-            $this->check_field_upload();
1982
-            $this->check_field_color();
1983
-            $this->check_field_date();
1984
-            $this->check_field_time();
1985
-        }
1986
-
1987
-        /**
1988
-         * Helper function to check for empty arrays
1989
-         * @author Ohad Raz
1990
-         * @since 1.0
1991
-         * @access public
1992
-         * @param $args mixed|array
1993
-         */
1994
-        public function is_array_empty($array)
1995
-        {
1996
-            if (!is_array($array))
1997
-                return true;
1998
-
1999
-            foreach ($array as $a) {
2000
-                if (is_array($a)) {
2001
-                    foreach ($a as $sub_a) {
2002
-                        if (!empty($sub_a) && $sub_a != '')
2003
-                            return false;
2004
-                    }
2005
-                } else {
2006
-                    if (!empty($a) && $a != '')
2007
-                        return false;
2008
-                }
2009
-            }
2010
-            return true;
2011
-        }
2012
-
2013
-
2014
-        //get term meta field
2015
-        public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2016
-        {
2017
-
2018
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2019
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2020
-                $post_type = $taxObject->object_type[0];
2021
-            }
2022
-
2023
-            if($post_type=='post'){$post_type='';}
2024
-            if($post_type){$post_type = $post_type.'_';}
2025
-
2026
-            $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2027
-
2028
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2029
-            if (isset($m[$key])) {
2030
-                return $m[$key];
2031
-            } else {
2032
-                return '';
2033
-            }
2034
-        }
2035
-
2036
-        //delete meta
2037
-        public function delete_tax_meta($term_id, $key, $post_type = '')
2038
-        {
2039
-
2040
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2041
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2042
-                $post_type = $taxObject->object_type[0];
2043
-            }
2044
-
2045
-            if($post_type=='post'){$post_type='';}
2046
-            if($post_type){$post_type = $post_type.'_';}
2047
-
2048
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2049
-
2050
-            if (isset($m[$key])) {
2051
-                unset($m[$key]);
2052
-            }
2053
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2054
-        }
2055
-
2056
-        //update meta
2057
-        public function update_tax_meta($term_id, $key, $value, $post_type = '')
2058
-        {
2059
-
2060
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2061
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2062
-                $post_type = $taxObject->object_type[0];
2063
-            }
2064
-
2065
-            if($post_type=='post'){$post_type='';}
2066
-            if($post_type){$post_type = $post_type.'_';}
2067
-
2068
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2069
-
2070
-            $m[$key] = $value;
2071
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2072
-
2073
-            /**
2074
-             * Called after the tax meta is updated.
2075
-             *
2076
-             * Used to update things after a GD category is saved.
2077
-             *
2078
-             * @since 1.0.0
2079
-             * @param bool $false False.
2080
-             * @param bool $true True.
2081
-             * @param int $term_id The term id being updated.
2082
-             * @param string $post_type The post type of the cat being updated.
2083
-             */
2084
-            do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2085
-        }
2086
-
2087
-
2088
-    } // End Class
1289
+		public function save_field_wysiwyg($term_id, $field, $old, $new)
1290
+		{
1291
+			$this->save_field($term_id, $field, $old, $new);
1292
+		}
1293
+
1294
+		/**
1295
+		 * Save repeater Fields.
1296
+		 *
1297
+		 * @param string $term_id The term ID.
1298
+		 * @param string $field
1299
+		 * @param string|mixed $old
1300
+		 * @param string|mixed $new
1301
+		 * @since 1.0
1302
+		 * @access public
1303
+		 */
1304
+		public function save_field_repeater($term_id, $field, $old, $new)
1305
+		{
1306
+			if (is_array($new) && count($new) > 0) {
1307
+				foreach ($new as $n) {
1308
+					foreach ($field['fields'] as $f) {
1309
+						$type = $f['type'];
1310
+						switch ($type) {
1311
+							case 'wysiwyg':
1312
+								$n[$f['id']] = wpautop($n[$f['id']]);
1313
+								break;
1314
+							case 'file':
1315
+								$n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1316
+								break;
1317
+							default:
1318
+								break;
1319
+						}
1320
+					}
1321
+					if (!$this->is_array_empty($n))
1322
+						$temp[] = $n;
1323
+				}
1324
+				if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1325
+					$this->update_tax_meta($term_id, $field['id'], $temp);
1326
+				} else {
1327
+					//	remove old meta if exists
1328
+					delete_post_meta($term_id, $field['id']);
1329
+				}
1330
+			} else {
1331
+				//	remove old meta if exists
1332
+				delete_post_meta($term_id, $field['id']);
1333
+			}
1334
+		}
1335
+
1336
+		/**
1337
+		 * Save File Field.
1338
+		 *
1339
+		 * @param string $term_id The term ID.
1340
+		 * @param string $field
1341
+		 * @param string $old
1342
+		 * @param string $new
1343
+		 * @since 1.0
1344
+		 * @access public
1345
+		 */
1346
+		public function save_field_file($term_id, $field, $old, $new)
1347
+		{
1348
+
1349
+			$name = $field['id'];
1350
+			if (empty($_FILES[$name]))
1351
+				return;
1352
+			$this->fix_file_array($_FILES[$name]);
1353
+			foreach ($_FILES[$name] as $position => $fileitem) {
1354
+
1355
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1356
+				if (empty($file['file']))
1357
+					continue;
1358
+				$filename = $file['file'];
1359
+
1360
+				$attachment = array(
1361
+					'post_mime_type' => $file['type'],
1362
+					'guid' => $file['url'],
1363
+					'post_parent' => $term_id,
1364
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1365
+					'post_content' => ''
1366
+				);
1367
+
1368
+				$id = wp_insert_attachment($attachment, $filename, $term_id);
1369
+
1370
+				if (!is_wp_error($id)) {
1371
+
1372
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1373
+					add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1374
+
1375
+				} // End if
1376
+
1377
+			} // End foreach
1378
+
1379
+		}
1380
+
1381
+		/**
1382
+		 * Save repeater File Field.
1383
+		 * @param string $term_id The term ID.
1384
+		 * @param string $field
1385
+		 * @param string $old
1386
+		 * @param string $new
1387
+		 * @since 1.0
1388
+		 * @access public
1389
+		 * @return int|void
1390
+		 */
1391
+		public function save_field_file_repeater($term_id, $field, $old, $new)
1392
+		{
1393
+
1394
+			$name = $field['id'];
1395
+			if (empty($_FILES[$name]))
1396
+				return;
1397
+			$this->fix_file_array($_FILES[$name]);
1398
+			foreach ($_FILES[$name] as $position => $fileitem) {
1399
+
1400
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1401
+				if (empty($file['file']))
1402
+					continue;
1403
+				$filename = $file['file'];
1404
+
1405
+				$attachment = array(
1406
+					'post_mime_type' => $file['type'],
1407
+					'guid' => $file['url'],
1408
+					'post_parent' => $term_id,
1409
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1410
+					'post_content' => ''
1411
+				);
1412
+
1413
+				$id = wp_insert_attachment($attachment, $filename);
1414
+
1415
+				if (!is_wp_error($id)) {
1416
+
1417
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1418
+					return $id;    // return file's url in meta fields
1419
+				} // End if
1420
+			} // End foreach
1421
+		}
1422
+
1423
+		/**
1424
+		 * Add missed values for meta box.
1425
+		 *
1426
+		 * @since 1.0
1427
+		 * @access public
1428
+		 */
1429
+		public function add_missed_values()
1430
+		{
1431
+
1432
+			// Default values for meta box
1433
+			$this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1434
+
1435
+			if(is_array($this->_fields)) {
1436
+				// Default values for fields
1437
+				foreach ($this->_fields as &$field) {
1438
+					$multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1439
+					$std = $multiple ? array() : '';
1440
+					$format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1441
+					$field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1442
+				} // End foreach
1443
+			}
1444
+		}
1445
+
1446
+		/**
1447
+		 * Check if field with $type exists.
1448
+		 *
1449
+		 * @param string $type
1450
+		 * @since 1.0
1451
+		 * @access public
1452
+		 */
1453
+		public function has_field($type)
1454
+		{
1455
+			if(is_array($this->_fields)) {
1456
+				foreach ($this->_fields as $field) {
1457
+					if ($type == $field['type'])
1458
+						return true;
1459
+				}
1460
+			}
1461
+			return false;
1462
+		}
1463
+
1464
+		/**
1465
+		 * Check if current page is edit page.
1466
+		 *
1467
+		 * @since 1.0
1468
+		 * @access public
1469
+		 */
1470
+		public function is_edit_page()
1471
+		{
1472
+			global $pagenow;
1473
+			return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1474
+		}
1475
+
1476
+		/**
1477
+		 * Fixes the odd indexing of multiple file uploads.
1478
+		 *
1479
+		 * Goes from the format:
1480
+		 * $_FILES['field']['key']['index']
1481
+		 * to
1482
+		 * The More standard and appropriate:
1483
+		 * $_FILES['field']['index']['key']
1484
+		 *
1485
+		 * @param string $files
1486
+		 * @since 1.0
1487
+		 * @access public
1488
+		 */
1489
+		public function fix_file_array(&$files)
1490
+		{
1491
+
1492
+			$output = array();
1493
+
1494
+			foreach ($files as $key => $list) {
1495
+				foreach ($list as $index => $value) {
1496
+					$output[$index][$key] = $value;
1497
+				}
1498
+			}
1499
+
1500
+			return $files = $output;
1501
+
1502
+		}
1503
+
1504
+		/**
1505
+		 * Get proper JQuery UI version.
1506
+		 *
1507
+		 * Used in order to not conflict with WP Admin Scripts.
1508
+		 *
1509
+		 * @since 1.0
1510
+		 * @access public
1511
+		 */
1512
+		public function get_jqueryui_ver()
1513
+		{
1514
+
1515
+			global $wp_version;
1516
+
1517
+			if (version_compare($wp_version, '3.1', '>=')) {
1518
+				return '1.8.10';
1519
+			}
1520
+
1521
+			return '1.7.3';
1522
+
1523
+		}
1524
+
1525
+		/**
1526
+		 *  Add Field to meta box (generic function)
1527
+		 * @author Ohad Raz
1528
+		 * @since 1.0
1529
+		 * @access public
1530
+		 * @param $id string  field id, i.e. the meta key
1531
+		 * @param $args mixed|array
1532
+		 */
1533
+		public function addField($id, $args)
1534
+		{
1535
+			$new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1536
+			$new_field = array_merge($new_field, $args);
1537
+			$this->_fields[] = $new_field;
1538
+		}
1539
+
1540
+
1541
+		/**
1542
+		 *  Add Text Field to meta box
1543
+		 * @author Ohad Raz
1544
+		 * @since 1.0
1545
+		 * @access public
1546
+		 * @param $id string  field id, i.e. the meta key
1547
+		 * @param $args mixed|array
1548
+		 *    'name' => // field name/label string optional
1549
+		 *    'desc' => // field description, string optional
1550
+		 *    'std' => // default value, string optional
1551
+		 *    'style' =>    // custom style for field, string optional
1552
+		 *    'validate_func' => // validate function, string optional
1553
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1554
+		 */
1555
+		public function addText($id, $args, $repeater = false)
1556
+		{
1557
+			$new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1558
+			$new_field = array_merge($new_field, $args);
1559
+			if (false === $repeater) {
1560
+				$this->_fields[] = $new_field;
1561
+			} else {
1562
+				return $new_field;
1563
+			}
1564
+		}
1565
+
1566
+		/**
1567
+		 *  Add Hidden Field to meta box
1568
+		 * @author Ohad Raz
1569
+		 * @since 0.1.3
1570
+		 * @access public
1571
+		 * @param $id string  field id, i.e. the meta key
1572
+		 * @param $args mixed|array
1573
+		 *    'name' => // field name/label string optional
1574
+		 *    'desc' => // field description, string optional
1575
+		 *    'std' => // default value, string optional
1576
+		 *    'style' =>    // custom style for field, string optional
1577
+		 *    'validate_func' => // validate function, string optional
1578
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1579
+		 */
1580
+		public function addHidden($id, $args, $repeater = false)
1581
+		{
1582
+			$new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1583
+			$new_field = array_merge($new_field, $args);
1584
+			if (false === $repeater) {
1585
+				$this->_fields[] = $new_field;
1586
+			} else {
1587
+				return $new_field;
1588
+			}
1589
+		}
1590
+
1591
+		/**
1592
+		 *  Add Paragraph to meta box
1593
+		 * @author Ohad Raz
1594
+		 * @since 0.1.3
1595
+		 * @access public
1596
+		 * @param $id string  field id, i.e. the meta key
1597
+		 * @param $value  paragraph html
1598
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1599
+		 */
1600
+		public function addParagraph($id, $args, $repeater = false)
1601
+		{
1602
+			$new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1603
+			$new_field = array_merge($new_field, $args);
1604
+			if (false === $repeater) {
1605
+				$this->_fields[] = $new_field;
1606
+			} else {
1607
+				return $new_field;
1608
+			}
1609
+		}
1610
+
1611
+		/**
1612
+		 *  Add Checkbox Field to meta box
1613
+		 * @author Ohad Raz
1614
+		 * @since 1.0
1615
+		 * @access public
1616
+		 * @param $id string  field id, i.e. the meta key
1617
+		 * @param $args mixed|array
1618
+		 *    'name' => // field name/label string optional
1619
+		 *    'desc' => // field description, string optional
1620
+		 *    'std' => // default value, string optional
1621
+		 *    'validate_func' => // validate function, string optional
1622
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1623
+		 */
1624
+		public function addCheckbox($id, $args, $repeater = false)
1625
+		{
1626
+			$new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1627
+			$new_field = array_merge($new_field, $args);
1628
+			if (false === $repeater) {
1629
+				$this->_fields[] = $new_field;
1630
+			} else {
1631
+				return $new_field;
1632
+			}
1633
+		}
1634
+
1635
+		/**
1636
+		 *  Add CheckboxList Field to meta box
1637
+		 * @author Ohad Raz
1638
+		 * @since 1.0
1639
+		 * @access public
1640
+		 * @param $id string  field id, i.e. the meta key
1641
+		 * @param $options (array)  array of key => value pairs for select options
1642
+		 * @param $args mixed|array
1643
+		 *    'name' => // field name/label string optional
1644
+		 *    'desc' => // field description, string optional
1645
+		 *    'std' => // default value, string optional
1646
+		 *    'validate_func' => // validate function, string optional
1647
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1648
+		 *
1649
+		 * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1650
+		 *   which means the last param as false to get the values in an array
1651
+		 */
1652
+		public function addCheckboxList($id, $options, $args, $repeater = false)
1653
+		{
1654
+			$new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1655
+			$new_field = array_merge($new_field, $args);
1656
+			if (false === $repeater) {
1657
+				$this->_fields[] = $new_field;
1658
+			} else {
1659
+				return $new_field;
1660
+			}
1661
+		}
1662
+
1663
+		/**
1664
+		 *  Add Textarea Field to meta box
1665
+		 * @author Ohad Raz
1666
+		 * @since 1.0
1667
+		 * @access public
1668
+		 * @param $id string  field id, i.e. the meta key
1669
+		 * @param $args mixed|array
1670
+		 *    'name' => // field name/label string optional
1671
+		 *    'desc' => // field description, string optional
1672
+		 *    'std' => // default value, string optional
1673
+		 *    'style' =>    // custom style for field, string optional
1674
+		 *    'validate_func' => // validate function, string optional
1675
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1676
+		 */
1677
+		public function addTextarea($id, $args, $repeater = false)
1678
+		{
1679
+			$new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1680
+			$new_field = array_merge($new_field, $args);
1681
+			if (false === $repeater) {
1682
+				$this->_fields[] = $new_field;
1683
+			} else {
1684
+				return $new_field;
1685
+			}
1686
+		}
1687
+
1688
+		/**
1689
+		 *  Add Select Field to meta box
1690
+		 * @author Ohad Raz
1691
+		 * @since 1.0
1692
+		 * @access public
1693
+		 * @param $id string field id, i.e. the meta key
1694
+		 * @param $options (array)  array of key => value pairs for select options
1695
+		 * @param $args mixed|array
1696
+		 *    'name' => // field name/label string optional
1697
+		 *    'desc' => // field description, string optional
1698
+		 *    'std' => // default value, (array) optional
1699
+		 *    'multiple' => // select multiple values, optional. Default is false.
1700
+		 *    'validate_func' => // validate function, string optional
1701
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1702
+		 */
1703
+		public function addSelect($id, $options, $args, $repeater = false)
1704
+		{
1705
+			$new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1706
+			$new_field = array_merge($new_field, $args);
1707
+			if (false === $repeater) {
1708
+				$this->_fields[] = $new_field;
1709
+			} else {
1710
+				return $new_field;
1711
+			}
1712
+		}
1713
+
1714
+
1715
+		/**
1716
+		 *  Add Radio Field to meta box
1717
+		 * @author Ohad Raz
1718
+		 * @since 1.0
1719
+		 * @access public
1720
+		 * @param $id string field id, i.e. the meta key
1721
+		 * @param $options (array)  array of key => value pairs for radio options
1722
+		 * @param $args mixed|array
1723
+		 *    'name' => // field name/label string optional
1724
+		 *    'desc' => // field description, string optional
1725
+		 *    'std' => // default value, string optional
1726
+		 *    'validate_func' => // validate function, string optional
1727
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1728
+		 */
1729
+		public function addRadio($id, $options, $args, $repeater = false)
1730
+		{
1731
+			$new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1732
+			$new_field = array_merge($new_field, $args);
1733
+			if (false === $repeater) {
1734
+				$this->_fields[] = $new_field;
1735
+			} else {
1736
+				return $new_field;
1737
+			}
1738
+		}
1739
+
1740
+		/**
1741
+		 *  Add Date Field to meta box
1742
+		 * @author Ohad Raz
1743
+		 * @since 1.0
1744
+		 * @access public
1745
+		 * @param $id string  field id, i.e. the meta key
1746
+		 * @param $args mixed|array
1747
+		 *    'name' => // field name/label string optional
1748
+		 *    'desc' => // field description, string optional
1749
+		 *    'std' => // default value, string optional
1750
+		 *    'validate_func' => // validate function, string optional
1751
+		 *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1752
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1753
+		 */
1754
+		public function addDate($id, $args, $repeater = false)
1755
+		{
1756
+			$new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1757
+			$new_field = array_merge($new_field, $args);
1758
+			if (false === $repeater) {
1759
+				$this->_fields[] = $new_field;
1760
+			} else {
1761
+				return $new_field;
1762
+			}
1763
+		}
1764
+
1765
+		/**
1766
+		 *  Add Time Field to meta box
1767
+		 * @author Ohad Raz
1768
+		 * @since 1.0
1769
+		 * @access public
1770
+		 * @param $id string- field id, i.e. the meta key
1771
+		 * @param $args mixed|array
1772
+		 *    'name' => // field name/label string optional
1773
+		 *    'desc' => // field description, string optional
1774
+		 *    'std' => // default value, string optional
1775
+		 *    'validate_func' => // validate function, string optional
1776
+		 *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1777
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1778
+		 */
1779
+		public function addTime($id, $args, $repeater = false)
1780
+		{
1781
+			$new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1782
+			$new_field = array_merge($new_field, $args);
1783
+			if (false === $repeater) {
1784
+				$this->_fields[] = $new_field;
1785
+			} else {
1786
+				return $new_field;
1787
+			}
1788
+		}
1789
+
1790
+		/**
1791
+		 *  Add Color Field to meta box
1792
+		 * @author Ohad Raz
1793
+		 * @since 1.0
1794
+		 * @access public
1795
+		 * @param $id string  field id, i.e. the meta key
1796
+		 * @param $args mixed|array
1797
+		 *    'name' => // field name/label string optional
1798
+		 *    'desc' => // field description, string optional
1799
+		 *    'std' => // default value, string optional
1800
+		 *    'validate_func' => // validate function, string optional
1801
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1802
+		 */
1803
+		public function addColor($id, $args, $repeater = false)
1804
+		{
1805
+			$new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1806
+			$new_field = array_merge($new_field, $args);
1807
+			if (false === $repeater) {
1808
+				$this->_fields[] = $new_field;
1809
+			} else {
1810
+				return $new_field;
1811
+			}
1812
+		}
1813
+
1814
+		/**
1815
+		 *  Add Image Field to meta box
1816
+		 * @author Ohad Raz
1817
+		 * @since 1.0
1818
+		 * @access public
1819
+		 * @param $id string  field id, i.e. the meta key
1820
+		 * @param $args mixed|array
1821
+		 *    'name' => // field name/label string optional
1822
+		 *    'desc' => // field description, string optional
1823
+		 *    'validate_func' => // validate function, string optional
1824
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1825
+		 */
1826
+		public function addImage($id, $args, $repeater = false)
1827
+		{
1828
+			$new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1829
+			$new_field = array_merge($new_field, $args);
1830
+
1831
+			if (false === $repeater) {
1832
+				$this->_fields[] = $new_field;
1833
+			} else {
1834
+				return $new_field;
1835
+			}
1836
+		}
1837
+
1838
+		/**
1839
+		 *  Add File Field to meta box
1840
+		 * @author Ohad Raz
1841
+		 * @since 1.0
1842
+		 * @access public
1843
+		 * @param $id string  field id, i.e. the meta key
1844
+		 * @param $args mixed|array
1845
+		 *    'name' => // field name/label string optional
1846
+		 *    'desc' => // field description, string optional
1847
+		 *    'validate_func' => // validate function, string optional
1848
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1849
+		 */
1850
+		public function addFile($id, $args, $repeater = false)
1851
+		{
1852
+			$new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1853
+			$new_field = array_merge($new_field, $args);
1854
+			if (false === $repeater) {
1855
+				$this->_fields[] = $new_field;
1856
+			} else {
1857
+				return $new_field;
1858
+			}
1859
+		}
1860
+
1861
+		/**
1862
+		 *  Add WYSIWYG Field to meta box
1863
+		 * @author Ohad Raz
1864
+		 * @since 1.0
1865
+		 * @access public
1866
+		 * @param $id string  field id, i.e. the meta key
1867
+		 * @param $args mixed|array
1868
+		 *    'name' => // field name/label string optional
1869
+		 *    'desc' => // field description, string optional
1870
+		 *    'std' => // default value, string optional
1871
+		 *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1872
+		 *    'validate_func' => // validate function, string optional
1873
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1874
+		 */
1875
+		public function addWysiwyg($id, $args, $repeater = false)
1876
+		{
1877
+			$new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1878
+			$new_field = array_merge($new_field, $args);
1879
+			if (false === $repeater) {
1880
+				$this->_fields[] = $new_field;
1881
+			} else {
1882
+				return $new_field;
1883
+			}
1884
+		}
1885
+
1886
+		/**
1887
+		 *  Add Taxonomy Field to meta box
1888
+		 * @author Ohad Raz
1889
+		 * @since 1.0
1890
+		 * @access public
1891
+		 * @param $id string  field id, i.e. the meta key
1892
+		 * @param $options mixed|array options of taxonomy field
1893
+		 *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1894
+		 * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1895
+		 * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1896
+		 * @param $args mixed|array
1897
+		 *    'name' => // field name/label string optional
1898
+		 *    'desc' => // field description, string optional
1899
+		 *    'std' => // default value, string optional
1900
+		 *    'validate_func' => // validate function, string optional
1901
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1902
+		 */
1903
+		public function addTaxonomy($id, $options, $args, $repeater = false)
1904
+		{
1905
+			$q = array('hide_empty' => 0);
1906
+			$tax = 'category';
1907
+			$type = 'select';
1908
+			$temp = array($tax, $type, $q);
1909
+			$options = array_merge($temp, $options);
1910
+			$new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1911
+			$new_field = array_merge($new_field, $args);
1912
+			if (false === $repeater) {
1913
+				$this->_fields[] = $new_field;
1914
+			} else {
1915
+				return $new_field;
1916
+			}
1917
+		}
1918
+
1919
+		/**
1920
+		 *  Add posts Field to meta box
1921
+		 * @author Ohad Raz
1922
+		 * @since 1.0
1923
+		 * @access public
1924
+		 * @param $id string  field id, i.e. the meta key
1925
+		 * @param $options mixed|array options of taxonomy field
1926
+		 *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1927
+		 * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1928
+		 * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1929
+		 * @param $args mixed|array
1930
+		 *    'name' => // field name/label string optional
1931
+		 *    'desc' => // field description, string optional
1932
+		 *    'std' => // default value, string optional
1933
+		 *    'validate_func' => // validate function, string optional
1934
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1935
+		 */
1936
+		public function addPosts($id, $options, $args, $repeater = false)
1937
+		{
1938
+			$q = array('posts_per_page' => -1);
1939
+			$temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1940
+			$options = array_merge($temp, $options);
1941
+			$new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1942
+			$new_field = array_merge($new_field, $args);
1943
+			if (false === $repeater) {
1944
+				$this->_fields[] = $new_field;
1945
+			} else {
1946
+				return $new_field;
1947
+			}
1948
+		}
1949
+
1950
+		/**
1951
+		 *  Add repeater Field Block to meta box
1952
+		 * @author Ohad Raz
1953
+		 * @since 1.0
1954
+		 * @access public
1955
+		 * @param $id string  field id, i.e. the meta key
1956
+		 * @param $args mixed|array
1957
+		 *    'name' => // field name/label string optional
1958
+		 *    'desc' => // field description, string optional
1959
+		 *    'std' => // default value, string optional
1960
+		 *    'style' =>    // custom style for field, string optional
1961
+		 *    'validate_func' => // validate function, string optional
1962
+		 *    'fields' => //fields to repeater
1963
+		 */
1964
+		public function addRepeaterBlock($id, $args)
1965
+		{
1966
+			$new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1967
+			$new_field = array_merge($new_field, $args);
1968
+			$this->_fields[] = $new_field;
1969
+		}
1970
+
1971
+
1972
+		/**
1973
+		 * Finish Declaration of Meta Box
1974
+		 * @author Ohad Raz
1975
+		 * @since 1.0
1976
+		 * @access public
1977
+		 */
1978
+		public function Finish()
1979
+		{
1980
+			$this->add_missed_values();
1981
+			$this->check_field_upload();
1982
+			$this->check_field_color();
1983
+			$this->check_field_date();
1984
+			$this->check_field_time();
1985
+		}
1986
+
1987
+		/**
1988
+		 * Helper function to check for empty arrays
1989
+		 * @author Ohad Raz
1990
+		 * @since 1.0
1991
+		 * @access public
1992
+		 * @param $args mixed|array
1993
+		 */
1994
+		public function is_array_empty($array)
1995
+		{
1996
+			if (!is_array($array))
1997
+				return true;
1998
+
1999
+			foreach ($array as $a) {
2000
+				if (is_array($a)) {
2001
+					foreach ($a as $sub_a) {
2002
+						if (!empty($sub_a) && $sub_a != '')
2003
+							return false;
2004
+					}
2005
+				} else {
2006
+					if (!empty($a) && $a != '')
2007
+						return false;
2008
+				}
2009
+			}
2010
+			return true;
2011
+		}
2012
+
2013
+
2014
+		//get term meta field
2015
+		public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2016
+		{
2017
+
2018
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2019
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2020
+				$post_type = $taxObject->object_type[0];
2021
+			}
2022
+
2023
+			if($post_type=='post'){$post_type='';}
2024
+			if($post_type){$post_type = $post_type.'_';}
2025
+
2026
+			$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2027
+
2028
+			$m = get_option('tax_meta_' . $post_type  . $t_id);
2029
+			if (isset($m[$key])) {
2030
+				return $m[$key];
2031
+			} else {
2032
+				return '';
2033
+			}
2034
+		}
2035
+
2036
+		//delete meta
2037
+		public function delete_tax_meta($term_id, $key, $post_type = '')
2038
+		{
2039
+
2040
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2041
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2042
+				$post_type = $taxObject->object_type[0];
2043
+			}
2044
+
2045
+			if($post_type=='post'){$post_type='';}
2046
+			if($post_type){$post_type = $post_type.'_';}
2047
+
2048
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2049
+
2050
+			if (isset($m[$key])) {
2051
+				unset($m[$key]);
2052
+			}
2053
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2054
+		}
2055
+
2056
+		//update meta
2057
+		public function update_tax_meta($term_id, $key, $value, $post_type = '')
2058
+		{
2059
+
2060
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2061
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2062
+				$post_type = $taxObject->object_type[0];
2063
+			}
2064
+
2065
+			if($post_type=='post'){$post_type='';}
2066
+			if($post_type){$post_type = $post_type.'_';}
2067
+
2068
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2069
+
2070
+			$m[$key] = $value;
2071
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2072
+
2073
+			/**
2074
+			 * Called after the tax meta is updated.
2075
+			 *
2076
+			 * Used to update things after a GD category is saved.
2077
+			 *
2078
+			 * @since 1.0.0
2079
+			 * @param bool $false False.
2080
+			 * @param bool $true True.
2081
+			 * @param int $term_id The term id being updated.
2082
+			 * @param string $post_type The post type of the cat being updated.
2083
+			 */
2084
+			do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2085
+		}
2086
+
2087
+
2088
+	} // End Class
2089 2089
 
2090 2090
 endif; // End Check Class Exists
2091 2091
 
@@ -2095,67 +2095,67 @@  discard block
 block discarded – undo
2095 2095
 
2096 2096
 //get term meta field
2097 2097
 if (!function_exists('get_tax_meta')) {
2098
-    function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2099
-    {
2100
-
2101
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2102
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2103
-            $post_type = $taxObject->object_type[0];
2104
-        }
2105
-
2106
-        if($post_type=='post'){$post_type='';}
2107
-        if($post_type){$post_type = $post_type.'_';}
2108
-
2109
-        $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2110
-
2111
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2112
-        if (isset($m[$key])) {
2113
-            return $m[$key];
2114
-        } else {
2115
-            return '';
2116
-        }
2117
-    }
2098
+	function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2099
+	{
2100
+
2101
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2102
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2103
+			$post_type = $taxObject->object_type[0];
2104
+		}
2105
+
2106
+		if($post_type=='post'){$post_type='';}
2107
+		if($post_type){$post_type = $post_type.'_';}
2108
+
2109
+		$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2110
+
2111
+		$m = get_option('tax_meta_' . $post_type  . $t_id);
2112
+		if (isset($m[$key])) {
2113
+			return $m[$key];
2114
+		} else {
2115
+			return '';
2116
+		}
2117
+	}
2118 2118
 }
2119 2119
 
2120 2120
 //delete meta
2121 2121
 if (!function_exists('delete_tax_meta')) {
2122
-    function delete_tax_meta($term_id, $key)
2123
-    {
2122
+	function delete_tax_meta($term_id, $key)
2123
+	{
2124 2124
 
2125
-        $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2126
-        $post_type = $taxObject->object_type[0];
2125
+		$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2126
+		$post_type = $taxObject->object_type[0];
2127 2127
 
2128
-        if($post_type=='post'){$post_type='';}
2129
-        if($post_type){$post_type = $post_type.'_';}
2128
+		if($post_type=='post'){$post_type='';}
2129
+		if($post_type){$post_type = $post_type.'_';}
2130 2130
 
2131
-        $m = get_option('tax_meta_' . $post_type . $term_id);
2131
+		$m = get_option('tax_meta_' . $post_type . $term_id);
2132 2132
 
2133
-        if (isset($m[$key])) {
2134
-            unset($m[$key]);
2135
-        }
2136
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2137
-    }
2133
+		if (isset($m[$key])) {
2134
+			unset($m[$key]);
2135
+		}
2136
+		update_option('tax_meta_' . $post_type  . $term_id, $m);
2137
+	}
2138 2138
 }
2139 2139
 
2140 2140
 //update meta
2141 2141
 if (!function_exists('update_tax_meta')) {
2142
-    function update_tax_meta($term_id, $key, $value, $post_type = '')
2143
-    {
2142
+	function update_tax_meta($term_id, $key, $value, $post_type = '')
2143
+	{
2144 2144
 
2145
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2146
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2147
-            $post_type = $taxObject->object_type[0];
2148
-        }
2145
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2146
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2147
+			$post_type = $taxObject->object_type[0];
2148
+		}
2149 2149
 
2150
-        if($post_type=='post'){$post_type='';}
2151
-        if($post_type){$post_type = $post_type.'_';}
2150
+		if($post_type=='post'){$post_type='';}
2151
+		if($post_type){$post_type = $post_type.'_';}
2152 2152
 
2153
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2153
+		$m = get_option('tax_meta_' . $post_type  . $term_id);
2154 2154
 
2155
-        $m[$key] = $value;
2156
-        update_option('tax_meta_' . $post_type . $term_id, $m);
2155
+		$m[$key] = $value;
2156
+		update_option('tax_meta_' . $post_type . $term_id, $m);
2157 2157
 
2158
-        /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2159
-        do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2160
-    }
2158
+		/** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2159
+		do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2160
+	}
2161 2161
 }
2162 2162
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/post_functions.php 1 patch
Indentation   +2213 added lines, -2213 removed lines patch added patch discarded remove patch
@@ -20,468 +20,468 @@  discard block
 block discarded – undo
20 20
 function geodir_set_postcat_structure($post_id, $taxonomy, $default_cat = '', $category_str = '')
21 21
 {
22 22
 
23
-    $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
-
27
-    if (!isset($default_cat) || empty($default_cat)) {
28
-        $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
31
-            $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
34
-            }
35
-        }
23
+	$post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
+	if (!empty($post_cat_ids))
25
+		$post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+
27
+	if (!isset($default_cat) || empty($default_cat)) {
28
+		$default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
+	}else{
30
+		if(!is_int($default_cat)){
31
+			$category = get_term_by('name', $default_cat, $taxonomy);
32
+			if(isset($category->term_id)){
33
+				$default_cat =  $category->term_id;
34
+			}
35
+		}
36 36
 
37
-    }
37
+	}
38 38
 
39 39
 
40
-    geodir_save_post_meta($post_id, 'default_category', $default_cat);
40
+	geodir_save_post_meta($post_id, 'default_category', $default_cat);
41 41
 
42
-    if (isset($category_str) && empty($category_str)) {
42
+	if (isset($category_str) && empty($category_str)) {
43 43
 
44
-        $post_cat_str = '';
45
-        $post_categories = array();
46
-        if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
-            $post_cat_str = implode(",y:#", $post_cat_array);
48
-            $post_cat_str .= ",y:";
49
-            $post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
-        }
51
-        $post_categories[$taxonomy] = $post_cat_str;
52
-        $category_str = $post_categories;
53
-    }
44
+		$post_cat_str = '';
45
+		$post_categories = array();
46
+		if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
+			$post_cat_str = implode(",y:#", $post_cat_array);
48
+			$post_cat_str .= ",y:";
49
+			$post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
+		}
51
+		$post_categories[$taxonomy] = $post_cat_str;
52
+		$category_str = $post_categories;
53
+	}
54 54
 
55
-    $change_cat_str = $category_str[$taxonomy];
55
+	$change_cat_str = $category_str[$taxonomy];
56 56
 
57
-    $default_pos = strpos($change_cat_str, 'd:');
57
+	$default_pos = strpos($change_cat_str, 'd:');
58 58
 
59
-    if ($default_pos === false) {
59
+	if ($default_pos === false) {
60 60
 
61
-        $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
61
+		$change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
62 62
 
63
-    }
63
+	}
64 64
 
65
-    $category_str[$taxonomy] = $change_cat_str;
65
+	$category_str[$taxonomy] = $change_cat_str;
66 66
 
67
-    update_post_meta($post_id, 'post_categories', $category_str);
67
+	update_post_meta($post_id, 'post_categories', $category_str);
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (!function_exists('geodir_save_listing')) {
73
-    /**
74
-     * Saves listing in the database using given information.
75
-     *
76
-     * @since 1.0.0
77
-     * @since 1.5.4 New parameter $wp_error added.
78
-     * @package GeoDirectory
79
-     * @global object $wpdb WordPress Database object.
80
-     * @global object $post The current post object.
81
-     * @global object $current_user Current user object.
73
+	/**
74
+	 * Saves listing in the database using given information.
75
+	 *
76
+	 * @since 1.0.0
77
+	 * @since 1.5.4 New parameter $wp_error added.
78
+	 * @package GeoDirectory
79
+	 * @global object $wpdb WordPress Database object.
80
+	 * @global object $post The current post object.
81
+	 * @global object $current_user Current user object.
82 82
 	 * @global object $gd_session GeoDirectory Session object.
83
-     * @param array $request_info {
84
-     *    Array of request info arguments.
85
-     *
86
-     *    @type string $action                                  Ajax action name.
87
-     *    @type string $geodir_ajax                             Ajax type.
88
-     *    @type string $ajax_action                             Ajax action.
89
-     *    @type string $listing_type                            Listing type.
90
-     *    @type string $pid                                     Default Post ID.
91
-     *    @type string $preview                                 Todo Desc needed.
92
-     *    @type string $add_listing_page_id                     Add listing page ID.
93
-     *    @type string $post_title                              Listing title.
94
-     *    @type string $post_desc                               Listing Description.
95
-     *    @type string $post_tags                               Listing tags.
96
-     *    @type array  $cat_limit                               Category limit.
97
-     *    @type array  $post_category                           Category IDs.
98
-     *    @type array  $post_category_str                       Category string.
99
-     *    @type string $post_default_category                   Default category ID.
100
-     *    @type string $post_address                            Listing address.
101
-     *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
-     *    @type string $post_country                            Listing country.
103
-     *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
-     *    @type string $post_region                             Listing region.
105
-     *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
-     *    @type string $post_city                               Listing city.
107
-     *    @type string $post_zip                                Listing zip.
108
-     *    @type string $post_latitude                           Listing latitude.
109
-     *    @type string $post_longitude                          Listing longitude.
110
-     *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
-     *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
-     *    @type string $geodir_timing                           Business timing info.
113
-     *    @type string $geodir_contact                          Contact number.
114
-     *    @type string $geodir_email                            Business contact email.
115
-     *    @type string $geodir_website                          Business website.
116
-     *    @type string $geodir_twitter                          Twitter link.
117
-     *    @type string $geodir_facebook                         Facebook link.
118
-     *    @type string $geodir_video                            Video link.
119
-     *    @type string $geodir_special_offers                   Speacial offers.
120
-     *    @type string $post_images                             Post image urls.
121
-     *    @type string $post_imagesimage_limit                  Post images limit.
122
-     *    @type string $post_imagestotImg                       Todo Desc needed.
123
-     *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
-     *    @type string $geodir_spamblocker                      Todo Desc needed.
125
-     *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
-     *
127
-     * }
128
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
-     * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
-     * @return int|string|WP_Error Created post id or WP_Error on failure.
131
-     */
132
-    function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
-    {
134
-        global $wpdb, $current_user, $gd_session;
135
-
136
-        $last_post_id = '';
137
-
138
-        if ($gd_session->get('listing') && !$dummy) {
139
-            $request_info = array();
140
-            $request_session = $gd_session->get('listing');
141
-            $request_info = array_merge($_REQUEST, $request_session);
142
-        } else if (!$gd_session->get('listing') && !$dummy) {
143
-            global $post;
144
-            $request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
-            $request_info['post_title'] = $request_info['post_title'];
146
-            $request_info['listing_type'] = $post->post_type;
147
-            $request_info['post_desc'] = $request_info['content'];
148
-        } else if (!$dummy) {
149
-            return false;
150
-        }
151
-
152
-        /**
153
-         * Filter the request_info array.
154
-         *
155
-         * You can use this filter to modify request_info array.
156
-         *
157
-         * @since 1.0.0
158
-         * @package GeoDirectory
159
-         * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
-         */
161
-        $request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
-
163
-        // Check if we need to save post location as new location
164
-        $location_result = geodir_get_default_location();
165
-
166
-        if ($location_result->location_id > 0) {
167
-            if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
-                $request_info['post_location'] = array(
169
-                    'city' => $request_info['post_city'],
170
-                    'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
-                    'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
-                    'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
-                    'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
-                );
175
-
176
-                $post_location_info = $request_info['post_location'];
177
-
178
-                if ($location_id = geodir_add_new_location($post_location_info)) {
179
-                    $post_location_id = $location_id;
180
-                }
181
-            } else {
182
-                $post_location_id = $location_result->location_id;
183
-            }
184
-        } else {
185
-            $post_location_id = $location_result->location_id;
186
-        }
187
-
188
-        if ($dummy) {
189
-            $post_status = 'publish';
190
-        } else {
191
-            $post_status = geodir_new_post_default_status();
192
-        }
193
-
194
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
-            $post_status = get_post_status($request_info['pid']);
196
-        }
197
-
198
-        /* fix change of slug on every title edit */
199
-        if (!isset($request_info['post_name'])) {
200
-            $request_info['post_name'] = $request_info['post_title'];
201
-
202
-            if (!empty($request_info['pid'])) {
203
-                $post_info = get_post($request_info['pid']);
204
-
205
-                if (!empty($post_info) && isset($post_info->post_name)) {
206
-                    $request_info['post_name'] = $post_info->post_name;
207
-                }
208
-            }
209
-        }
210
-
211
-        $post = array(
212
-            'post_content' => $request_info['post_desc'],
213
-            'post_status' => $post_status,
214
-            'post_title' => $request_info['post_title'],
215
-            'post_name' => $request_info['post_name'],
216
-            'post_type' => $request_info['listing_type']
217
-        );
218
-
219
-        /**
220
-         * Called before a listing is saved to the database.
221
-         *
222
-         * @since 1.0.0
223
-         * @param object $post The post object.
224
-         */
225
-        do_action_ref_array('geodir_before_save_listing', $post);
83
+	 * @param array $request_info {
84
+	 *    Array of request info arguments.
85
+	 *
86
+	 *    @type string $action                                  Ajax action name.
87
+	 *    @type string $geodir_ajax                             Ajax type.
88
+	 *    @type string $ajax_action                             Ajax action.
89
+	 *    @type string $listing_type                            Listing type.
90
+	 *    @type string $pid                                     Default Post ID.
91
+	 *    @type string $preview                                 Todo Desc needed.
92
+	 *    @type string $add_listing_page_id                     Add listing page ID.
93
+	 *    @type string $post_title                              Listing title.
94
+	 *    @type string $post_desc                               Listing Description.
95
+	 *    @type string $post_tags                               Listing tags.
96
+	 *    @type array  $cat_limit                               Category limit.
97
+	 *    @type array  $post_category                           Category IDs.
98
+	 *    @type array  $post_category_str                       Category string.
99
+	 *    @type string $post_default_category                   Default category ID.
100
+	 *    @type string $post_address                            Listing address.
101
+	 *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
+	 *    @type string $post_country                            Listing country.
103
+	 *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
+	 *    @type string $post_region                             Listing region.
105
+	 *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
+	 *    @type string $post_city                               Listing city.
107
+	 *    @type string $post_zip                                Listing zip.
108
+	 *    @type string $post_latitude                           Listing latitude.
109
+	 *    @type string $post_longitude                          Listing longitude.
110
+	 *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
+	 *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
+	 *    @type string $geodir_timing                           Business timing info.
113
+	 *    @type string $geodir_contact                          Contact number.
114
+	 *    @type string $geodir_email                            Business contact email.
115
+	 *    @type string $geodir_website                          Business website.
116
+	 *    @type string $geodir_twitter                          Twitter link.
117
+	 *    @type string $geodir_facebook                         Facebook link.
118
+	 *    @type string $geodir_video                            Video link.
119
+	 *    @type string $geodir_special_offers                   Speacial offers.
120
+	 *    @type string $post_images                             Post image urls.
121
+	 *    @type string $post_imagesimage_limit                  Post images limit.
122
+	 *    @type string $post_imagestotImg                       Todo Desc needed.
123
+	 *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
+	 *    @type string $geodir_spamblocker                      Todo Desc needed.
125
+	 *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
+	 *
127
+	 * }
128
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
+	 * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
+	 * @return int|string|WP_Error Created post id or WP_Error on failure.
131
+	 */
132
+	function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
+	{
134
+		global $wpdb, $current_user, $gd_session;
135
+
136
+		$last_post_id = '';
137
+
138
+		if ($gd_session->get('listing') && !$dummy) {
139
+			$request_info = array();
140
+			$request_session = $gd_session->get('listing');
141
+			$request_info = array_merge($_REQUEST, $request_session);
142
+		} else if (!$gd_session->get('listing') && !$dummy) {
143
+			global $post;
144
+			$request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
+			$request_info['post_title'] = $request_info['post_title'];
146
+			$request_info['listing_type'] = $post->post_type;
147
+			$request_info['post_desc'] = $request_info['content'];
148
+		} else if (!$dummy) {
149
+			return false;
150
+		}
151
+
152
+		/**
153
+		 * Filter the request_info array.
154
+		 *
155
+		 * You can use this filter to modify request_info array.
156
+		 *
157
+		 * @since 1.0.0
158
+		 * @package GeoDirectory
159
+		 * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
+		 */
161
+		$request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
+
163
+		// Check if we need to save post location as new location
164
+		$location_result = geodir_get_default_location();
165
+
166
+		if ($location_result->location_id > 0) {
167
+			if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
+				$request_info['post_location'] = array(
169
+					'city' => $request_info['post_city'],
170
+					'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
+					'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
+					'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
+					'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
+				);
175
+
176
+				$post_location_info = $request_info['post_location'];
177
+
178
+				if ($location_id = geodir_add_new_location($post_location_info)) {
179
+					$post_location_id = $location_id;
180
+				}
181
+			} else {
182
+				$post_location_id = $location_result->location_id;
183
+			}
184
+		} else {
185
+			$post_location_id = $location_result->location_id;
186
+		}
226 187
 
227
-        $send_post_submit_mail = false;
188
+		if ($dummy) {
189
+			$post_status = 'publish';
190
+		} else {
191
+			$post_status = geodir_new_post_default_status();
192
+		}
228 193
 
229
-        // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
194
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
+			$post_status = get_post_status($request_info['pid']);
196
+		}
231 197
 
232
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
-            $post['ID'] = $request_info['pid'];
198
+		/* fix change of slug on every title edit */
199
+		if (!isset($request_info['post_name'])) {
200
+			$request_info['post_name'] = $request_info['post_title'];
234 201
 
235
-            $last_post_id = wp_update_post($post, $wp_error);
236
-        } else {
237
-            $last_post_id = wp_insert_post($post, $wp_error);
202
+			if (!empty($request_info['pid'])) {
203
+				$post_info = get_post($request_info['pid']);
238 204
 
239
-            if (!$dummy && $last_post_id) {
240
-                $send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
-                //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
-            }
243
-        }
205
+				if (!empty($post_info) && isset($post_info->post_name)) {
206
+					$request_info['post_name'] = $post_info->post_name;
207
+				}
208
+			}
209
+		}
210
+
211
+		$post = array(
212
+			'post_content' => $request_info['post_desc'],
213
+			'post_status' => $post_status,
214
+			'post_title' => $request_info['post_title'],
215
+			'post_name' => $request_info['post_name'],
216
+			'post_type' => $request_info['listing_type']
217
+		);
218
+
219
+		/**
220
+		 * Called before a listing is saved to the database.
221
+		 *
222
+		 * @since 1.0.0
223
+		 * @param object $post The post object.
224
+		 */
225
+		do_action_ref_array('geodir_before_save_listing', $post);
226
+
227
+		$send_post_submit_mail = false;
228
+
229
+		// unhook this function so it doesn't loop infinitely
230
+		remove_action('save_post', 'geodir_post_information_save',10,2);
231
+
232
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
+			$post['ID'] = $request_info['pid'];
234
+
235
+			$last_post_id = wp_update_post($post, $wp_error);
236
+		} else {
237
+			$last_post_id = wp_insert_post($post, $wp_error);
238
+
239
+			if (!$dummy && $last_post_id) {
240
+				$send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
+				//geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
+			}
243
+		}
244 244
 
245
-        if ($wp_error && is_wp_error($last_post_id)) {
246
-            return $last_post_id; // Return WP_Error on save failure.
247
-        }
245
+		if ($wp_error && is_wp_error($last_post_id)) {
246
+			return $last_post_id; // Return WP_Error on save failure.
247
+		}
248 248
 
249
-        if (!$last_post_id) {
250
-            return false; // Save failure.
251
-        }
249
+		if (!$last_post_id) {
250
+			return false; // Save failure.
251
+		}
252 252
 
253
-        // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
253
+		// re-hook this function
254
+		add_action('save_post', 'geodir_post_information_save',10,2);
255 255
 
256
-        $post_tags = '';
257
-        if (!isset($request_info['post_tags'])) {
256
+		$post_tags = '';
257
+		if (!isset($request_info['post_tags'])) {
258 258
 
259
-            $post_type = $request_info['listing_type'];
260
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
259
+			$post_type = $request_info['listing_type'];
260
+			$post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
261 261
 
262
-        }
262
+		}
263 263
 
264
-        $gd_post_info = array(
265
-            "post_title" => $request_info['post_title'],
266
-            "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
-            "post_status" => $post_status,
268
-            "post_location_id" => $post_location_id,
269
-            "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
-            "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
-            "submit_time" => time(),
272
-            "submit_ip" => $_SERVER['REMOTE_ADDR'],
273
-        );
264
+		$gd_post_info = array(
265
+			"post_title" => $request_info['post_title'],
266
+			"post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
+			"post_status" => $post_status,
268
+			"post_location_id" => $post_location_id,
269
+			"claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
+			"businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
+			"submit_time" => time(),
272
+			"submit_ip" => $_SERVER['REMOTE_ADDR'],
273
+		);
274 274
 
275
-        $payment_info = array();
276
-        $package_info = array();
275
+		$payment_info = array();
276
+		$package_info = array();
277 277
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
278
+		$package_info = (array)geodir_post_package_info($package_info, $post);
279 279
 
280
-        $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
280
+		$post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
282
-        if (!empty($package_info) && !$post_package_id) {
283
-            if (isset($package_info['days']) && $package_info['days'] != 0) {
284
-                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
-            } else {
286
-                $payment_info['expire_date'] = 'Never';
287
-            }
282
+		if (!empty($package_info) && !$post_package_id) {
283
+			if (isset($package_info['days']) && $package_info['days'] != 0) {
284
+				$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
+			} else {
286
+				$payment_info['expire_date'] = 'Never';
287
+			}
288 288
 
289
-            $payment_info['package_id'] = $package_info['pid'];
290
-            $payment_info['alive_days'] = $package_info['days'];
291
-            $payment_info['is_featured'] = $package_info['is_featured'];
289
+			$payment_info['package_id'] = $package_info['pid'];
290
+			$payment_info['alive_days'] = $package_info['days'];
291
+			$payment_info['is_featured'] = $package_info['is_featured'];
292 292
 
293
-            $gd_post_info = array_merge($gd_post_info, $payment_info);
294
-        }
293
+			$gd_post_info = array_merge($gd_post_info, $payment_info);
294
+		}
295 295
 
296
-        $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
296
+		$custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
297 297
 
298
-        foreach ($custom_metaboxes as $key => $val):
298
+		foreach ($custom_metaboxes as $key => $val):
299 299
 
300
-            $name = $val['name'];
301
-            $type = $val['type'];
302
-            $extrafields = $val['extra_fields'];
300
+			$name = $val['name'];
301
+			$type = $val['type'];
302
+			$extrafields = $val['extra_fields'];
303 303
 
304
-            if (trim($type) == 'address') {
305
-                $prefix = $name . '_';
306
-                $address = $prefix . 'address';
304
+			if (trim($type) == 'address') {
305
+				$prefix = $name . '_';
306
+				$address = $prefix . 'address';
307 307
 
308
-                if (isset($request_info[$address]) && $request_info[$address] != '') {
309
-                    $gd_post_info[$address] = wp_slash($request_info[$address]);
310
-                }
308
+				if (isset($request_info[$address]) && $request_info[$address] != '') {
309
+					$gd_post_info[$address] = wp_slash($request_info[$address]);
310
+				}
311 311
 
312
-                if ($extrafields != '') {
313
-                    $extrafields = unserialize($extrafields);
312
+				if ($extrafields != '') {
313
+					$extrafields = unserialize($extrafields);
314 314
 
315 315
 
316
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
316
+					if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
317 317
 
318
-                        $location_result = geodir_get_default_location();
318
+						$location_result = geodir_get_default_location();
319 319
 
320
-                        $gd_post_info[$prefix . 'city'] = $location_result->city;
321
-                        $gd_post_info[$prefix . 'region'] = $location_result->region;
322
-                        $gd_post_info[$prefix . 'country'] = $location_result->country;
320
+						$gd_post_info[$prefix . 'city'] = $location_result->city;
321
+						$gd_post_info[$prefix . 'region'] = $location_result->region;
322
+						$gd_post_info[$prefix . 'country'] = $location_result->country;
323 323
 
324
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
324
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
325 325
 
326
-                    } else {
326
+					} else {
327 327
 
328
-                        $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
-                        $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
-                        $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
328
+						$gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
+						$gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
+						$gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
331 331
 
332
-                        //----------set post locations when import dummy data-------
333
-                        $location_result = geodir_get_default_location();
332
+						//----------set post locations when import dummy data-------
333
+						$location_result = geodir_get_default_location();
334 334
 
335
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
-                        //-----------------------------------------------------------------
335
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
+						//-----------------------------------------------------------------
337 337
 
338
-                    }
338
+					}
339 339
 
340 340
 
341
-                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
-                        $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
-                    }
341
+					if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
+						$gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
+					}
344 344
 
345 345
 
346
-                    if (isset($extrafields['show_map']) && $extrafields['show_map']) {
346
+					if (isset($extrafields['show_map']) && $extrafields['show_map']) {
347 347
 
348
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
-                        }
348
+						if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
+							$gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
+						}
351 351
 
352
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
-                        }
352
+						if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
+							$gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
+						}
355 355
 
356
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
-                        }
356
+						if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
+							$gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
+						}
359 359
 
360
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
-                        }
360
+						if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
+							$gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
+						}
363 363
 
364
-                    }
364
+					}
365 365
 
366
-                    // show lat lng
367
-                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
-                        $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
-                    }
370
-                }
366
+					// show lat lng
367
+					if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
+						$gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
+					}
370
+				}
371 371
 
372
-            } elseif (trim($type) == 'file') {
373
-                if (isset($request_info[$name])) {
374
-                    $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
372
+			} elseif (trim($type) == 'file') {
373
+				if (isset($request_info[$name])) {
374
+					$request_files = array();
375
+					if ($request_info[$name] != '')
376
+						$request_files = explode(",", $request_info[$name]);
377 377
 
378
-                    $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
-                    geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
378
+					$extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
+					geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
380 380
 
381
-                }
382
-            } elseif (trim($type) == 'datepicker') {
383
-                $datetime = '';
384
-                if (isset($request_info[$name]) && $request_info[$name] != '') {
385
-                    $date_format = geodir_default_date_format();
386
-                    if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
-                        $extra_fields = unserialize($val['extra_fields']);
388
-                        $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
-                    }
381
+				}
382
+			} elseif (trim($type) == 'datepicker') {
383
+				$datetime = '';
384
+				if (isset($request_info[$name]) && $request_info[$name] != '') {
385
+					$date_format = geodir_default_date_format();
386
+					if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
+						$extra_fields = unserialize($val['extra_fields']);
388
+						$date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
+					}
390 390
 
391
-                    $search = array('dd', 'mm', 'yy');
392
-                    $replace = array('d', 'm', 'Y');
391
+					$search = array('dd', 'mm', 'yy');
392
+					$replace = array('d', 'm', 'Y');
393 393
 
394
-                    $date_format = str_replace($search, $replace, $date_format);
394
+					$date_format = str_replace($search, $replace, $date_format);
395 395
 
396
-                    $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name]; // PHP doesn't work well with dd/mm/yyyy format
396
+					$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name]; // PHP doesn't work well with dd/mm/yyyy format
397 397
 
398
-                    $datetime = date("Y-m-d", strtotime($post_htmlvar_value));
399
-                }
400
-                $gd_post_info[$name] = $datetime;
401
-            } else if ($type == 'multiselect') {
402
-                if (isset($request_info[$name])) {
403
-                    $gd_post_info[$name] = $request_info[$name];
404
-                } else {
405
-                    if (isset($request_info['gd_field_' . $name])) {
406
-                        $gd_post_info[$name] = ''; /* fix de-select for multiselect */
407
-                    }
408
-                }
409
-            } else if (isset($request_info[$name])) {
410
-                $gd_post_info[$name] = $request_info[$name];
411
-            }
398
+					$datetime = date("Y-m-d", strtotime($post_htmlvar_value));
399
+				}
400
+				$gd_post_info[$name] = $datetime;
401
+			} else if ($type == 'multiselect') {
402
+				if (isset($request_info[$name])) {
403
+					$gd_post_info[$name] = $request_info[$name];
404
+				} else {
405
+					if (isset($request_info['gd_field_' . $name])) {
406
+						$gd_post_info[$name] = ''; /* fix de-select for multiselect */
407
+					}
408
+				}
409
+			} else if (isset($request_info[$name])) {
410
+				$gd_post_info[$name] = $request_info[$name];
411
+			}
412 412
 
413
-        endforeach;
413
+		endforeach;
414 414
 
415
-        if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
416
-            $gd_post_info['post_dummy'] = $request_info['post_dummy'];
417
-        }
415
+		if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
416
+			$gd_post_info['post_dummy'] = $request_info['post_dummy'];
417
+		}
418 418
 
419
-        // Save post detail info in detail table
420
-        if (!empty($gd_post_info)) {
421
-            geodir_save_post_info($last_post_id, $gd_post_info);
422
-        }
419
+		// Save post detail info in detail table
420
+		if (!empty($gd_post_info)) {
421
+			geodir_save_post_info($last_post_id, $gd_post_info);
422
+		}
423 423
 
424 424
 
425
-        // Set categories to the listing
426
-        if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
427
-            $post_category = array();
425
+		// Set categories to the listing
426
+		if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
427
+			$post_category = array();
428 428
 
429
-            foreach ($request_info['post_category'] as $taxonomy => $cat) {
429
+			foreach ($request_info['post_category'] as $taxonomy => $cat) {
430 430
 
431
-                if ($dummy)
432
-                    $post_category = $cat;
433
-                else {
431
+				if ($dummy)
432
+					$post_category = $cat;
433
+				else {
434 434
 
435
-                    if (!is_array($cat) && strstr($cat, ','))
436
-                        $cat = explode(',', $cat);
435
+					if (!is_array($cat) && strstr($cat, ','))
436
+						$cat = explode(',', $cat);
437 437
 
438
-                    if (!empty($cat) && is_array($cat))
439
-                        $post_category = array_map('intval', $cat);
440
-                }
438
+					if (!empty($cat) && is_array($cat))
439
+						$post_category = array_map('intval', $cat);
440
+				}
441 441
 
442
-                wp_set_object_terms($last_post_id, $post_category, $taxonomy);
443
-            }
442
+				wp_set_object_terms($last_post_id, $post_category, $taxonomy);
443
+			}
444
+
445
+			$post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
446
+
447
+			$post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
448
+			geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
444 449
 
445
-            $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
450
+		}
446 451
 
447
-            $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
448
-            geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
449
-
450
-        }
452
+		$post_tags = '';
453
+		// Set tags to the listing
454
+		if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455
+			$post_tags = explode(",", $request_info['post_tags']);
456
+		} elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
+			if ($dummy)
458
+				$post_tags = $request_info['post_tags'];
459
+		} else {
460
+			if ($dummy)
461
+				$post_tags = array($request_info['post_title']);
462
+		}
451 463
 
452
-        $post_tags = '';
453
-        // Set tags to the listing
454
-        if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455
-            $post_tags = explode(",", $request_info['post_tags']);
456
-        } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
-            if ($dummy)
458
-                $post_tags = $request_info['post_tags'];
459
-        } else {
460
-            if ($dummy)
461
-                $post_tags = array($request_info['post_title']);
462
-        }
464
+		if (is_array($post_tags)) {
465
+			$taxonomy = $request_info['listing_type'] . '_tags';
466
+			wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
467
+		}
463 468
 
464
-        if (is_array($post_tags)) {
465
-            $taxonomy = $request_info['listing_type'] . '_tags';
466
-            wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
467
-        }
468
-
469
-
470
-        // Insert attechment
471 469
 
472
-        if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
473
-            if (!$dummy) {
474
-                $tmpimgArr = trim($request_info['post_images'], ",");
475
-                $tmpimgArr = explode(",", $tmpimgArr);
476
-                geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
-            } else{
478
-                geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479
-            }
470
+		// Insert attechment
471
+
472
+		if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
473
+			if (!$dummy) {
474
+				$tmpimgArr = trim($request_info['post_images'], ",");
475
+				$tmpimgArr = explode(",", $tmpimgArr);
476
+				geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
+			} else{
478
+				geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479
+			}
480
+
480 481
 
482
+		} elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
481 483
 
482
-        } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
483
-
484
-            /* Delete Attachments
484
+			/* Delete Attachments
485 485
 			$postcurr_images = geodir_get_images($last_post_id);
486 486
 
487 487
 			$wpdb->query(
@@ -497,34 +497,34 @@  discard block
 block discarded – undo
497 497
 			geodir_save_post_info($last_post_id, $gd_post_featured_img);
498 498
 			*/
499 499
 
500
-        }
500
+		}
501 501
 
502
-        geodir_remove_temp_images();
503
-        geodir_set_wp_featured_image($last_post_id);
502
+		geodir_remove_temp_images();
503
+		geodir_set_wp_featured_image($last_post_id);
504 504
 
505
-        /**
506
-         * Called after a listing is saved to the database and before any email have been sent.
507
-         *
508
-         * @since 1.0.0
509
-         * @param int $last_post_id The saved post ID.
510
-         * @param array $request_info The post details in an array.
511
-         * @see 'geodir_after_save_listinginfo'
512
-         */
513
-        do_action('geodir_after_save_listing', $last_post_id, $request_info);
505
+		/**
506
+		 * Called after a listing is saved to the database and before any email have been sent.
507
+		 *
508
+		 * @since 1.0.0
509
+		 * @param int $last_post_id The saved post ID.
510
+		 * @param array $request_info The post details in an array.
511
+		 * @see 'geodir_after_save_listinginfo'
512
+		 */
513
+		do_action('geodir_after_save_listing', $last_post_id, $request_info);
514 514
 
515
-        //die;
515
+		//die;
516 516
 
517
-        if ($send_post_submit_mail) { // if new post send out email
518
-            $to_name = geodir_get_client_name($current_user->ID);
519
-            geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
520
-        }
521
-        /*
517
+		if ($send_post_submit_mail) { // if new post send out email
518
+			$to_name = geodir_get_client_name($current_user->ID);
519
+			geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
520
+		}
521
+		/*
522 522
          * Unset the session so we don't loop.
523 523
          */
524
-        $gd_session->un_set('listing');
525
-        return $last_post_id;
524
+		$gd_session->un_set('listing');
525
+		return $last_post_id;
526 526
 
527
-    }
527
+	}
528 528
 
529 529
 }
530 530
 
@@ -543,586 +543,586 @@  discard block
 block discarded – undo
543 543
 function geodir_get_post_info($post_id = '')
544 544
 {
545 545
 
546
-    global $wpdb, $plugin_prefix, $post, $post_info;
546
+	global $wpdb, $plugin_prefix, $post, $post_info;
547 547
 
548
-    if ($post_id == '' && !empty($post))
549
-        $post_id = $post->ID;
548
+	if ($post_id == '' && !empty($post))
549
+		$post_id = $post->ID;
550 550
 
551
-    $post_type = get_post_type($post_id);
551
+	$post_type = get_post_type($post_id);
552 552
 
553
-    $all_postypes = geodir_get_posttypes();
553
+	$all_postypes = geodir_get_posttypes();
554 554
 
555
-    if (!in_array($post_type, $all_postypes))
556
-        return false;
555
+	if (!in_array($post_type, $all_postypes))
556
+		return false;
557 557
 
558
-    $table = $plugin_prefix . $post_type . '_detail';
558
+	$table = $plugin_prefix . $post_type . '_detail';
559 559
 
560
-    /**
561
-     * Apply Filter to change Post info
562
-     *
563
-     * You can use this filter to change Post info.
564
-     *
565
-     * @since 1.0.0
566
-     * @package GeoDirectory
567
-     */
568
-    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
560
+	/**
561
+	 * Apply Filter to change Post info
562
+	 *
563
+	 * You can use this filter to change Post info.
564
+	 *
565
+	 * @since 1.0.0
566
+	 * @package GeoDirectory
567
+	 */
568
+	$query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
569 569
 			  WHERE p.ID = pd.post_id
570 570
 			  AND post_id = " . $post_id);
571 571
 
572
-    $post_detail = $wpdb->get_row($query);
572
+	$post_detail = $wpdb->get_row($query);
573 573
 
574
-    return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
574
+	return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
575 575
 
576 576
 }
577 577
 
578 578
 
579 579
 if (!function_exists('geodir_save_post_info')) {
580
-    /**
581
-     * Saves post detail info in detail table.
582
-     *
583
-     * @since 1.0.0
584
-     * @package GeoDirectory
585
-     * @global object $wpdb WordPress Database object.
586
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
587
-     * @param int $post_id The post ID.
588
-     * @param array $postinfo_array {
589
-     *    Post info that needs to be saved in detail table.
590
-     *
591
-     *    @type string $post_title              Listing title.
592
-     *    @type string $post_tags               Listing tags.
593
-     *    @type string $post_status             Listing post status.
594
-     *    @type string $post_location_id        Listing location ID.
595
-     *    @type string $claimed                 Todo Desc needed.
596
-     *    @type string $businesses              Todo Desc needed.
597
-     *    @type int    $submit_time             Submitted time in unix timestamp.
598
-     *    @type string $submit_ip               Submitted IP.
599
-     *    @type string $expire_date             Listing expiration date.
600
-     *    @type int    $package_id              Listing package ID.
601
-     *    @type int    $alive_days              Todo Desc needed.
602
-     *    @type int    $is_featured             Is this a featured listing?.
603
-     *    @type string $post_address            Listing address.
604
-     *    @type string $post_city               Listing city.
605
-     *    @type string $post_region             Listing region.
606
-     *    @type string $post_country            Listing country.
607
-     *    @type string $post_locations          Listing locations.
608
-     *    @type string $post_zip                Listing zip.
609
-     *    @type string $post_latitude           Listing latitude.
610
-     *    @type string $post_longitude          Listing longitude.
611
-     *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
612
-     *    @type string $post_mapzoom            Listing mapzoom Default "9".
613
-     *    @type string $geodir_timing           Business timing info.
614
-     *    @type string $geodir_contact          Contact number.
615
-     *    @type string $geodir_email            Business contact email.
616
-     *    @type string $geodir_website          Business website.
617
-     *    @type string $geodir_twitter          Twitter link.
618
-     *    @type string $geodir_facebook         Facebook link.
619
-     *    @type string $geodir_video            Video link.
620
-     *    @type string $geodir_special_offers   Speacial offers.
621
-     *
622
-     * }
623
-     * @return bool
624
-     */
625
-    function geodir_save_post_info($post_id, $postinfo_array = array())
626
-    {
627
-        global $wpdb, $plugin_prefix;
628
-
629
-        $post_type = get_post_type($post_id);
630
-
631
-        $table = $plugin_prefix . $post_type . '_detail';
632
-
633
-        /**
634
-         * Filter to change Post info
635
-         *
636
-         * You can use this filter to change Post info.
637
-         *
638
-         * @since 1.0.0
639
-         * @package GeoDirectory
640
-         * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
641
-         * @param int $post_id The post ID.
642
-         */
580
+	/**
581
+	 * Saves post detail info in detail table.
582
+	 *
583
+	 * @since 1.0.0
584
+	 * @package GeoDirectory
585
+	 * @global object $wpdb WordPress Database object.
586
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
587
+	 * @param int $post_id The post ID.
588
+	 * @param array $postinfo_array {
589
+	 *    Post info that needs to be saved in detail table.
590
+	 *
591
+	 *    @type string $post_title              Listing title.
592
+	 *    @type string $post_tags               Listing tags.
593
+	 *    @type string $post_status             Listing post status.
594
+	 *    @type string $post_location_id        Listing location ID.
595
+	 *    @type string $claimed                 Todo Desc needed.
596
+	 *    @type string $businesses              Todo Desc needed.
597
+	 *    @type int    $submit_time             Submitted time in unix timestamp.
598
+	 *    @type string $submit_ip               Submitted IP.
599
+	 *    @type string $expire_date             Listing expiration date.
600
+	 *    @type int    $package_id              Listing package ID.
601
+	 *    @type int    $alive_days              Todo Desc needed.
602
+	 *    @type int    $is_featured             Is this a featured listing?.
603
+	 *    @type string $post_address            Listing address.
604
+	 *    @type string $post_city               Listing city.
605
+	 *    @type string $post_region             Listing region.
606
+	 *    @type string $post_country            Listing country.
607
+	 *    @type string $post_locations          Listing locations.
608
+	 *    @type string $post_zip                Listing zip.
609
+	 *    @type string $post_latitude           Listing latitude.
610
+	 *    @type string $post_longitude          Listing longitude.
611
+	 *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
612
+	 *    @type string $post_mapzoom            Listing mapzoom Default "9".
613
+	 *    @type string $geodir_timing           Business timing info.
614
+	 *    @type string $geodir_contact          Contact number.
615
+	 *    @type string $geodir_email            Business contact email.
616
+	 *    @type string $geodir_website          Business website.
617
+	 *    @type string $geodir_twitter          Twitter link.
618
+	 *    @type string $geodir_facebook         Facebook link.
619
+	 *    @type string $geodir_video            Video link.
620
+	 *    @type string $geodir_special_offers   Speacial offers.
621
+	 *
622
+	 * }
623
+	 * @return bool
624
+	 */
625
+	function geodir_save_post_info($post_id, $postinfo_array = array())
626
+	{
627
+		global $wpdb, $plugin_prefix;
628
+
629
+		$post_type = get_post_type($post_id);
630
+
631
+		$table = $plugin_prefix . $post_type . '_detail';
632
+
633
+		/**
634
+		 * Filter to change Post info
635
+		 *
636
+		 * You can use this filter to change Post info.
637
+		 *
638
+		 * @since 1.0.0
639
+		 * @package GeoDirectory
640
+		 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
641
+		 * @param int $post_id The post ID.
642
+		 */
643
+
644
+		$postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
645
+
646
+		if (!empty($postmeta) && $post_id) {
647
+			$post_meta_set_query = '';
648
+
649
+			foreach ($postmeta as $mkey => $mval) {
650
+				if (geodir_column_exist($table, $mkey)) {
651
+					if (is_array($mval)) {
652
+						$mval = implode(",", $mval);
653
+					}
654
+
655
+					$post_meta_set_query .= $mkey . " = '" . $mval . "', ";
656
+				}
657
+			}
643 658
 
644
-        $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
659
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
645 660
 
646
-        if (!empty($postmeta) && $post_id) {
647
-            $post_meta_set_query = '';
661
+			$post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
648 662
 
649
-            foreach ($postmeta as $mkey => $mval) {
650
-                if (geodir_column_exist($table, $mkey)) {
651
-                    if (is_array($mval)) {
652
-                        $mval = implode(",", $mval);
653
-                    }
663
+			/**
664
+			 * Called before saving the listing info.
665
+			 *
666
+			 * @since 1.0.0
667
+			 * @package GeoDirectory
668
+			 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
669
+			 * @param int $post_id The post ID.
670
+			 */
671
+			do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
654 672
 
655
-                    $post_meta_set_query .= $mkey . " = '" . $mval . "', ";
656
-                }
657
-            }
673
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
658 674
 
659
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
675
+				$wpdb->query(
676
+					$wpdb->prepare(
677
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
678
+						array($post_id)
679
+					)
680
+				);
660 681
 
661
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
662 682
 
663
-            /**
664
-             * Called before saving the listing info.
665
-             *
666
-             * @since 1.0.0
667
-             * @package GeoDirectory
668
-             * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
669
-             * @param int $post_id The post ID.
670
-             */
671
-            do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
683
+			} else {
672 684
 
673
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
685
+				$wpdb->query(
686
+					$wpdb->prepare(
687
+						"INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
688
+						array($post_id)
689
+					)
690
+				);
674 691
 
675
-                $wpdb->query(
676
-                    $wpdb->prepare(
677
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
678
-                        array($post_id)
679
-                    )
680
-                );
692
+			}
681 693
 
694
+			/**
695
+			 * Called after saving the listing info.
696
+			 *
697
+			 * @since 1.0.0
698
+			 * @package GeoDirectory
699
+			 * @param array $postinfo_array Post info that needs to be saved in detail table.
700
+			 * @param int $post_id The post ID.
701
+			 * @see 'geodir_after_save_listing'
702
+			 */
703
+			do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
704
+
705
+			return true;
706
+		} else
707
+			return false;
682 708
 
683
-            } else {
709
+	}
710
+}
684 711
 
685
-                $wpdb->query(
686
-                    $wpdb->prepare(
687
-                        "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
688
-                        array($post_id)
689
-                    )
690
-                );
691 712
 
692
-            }
713
+if (!function_exists('geodir_save_post_meta')) {
714
+	/**
715
+	 * Save or update post custom fields.
716
+	 *
717
+	 * @since 1.0.0
718
+	 * @package GeoDirectory
719
+	 * @global object $wpdb WordPress Database object.
720
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
721
+	 * @param int $post_id The post ID.
722
+	 * @param string $postmeta Detail table column name.
723
+	 * @param string $meta_value Detail table column value.
724
+	 * @return void|bool
725
+	 */
726
+	function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727
+	{
728
+
729
+		global $wpdb, $plugin_prefix;
730
+
731
+		$post_type = get_post_type($post_id);
732
+
733
+		$table = $plugin_prefix . $post_type . '_detail';
734
+
735
+		if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
736
+
737
+			if (is_array($meta_value)) {
738
+				$meta_value = implode(",", $meta_value);
739
+			}
693 740
 
694
-            /**
695
-             * Called after saving the listing info.
696
-             *
697
-             * @since 1.0.0
698
-             * @package GeoDirectory
699
-             * @param array $postinfo_array Post info that needs to be saved in detail table.
700
-             * @param int $post_id The post ID.
701
-             * @see 'geodir_after_save_listing'
702
-             */
703
-            do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
741
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
704 742
 
705
-            return true;
706
-        } else
707
-            return false;
743
+				$wpdb->query(
744
+					$wpdb->prepare(
745
+						"UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
746
+						array($post_id)
747
+					)
748
+				);
708 749
 
709
-    }
710
-}
750
+			} else {
751
+
752
+				$wpdb->query(
753
+					$wpdb->prepare(
754
+						"INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
755
+						array($post_id)
756
+					)
757
+				);
758
+			}
711 759
 
712 760
 
713
-if (!function_exists('geodir_save_post_meta')) {
714
-    /**
715
-     * Save or update post custom fields.
716
-     *
717
-     * @since 1.0.0
718
-     * @package GeoDirectory
719
-     * @global object $wpdb WordPress Database object.
720
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
721
-     * @param int $post_id The post ID.
722
-     * @param string $postmeta Detail table column name.
723
-     * @param string $meta_value Detail table column value.
724
-     * @return void|bool
725
-     */
726
-    function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727
-    {
728
-
729
-        global $wpdb, $plugin_prefix;
730
-
731
-        $post_type = get_post_type($post_id);
732
-
733
-        $table = $plugin_prefix . $post_type . '_detail';
734
-
735
-        if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
736
-
737
-            if (is_array($meta_value)) {
738
-                $meta_value = implode(",", $meta_value);
739
-            }
740
-
741
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
742
-
743
-                $wpdb->query(
744
-                    $wpdb->prepare(
745
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
746
-                        array($post_id)
747
-                    )
748
-                );
749
-
750
-            } else {
751
-
752
-                $wpdb->query(
753
-                    $wpdb->prepare(
754
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
755
-                        array($post_id)
756
-                    )
757
-                );
758
-            }
759
-
760
-
761
-        } else
762
-            return false;
763
-    }
761
+		} else
762
+			return false;
763
+	}
764 764
 }
765 765
 
766 766
 if (!function_exists('geodir_delete_post_meta')) {
767
-    /**
768
-     * Delete post custom fields.
769
-     *
770
-     * @since 1.0.0
771
-     * @package GeoDirectory
772
-     * @global object $wpdb WordPress Database object.
773
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
774
-     * @param int $post_id The post ID.
775
-     * @param string $postmeta Detail table column name.
776
-     * @todo check if this is depreciated
777
-     * @todo Fix unknown variable mval
778
-     * @return bool
779
-     */
780
-    function geodir_delete_post_meta($post_id, $postmeta)
781
-    {
782
-
783
-        global $wpdb, $plugin_prefix;
784
-
785
-        $post_type = get_post_type($post_id);
786
-
787
-        $table = $plugin_prefix . $post_type . '_detail';
788
-
789
-        if (is_array($postmeta) && !empty($postmeta) && $post_id) {
790
-            $post_meta_set_query = '';
791
-
792
-            foreach ($postmeta as $mkey) {
793
-                if ($mval != '')
794
-                    $post_meta_set_query .= $mkey . " = '', ";
795
-            }
796
-
797
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
798
-
799
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
800
-
801
-                $wpdb->query(
802
-                    $wpdb->prepare(
803
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
804
-                        array($post_id)
805
-                    )
806
-                );
807
-
808
-                return true;
809
-            }
810
-
811
-        } elseif ($postmeta != '' && $post_id) {
812
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
813
-
814
-                $wpdb->query(
815
-                    $wpdb->prepare(
816
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
817
-                        array($post_id)
818
-                    )
819
-                );
820
-
821
-                return true;
822
-            }
823
-
824
-        } else
825
-            return false;
826
-    }
767
+	/**
768
+	 * Delete post custom fields.
769
+	 *
770
+	 * @since 1.0.0
771
+	 * @package GeoDirectory
772
+	 * @global object $wpdb WordPress Database object.
773
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
774
+	 * @param int $post_id The post ID.
775
+	 * @param string $postmeta Detail table column name.
776
+	 * @todo check if this is depreciated
777
+	 * @todo Fix unknown variable mval
778
+	 * @return bool
779
+	 */
780
+	function geodir_delete_post_meta($post_id, $postmeta)
781
+	{
782
+
783
+		global $wpdb, $plugin_prefix;
784
+
785
+		$post_type = get_post_type($post_id);
786
+
787
+		$table = $plugin_prefix . $post_type . '_detail';
788
+
789
+		if (is_array($postmeta) && !empty($postmeta) && $post_id) {
790
+			$post_meta_set_query = '';
791
+
792
+			foreach ($postmeta as $mkey) {
793
+				if ($mval != '')
794
+					$post_meta_set_query .= $mkey . " = '', ";
795
+			}
796
+
797
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
798
+
799
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
800
+
801
+				$wpdb->query(
802
+					$wpdb->prepare(
803
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
804
+						array($post_id)
805
+					)
806
+				);
807
+
808
+				return true;
809
+			}
810
+
811
+		} elseif ($postmeta != '' && $post_id) {
812
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
813
+
814
+				$wpdb->query(
815
+					$wpdb->prepare(
816
+						"UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
817
+						array($post_id)
818
+					)
819
+				);
820
+
821
+				return true;
822
+			}
823
+
824
+		} else
825
+			return false;
826
+	}
827 827
 }
828 828
 
829 829
 
830 830
 if (!function_exists('geodir_get_post_meta')) {
831
-    /**
832
-     * Get post custom meta.
833
-     *
834
-     * @since 1.0.0
835
-     * @package GeoDirectory
836
-     * @global object $wpdb WordPress Database object.
837
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
838
-     * @param int $post_id The post ID.
839
-     * @param string $meta_key The meta key to retrieve.
840
-     * @param bool $single Optional. Whether to return a single value. Default false.
841
-     * @todo single variable not yet implemented.
842
-     * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
843
-     */
844
-    function geodir_get_post_meta($post_id, $meta_key, $single = false)
845
-    {
846
-        if (!$post_id) {
847
-            return false;
848
-        }
849
-        global $wpdb, $plugin_prefix;
850
-
851
-        $all_postypes = geodir_get_posttypes();
852
-
853
-        $post_type = get_post_type($post_id);
854
-
855
-        if (!in_array($post_type, $all_postypes))
856
-            return false;
857
-
858
-        $table = $plugin_prefix . $post_type . '_detail';
859
-
860
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
861
-            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
831
+	/**
832
+	 * Get post custom meta.
833
+	 *
834
+	 * @since 1.0.0
835
+	 * @package GeoDirectory
836
+	 * @global object $wpdb WordPress Database object.
837
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
838
+	 * @param int $post_id The post ID.
839
+	 * @param string $meta_key The meta key to retrieve.
840
+	 * @param bool $single Optional. Whether to return a single value. Default false.
841
+	 * @todo single variable not yet implemented.
842
+	 * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
843
+	 */
844
+	function geodir_get_post_meta($post_id, $meta_key, $single = false)
845
+	{
846
+		if (!$post_id) {
847
+			return false;
848
+		}
849
+		global $wpdb, $plugin_prefix;
850
+
851
+		$all_postypes = geodir_get_posttypes();
852
+
853
+		$post_type = get_post_type($post_id);
854
+
855
+		if (!in_array($post_type, $all_postypes))
856
+			return false;
857
+
858
+		$table = $plugin_prefix . $post_type . '_detail';
859
+
860
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
861
+			$meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
862 862
             
863
-            if ($meta_value && $meta_value !== '') {
864
-                return maybe_serialize($meta_value);
865
-            } else
866
-                return $meta_value;
867
-        } else {
868
-            return false;
869
-        }
870
-    }
863
+			if ($meta_value && $meta_value !== '') {
864
+				return maybe_serialize($meta_value);
865
+			} else
866
+				return $meta_value;
867
+		} else {
868
+			return false;
869
+		}
870
+	}
871 871
 }
872 872
 
873 873
 
874 874
 if (!function_exists('geodir_save_post_images')) {
875
-    /**
876
-     * Save post attachments.
877
-     *
878
-     * @since 1.0.0
879
-     * @package GeoDirectory
880
-     * @global object $wpdb WordPress Database object.
881
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
882
-     * @global object $current_user Current user object.
883
-     * @param int $post_id The post ID.
884
-     * @param array $post_image Post image urls as an array.
885
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
886
-     */
887
-    function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
888
-    {
889
-
875
+	/**
876
+	 * Save post attachments.
877
+	 *
878
+	 * @since 1.0.0
879
+	 * @package GeoDirectory
880
+	 * @global object $wpdb WordPress Database object.
881
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
882
+	 * @global object $current_user Current user object.
883
+	 * @param int $post_id The post ID.
884
+	 * @param array $post_image Post image urls as an array.
885
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
886
+	 */
887
+	function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
888
+	{
890 889
 
891
-        global $wpdb, $plugin_prefix, $current_user;
892 890
 
893
-        $post_type = get_post_type($post_id);
891
+		global $wpdb, $plugin_prefix, $current_user;
894 892
 
895
-        $table = $plugin_prefix . $post_type . '_detail';
893
+		$post_type = get_post_type($post_id);
896 894
 
897
-        $post_images = geodir_get_images($post_id);
895
+		$table = $plugin_prefix . $post_type . '_detail';
898 896
 
899
-        $wpdb->query(
900
-            $wpdb->prepare(
901
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
902
-                array($post_id)
903
-            )
904
-        );
897
+		$post_images = geodir_get_images($post_id);
905 898
 
906
-        $invalid_files = $post_images;
907
-        $valid_file_ids = array();
908
-        $valid_files_condition = '';
909
-        $geodir_uploaddir = '';
899
+		$wpdb->query(
900
+			$wpdb->prepare(
901
+				"UPDATE " . $table . " SET featured_image = '' where post_id =%d",
902
+				array($post_id)
903
+			)
904
+		);
910 905
 
911
-        $remove_files = array();
906
+		$invalid_files = $post_images;
907
+		$valid_file_ids = array();
908
+		$valid_files_condition = '';
909
+		$geodir_uploaddir = '';
912 910
 
913
-        if (!empty($post_image)) {
911
+		$remove_files = array();
914 912
 
915
-            $uploads = wp_upload_dir();
916
-            $uploads_dir = $uploads['path'];
913
+		if (!empty($post_image)) {
917 914
 
918
-            $geodir_uploadpath = $uploads['path'];
919
-            $geodir_uploadurl = $uploads['url'];
920
-            $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
915
+			$uploads = wp_upload_dir();
916
+			$uploads_dir = $uploads['path'];
921 917
 
922
-            $invalid_files = array();
923
-            $postcurr_images = array();
918
+			$geodir_uploadpath = $uploads['path'];
919
+			$geodir_uploadurl = $uploads['url'];
920
+			$sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
924 921
 
925
-            for ($m = 0; $m < count($post_image); $m++) {
926
-                $menu_order = $m + 1;
922
+			$invalid_files = array();
923
+			$postcurr_images = array();
927 924
 
928
-                $file_path = '';
929
-                /* --------- start ------- */
925
+			for ($m = 0; $m < count($post_image); $m++) {
926
+				$menu_order = $m + 1;
930 927
 
931
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
928
+				$file_path = '';
929
+				/* --------- start ------- */
932 930
 
933
-                $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
931
+				$split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
934 932
 
933
+				$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
935 934
 
936
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
937 935
 
938
-                    /* --------- end ------- */
939
-                    $curr_img_url = $post_image[$m];
936
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
940 937
 
941
-                    $image_name_arr = explode('/', $curr_img_url);
938
+					/* --------- end ------- */
939
+					$curr_img_url = $post_image[$m];
942 940
 
943
-                    $count_image_name_arr = count($image_name_arr) - 2;
941
+					$image_name_arr = explode('/', $curr_img_url);
944 942
 
945
-                    $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
943
+					$count_image_name_arr = count($image_name_arr) - 2;
946 944
 
947
-                    $curr_img_dir = $image_name_arr[$count_image_name_arr];
945
+					$count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
948 946
 
949
-                    $filename = end($image_name_arr);
950
-                    if (strpos($filename, '?') !== false) {
951
-                        list($filename) = explode('?', $filename);
952
-                    }
947
+					$curr_img_dir = $image_name_arr[$count_image_name_arr];
953 948
 
954
-                    $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
955
-                    $curr_img_dir = str_replace($filename, "", $curr_img_dir);
949
+					$filename = end($image_name_arr);
950
+					if (strpos($filename, '?') !== false) {
951
+						list($filename) = explode('?', $filename);
952
+					}
956 953
 
957
-                    $img_name_arr = explode('.', $filename);
954
+					$curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
955
+					$curr_img_dir = str_replace($filename, "", $curr_img_dir);
958 956
 
959
-                    $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
960
-                    if (!empty($img_name_arr) && count($img_name_arr) > 2) {
961
-                        $new_img_name_arr = $img_name_arr;
962
-                        if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
963
-                            unset($new_img_name_arr[count($img_name_arr) - 1]);
964
-                            $file_title = implode('.', $new_img_name_arr);
965
-                        }
966
-                    }
967
-                    $file_title = sanitize_file_name($file_title);
968
-                    $file_name = sanitize_file_name($filename);
957
+					$img_name_arr = explode('.', $filename);
969 958
 
970
-                    $arr_file_type = wp_check_filetype($filename);
959
+					$file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
960
+					if (!empty($img_name_arr) && count($img_name_arr) > 2) {
961
+						$new_img_name_arr = $img_name_arr;
962
+						if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
963
+							unset($new_img_name_arr[count($img_name_arr) - 1]);
964
+							$file_title = implode('.', $new_img_name_arr);
965
+						}
966
+					}
967
+					$file_title = sanitize_file_name($file_title);
968
+					$file_name = sanitize_file_name($filename);
971 969
 
972
-                    $uploaded_file_type = $arr_file_type['type'];
970
+					$arr_file_type = wp_check_filetype($filename);
973 971
 
974
-                    // Set an array containing a list of acceptable formats
975
-                    $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
972
+					$uploaded_file_type = $arr_file_type['type'];
976 973
 
977
-                    // If the uploaded file is the right format
978
-                    if (in_array($uploaded_file_type, $allowed_file_types)) {
979
-                        if (!function_exists('wp_handle_upload')) {
980
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
981
-                        }
974
+					// Set an array containing a list of acceptable formats
975
+					$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
982 976
 
983
-                        if (!is_dir($geodir_uploadpath)) {
984
-                            mkdir($geodir_uploadpath);
985
-                        }
977
+					// If the uploaded file is the right format
978
+					if (in_array($uploaded_file_type, $allowed_file_types)) {
979
+						if (!function_exists('wp_handle_upload')) {
980
+							require_once(ABSPATH . 'wp-admin/includes/file.php');
981
+						}
986 982
 
987
-                        $external_img = false;
988
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
989
-                        } else {
990
-                            $external_img = true;
991
-                        }
983
+						if (!is_dir($geodir_uploadpath)) {
984
+							mkdir($geodir_uploadpath);
985
+						}
992 986
 
993
-                        if ($dummy || $external_img) {
994
-                            $uploaded_file = array();
995
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
987
+						$external_img = false;
988
+						if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
989
+						} else {
990
+							$external_img = true;
991
+						}
996 992
 
997
-                            if (isset($uploaded['error']) && empty($uploaded['error'])) {
998
-                                $new_name = basename($uploaded['file']);
999
-                                $uploaded_file = $uploaded;
1000
-                            }else{
1001
-                                print_r($uploaded);exit;
1002
-                            }
1003
-                            $external_img = false;
1004
-                        } else {
1005
-                            $new_name = $post_id . '_' . $file_name;
993
+						if ($dummy || $external_img) {
994
+							$uploaded_file = array();
995
+							$uploaded = (array)fetch_remote_file($curr_img_url);
1006 996
 
1007
-                            if ($curr_img_dir == $sub_dir) {
1008
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1009
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1010
-                            } else {
1011
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1012
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1013
-                            }
997
+							if (isset($uploaded['error']) && empty($uploaded['error'])) {
998
+								$new_name = basename($uploaded['file']);
999
+								$uploaded_file = $uploaded;
1000
+							}else{
1001
+								print_r($uploaded);exit;
1002
+							}
1003
+							$external_img = false;
1004
+						} else {
1005
+							$new_name = $post_id . '_' . $file_name;
1014 1006
 
1015
-                            $uploaded_file = '';
1007
+							if ($curr_img_dir == $sub_dir) {
1008
+								$img_path = $geodir_uploadpath . '/' . $filename;
1009
+								$img_url = $geodir_uploadurl . '/' . $filename;
1010
+							} else {
1011
+								$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1012
+								$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1013
+							}
1016 1014
 
1017
-                            if (file_exists($img_path)) {
1018
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1019
-                                $file_path = '';
1020
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1021
-                                $uploaded_file = true;
1022
-                                $file_path = $curr_img_dir . '/' . $filename;
1023
-                            }
1015
+							$uploaded_file = '';
1024 1016
 
1025
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
-                                unlink($img_path);
1027
-                        }
1017
+							if (file_exists($img_path)) {
1018
+								$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1019
+								$file_path = '';
1020
+							} else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1021
+								$uploaded_file = true;
1022
+								$file_path = $curr_img_dir . '/' . $filename;
1023
+							}
1028 1024
 
1029
-                        if (!empty($uploaded_file)) {
1030
-                            if (!isset($file_path) || !$file_path) {
1031
-                                $file_path = $sub_dir . '/' . $new_name;
1032
-                            }
1025
+							if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
+								unlink($img_path);
1027
+						}
1033 1028
 
1034
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1029
+						if (!empty($uploaded_file)) {
1030
+							if (!isset($file_path) || !$file_path) {
1031
+								$file_path = $sub_dir . '/' . $new_name;
1032
+							}
1035 1033
 
1036
-                            if ($menu_order == 1) {
1034
+							$postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1037 1035
 
1038
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1036
+							if ($menu_order == 1) {
1039 1037
 
1040
-                            }
1038
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1041 1039
 
1042
-                            // Set up options array to add this file as an attachment
1043
-                            $attachment = array();
1044
-                            $attachment['post_id'] = $post_id;
1045
-                            $attachment['title'] = $file_title;
1046
-                            $attachment['content'] = '';
1047
-                            $attachment['file'] = $file_path;
1048
-                            $attachment['mime_type'] = $uploaded_file_type;
1049
-                            $attachment['menu_order'] = $menu_order;
1050
-                            $attachment['is_featured'] = 0;
1040
+							}
1051 1041
 
1052
-                            $attachment_set = '';
1042
+							// Set up options array to add this file as an attachment
1043
+							$attachment = array();
1044
+							$attachment['post_id'] = $post_id;
1045
+							$attachment['title'] = $file_title;
1046
+							$attachment['content'] = '';
1047
+							$attachment['file'] = $file_path;
1048
+							$attachment['mime_type'] = $uploaded_file_type;
1049
+							$attachment['menu_order'] = $menu_order;
1050
+							$attachment['is_featured'] = 0;
1053 1051
 
1054
-                            foreach ($attachment as $key => $val) {
1055
-                                if ($val != '')
1056
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1057
-                            }
1052
+							$attachment_set = '';
1058 1053
 
1059
-                            $attachment_set = trim($attachment_set, ", ");
1054
+							foreach ($attachment as $key => $val) {
1055
+								if ($val != '')
1056
+									$attachment_set .= $key . " = '" . $val . "', ";
1057
+							}
1060 1058
 
1061
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1059
+							$attachment_set = trim($attachment_set, ", ");
1060
+
1061
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1062 1062
 
1063
-                            $valid_file_ids[] = $wpdb->insert_id;
1064
-                        }
1063
+							$valid_file_ids[] = $wpdb->insert_id;
1064
+						}
1065 1065
 
1066
-                    }
1066
+					}
1067 1067
 
1068 1068
 
1069
-                } else {
1070
-                    $valid_file_ids[] = $find_image;
1069
+				} else {
1070
+					$valid_file_ids[] = $find_image;
1071 1071
 
1072
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1072
+					$postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1073 1073
 
1074
-                    $wpdb->query(
1075
-                        $wpdb->prepare(
1076
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1077
-                            array($menu_order, $split_img_path[1], $post_id)
1078
-                        )
1079
-                    );
1074
+					$wpdb->query(
1075
+						$wpdb->prepare(
1076
+							"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1077
+							array($menu_order, $split_img_path[1], $post_id)
1078
+						)
1079
+					);
1080 1080
 
1081
-                    if ($menu_order == 1)
1082
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1081
+					if ($menu_order == 1)
1082
+						$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1083 1083
 
1084
-                }
1084
+				}
1085 1085
 
1086 1086
 
1087
-            }
1087
+			}
1088 1088
 
1089
-            if (!empty($valid_file_ids)) {
1089
+			if (!empty($valid_file_ids)) {
1090 1090
 
1091
-                $remove_files = $valid_file_ids;
1091
+				$remove_files = $valid_file_ids;
1092 1092
 
1093
-                $remove_files_length = count($remove_files);
1094
-                $remove_files_format = array_fill(0, $remove_files_length, '%d');
1095
-                $format = implode(',', $remove_files_format);
1096
-                $valid_files_condition = " ID NOT IN ($format) AND ";
1093
+				$remove_files_length = count($remove_files);
1094
+				$remove_files_format = array_fill(0, $remove_files_length, '%d');
1095
+				$format = implode(',', $remove_files_format);
1096
+				$valid_files_condition = " ID NOT IN ($format) AND ";
1097 1097
 
1098
-            }
1098
+			}
1099 1099
 
1100
-            //Get and remove all old images of post from database to set by new order
1100
+			//Get and remove all old images of post from database to set by new order
1101 1101
 
1102
-            if (!empty($post_images)) {
1102
+			if (!empty($post_images)) {
1103 1103
 
1104
-                foreach ($post_images as $img) {
1104
+				foreach ($post_images as $img) {
1105 1105
 
1106
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1106
+					if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1107 1107
 
1108
-                        $invalid_files[] = (object)array('src' => $img->src);
1108
+						$invalid_files[] = (object)array('src' => $img->src);
1109 1109
 
1110
-                    }
1110
+					}
1111 1111
 
1112
-                }
1112
+				}
1113 1113
 
1114
-            }
1114
+			}
1115 1115
 
1116
-            $invalid_files = (object)$invalid_files;
1117
-        }
1116
+			$invalid_files = (object)$invalid_files;
1117
+		}
1118 1118
 
1119
-        $remove_files[] = $post_id;
1119
+		$remove_files[] = $post_id;
1120 1120
 
1121
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1121
+		$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1122 1122
 
1123
-        if (!empty($invalid_files))
1124
-            geodir_remove_attachments($invalid_files);
1125
-    }
1123
+		if (!empty($invalid_files))
1124
+			geodir_remove_attachments($invalid_files);
1125
+	}
1126 1126
 
1127 1127
 }
1128 1128
 
@@ -1136,12 +1136,12 @@  discard block
 block discarded – undo
1136 1136
 function geodir_remove_temp_images()
1137 1137
 {
1138 1138
 
1139
-    global $current_user;
1139
+	global $current_user;
1140 1140
 
1141
-    $uploads = wp_upload_dir();
1142
-    $uploads_dir = $uploads['path'];
1141
+	$uploads = wp_upload_dir();
1142
+	$uploads_dir = $uploads['path'];
1143 1143
 
1144
-    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1144
+	/*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1145 1145
 
1146 1146
 			$dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;
1147 1147
 			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
 			rmdir($dirPath);
1159 1159
 	}	*/
1160 1160
 
1161
-    $dirname = $uploads_dir . '/temp_' . $current_user->ID;
1162
-    geodir_delete_directory($dirname);
1161
+	$dirname = $uploads_dir . '/temp_' . $current_user->ID;
1162
+	geodir_delete_directory($dirname);
1163 1163
 }
1164 1164
 
1165 1165
 
@@ -1173,116 +1173,116 @@  discard block
 block discarded – undo
1173 1173
  */
1174 1174
 function geodir_delete_directory($dirname)
1175 1175
 {
1176
-    $dir_handle = '';
1177
-    if (is_dir($dirname))
1178
-        $dir_handle = opendir($dirname);
1179
-    if (!$dir_handle)
1180
-        return false;
1181
-    while ($file = readdir($dir_handle)) {
1182
-        if ($file != "." && $file != "..") {
1183
-            if (!is_dir($dirname . "/" . $file))
1184
-                unlink($dirname . "/" . $file);
1185
-            else
1186
-                geodir_delete_directory($dirname . '/' . $file);
1187
-        }
1188
-    }
1189
-    closedir($dir_handle);
1190
-    rmdir($dirname);
1191
-    return true;
1176
+	$dir_handle = '';
1177
+	if (is_dir($dirname))
1178
+		$dir_handle = opendir($dirname);
1179
+	if (!$dir_handle)
1180
+		return false;
1181
+	while ($file = readdir($dir_handle)) {
1182
+		if ($file != "." && $file != "..") {
1183
+			if (!is_dir($dirname . "/" . $file))
1184
+				unlink($dirname . "/" . $file);
1185
+			else
1186
+				geodir_delete_directory($dirname . '/' . $file);
1187
+		}
1188
+	}
1189
+	closedir($dir_handle);
1190
+	rmdir($dirname);
1191
+	return true;
1192 1192
 
1193 1193
 }
1194 1194
 
1195 1195
 
1196 1196
 if (!function_exists('geodir_remove_attachments')) {
1197
-    /**
1198
-     * Remove post attachments.
1199
-     *
1200
-     * @since 1.0.0
1201
-     * @package GeoDirectory
1202
-     * @param array $postcurr_images Array of image objects.
1203
-     */
1204
-    function geodir_remove_attachments($postcurr_images = array())
1205
-    {
1206
-        // Unlink all past images of post
1207
-        if (!empty($postcurr_images)) {
1208
-
1209
-            $uploads = wp_upload_dir();
1210
-            $uploads_dir = $uploads['path'];
1211
-
1212
-            foreach ($postcurr_images as $postimg) {
1213
-                $image_name_arr = explode('/', $postimg->src);
1214
-                $filename = end($image_name_arr);
1215
-                if (file_exists($uploads_dir . '/' . $filename))
1216
-                    unlink($uploads_dir . '/' . $filename);
1217
-            }
1218
-
1219
-        } // endif
1220
-        // Unlink all past images of post end
1221
-    }
1197
+	/**
1198
+	 * Remove post attachments.
1199
+	 *
1200
+	 * @since 1.0.0
1201
+	 * @package GeoDirectory
1202
+	 * @param array $postcurr_images Array of image objects.
1203
+	 */
1204
+	function geodir_remove_attachments($postcurr_images = array())
1205
+	{
1206
+		// Unlink all past images of post
1207
+		if (!empty($postcurr_images)) {
1208
+
1209
+			$uploads = wp_upload_dir();
1210
+			$uploads_dir = $uploads['path'];
1211
+
1212
+			foreach ($postcurr_images as $postimg) {
1213
+				$image_name_arr = explode('/', $postimg->src);
1214
+				$filename = end($image_name_arr);
1215
+				if (file_exists($uploads_dir . '/' . $filename))
1216
+					unlink($uploads_dir . '/' . $filename);
1217
+			}
1218
+
1219
+		} // endif
1220
+		// Unlink all past images of post end
1221
+	}
1222 1222
 }
1223 1223
 
1224 1224
 if (!function_exists('geodir_get_featured_image')) {
1225
-    /**
1226
-     * Gets the post featured image.
1227
-     *
1228
-     * @since 1.0.0
1229
-     * @package GeoDirectory
1230
-     * @global object $wpdb WordPress Database object.
1231
-     * @global object $post The current post object.
1232
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1233
-     * @param int|string $post_id The post ID.
1234
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1235
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1236
-     * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1237
-     * @return bool|object Image details as an object.
1238
-     */
1239
-    function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1240
-    {
1241
-
1242
-        /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1225
+	/**
1226
+	 * Gets the post featured image.
1227
+	 *
1228
+	 * @since 1.0.0
1229
+	 * @package GeoDirectory
1230
+	 * @global object $wpdb WordPress Database object.
1231
+	 * @global object $post The current post object.
1232
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1233
+	 * @param int|string $post_id The post ID.
1234
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1235
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1236
+	 * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1237
+	 * @return bool|object Image details as an object.
1238
+	 */
1239
+	function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1240
+	{
1241
+
1242
+		/*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1243 1243
         $img_arr['path'] = '';
1244 1244
         $img_arr['width'] = '';
1245 1245
         $img_arr['height'] = '';
1246 1246
         $img_arr['title'] = '';
1247 1247
         return (object)$img_arr;*/
1248
-        global $wpdb, $plugin_prefix, $post;
1248
+		global $wpdb, $plugin_prefix, $post;
1249 1249
 
1250
-        if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1251
-            $post_type = $post->post_type;
1252
-        } else {
1253
-            $post_type = get_post_type($post_id);
1254
-        }
1250
+		if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1251
+			$post_type = $post->post_type;
1252
+		} else {
1253
+			$post_type = get_post_type($post_id);
1254
+		}
1255 1255
 
1256
-        if (!in_array($post_type, geodir_get_posttypes())) {
1257
-            return false;// if not a GD CPT return;
1258
-        }
1256
+		if (!in_array($post_type, geodir_get_posttypes())) {
1257
+			return false;// if not a GD CPT return;
1258
+		}
1259 1259
 
1260
-        $table = $plugin_prefix . $post_type . '_detail';
1260
+		$table = $plugin_prefix . $post_type . '_detail';
1261 1261
 
1262
-        if (!$file) {
1263
-            if (isset($post->featured_image)) {
1264
-                $file = $post->featured_image;
1265
-            } else {
1266
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1267
-            }
1268
-        }
1262
+		if (!$file) {
1263
+			if (isset($post->featured_image)) {
1264
+				$file = $post->featured_image;
1265
+			} else {
1266
+				$file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1267
+			}
1268
+		}
1269 1269
 
1270
-        if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1271
-            $img_arr = array();
1270
+		if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1271
+			$img_arr = array();
1272 1272
 
1273
-            $file_info = pathinfo($file);
1274
-            $sub_dir = '';
1275
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1276
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1273
+			$file_info = pathinfo($file);
1274
+			$sub_dir = '';
1275
+			if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1276
+				$sub_dir = stripslashes_deep($file_info['dirname']);
1277 1277
 
1278
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1279
-            $uploads_baseurl = $uploads['baseurl'];
1280
-            $uploads_path = $uploads['path'];
1278
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1279
+			$uploads_baseurl = $uploads['baseurl'];
1280
+			$uploads_path = $uploads['path'];
1281 1281
 
1282
-            $file_name = $file_info['basename'];
1282
+			$file_name = $file_info['basename'];
1283 1283
 
1284
-            $uploads_url = $uploads_baseurl . $sub_dir;
1285
-            /*
1284
+			$uploads_url = $uploads_baseurl . $sub_dir;
1285
+			/*
1286 1286
              * Allows the filter of image src for such things as CDN change.
1287 1287
              *
1288 1288
              * @since 1.5.7
@@ -1291,158 +1291,158 @@  discard block
 block discarded – undo
1291 1291
              * @param string $uploads_url The server upload directory url.
1292 1292
              * @param string $uploads_baseurl The uploads dir base url.
1293 1293
              */
1294
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1295
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1296
-            $width = 0;
1297
-            $height = 0;
1298
-            if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1299
-                $imagesize = getimagesize($img_arr['path']);
1300
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1301
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1302
-            }
1303
-            $img_arr['width'] = $width;
1304
-            $img_arr['height'] = $height;
1305
-            $img_arr['title'] = '';
1306
-        } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1307
-            foreach ($post_images as $image) {
1308
-                return $image;
1309
-            }
1310
-        } else if ($no_image) {
1311
-            $img_arr = array();
1312
-
1313
-            $default_img = '';
1314
-            if (isset($post->default_category) && $post->default_category) {
1315
-                $default_cat = $post->default_category;
1316
-            } else {
1317
-                $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1318
-            }
1319
-
1320
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1321
-                $default_img = $default_catimg['src'];
1322
-            elseif ($no_image) {
1323
-                $default_img = get_option('geodir_listing_no_img');
1324
-            }
1325
-
1326
-            if (!empty($default_img)) {
1327
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1328
-                $uploads_baseurl = $uploads['baseurl'];
1329
-                $uploads_path = $uploads['path'];
1330
-
1331
-                $img_arr = array();
1332
-
1333
-                $file_info = pathinfo($default_img);
1334
-
1335
-                $file_name = $file_info['basename'];
1336
-
1337
-                $img_arr['src'] = $default_img;
1338
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1339
-
1340
-                $width = 0;
1341
-                $height = 0;
1342
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1343
-                    $imagesize = getimagesize($img_arr['path']);
1344
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1345
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1346
-                }
1347
-                $img_arr['width'] = $width;
1348
-                $img_arr['height'] = $height;
1349
-
1350
-                $img_arr['title'] = ''; // add the title to the array
1351
-            }
1352
-        }
1353
-
1354
-        if (!empty($img_arr))
1355
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1356
-        else
1357
-            return false;
1358
-    }
1294
+			$img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1295
+			$img_arr['path'] = $uploads_path . '/' . $file_name;
1296
+			$width = 0;
1297
+			$height = 0;
1298
+			if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1299
+				$imagesize = getimagesize($img_arr['path']);
1300
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1301
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1302
+			}
1303
+			$img_arr['width'] = $width;
1304
+			$img_arr['height'] = $height;
1305
+			$img_arr['title'] = '';
1306
+		} elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1307
+			foreach ($post_images as $image) {
1308
+				return $image;
1309
+			}
1310
+		} else if ($no_image) {
1311
+			$img_arr = array();
1312
+
1313
+			$default_img = '';
1314
+			if (isset($post->default_category) && $post->default_category) {
1315
+				$default_cat = $post->default_category;
1316
+			} else {
1317
+				$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1318
+			}
1319
+
1320
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1321
+				$default_img = $default_catimg['src'];
1322
+			elseif ($no_image) {
1323
+				$default_img = get_option('geodir_listing_no_img');
1324
+			}
1325
+
1326
+			if (!empty($default_img)) {
1327
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1328
+				$uploads_baseurl = $uploads['baseurl'];
1329
+				$uploads_path = $uploads['path'];
1330
+
1331
+				$img_arr = array();
1332
+
1333
+				$file_info = pathinfo($default_img);
1334
+
1335
+				$file_name = $file_info['basename'];
1336
+
1337
+				$img_arr['src'] = $default_img;
1338
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1339
+
1340
+				$width = 0;
1341
+				$height = 0;
1342
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1343
+					$imagesize = getimagesize($img_arr['path']);
1344
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1345
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1346
+				}
1347
+				$img_arr['width'] = $width;
1348
+				$img_arr['height'] = $height;
1349
+
1350
+				$img_arr['title'] = ''; // add the title to the array
1351
+			}
1352
+		}
1353
+
1354
+		if (!empty($img_arr))
1355
+			return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1356
+		else
1357
+			return false;
1358
+	}
1359 1359
 }
1360 1360
 
1361 1361
 if (!function_exists('geodir_show_featured_image')) {
1362
-    /**
1363
-     * Gets the post featured image.
1364
-     *
1365
-     * @since 1.0.0
1366
-     * @package GeoDirectory
1367
-     * @param int|string $post_id The post ID.
1368
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1369
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1370
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1371
-     * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1372
-     * @return bool|string Returns image html.
1373
-     */
1374
-    function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1375
-    {
1376
-        $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1377
-
1378
-        $html = geodir_show_image($image, $size, $no_image, false);
1379
-
1380
-        if (!empty($html) && $echo) {
1381
-            echo $html;
1382
-        } elseif (!empty($html)) {
1383
-            return $html;
1384
-        } else
1385
-            return false;
1386
-    }
1362
+	/**
1363
+	 * Gets the post featured image.
1364
+	 *
1365
+	 * @since 1.0.0
1366
+	 * @package GeoDirectory
1367
+	 * @param int|string $post_id The post ID.
1368
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1369
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1370
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1371
+	 * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1372
+	 * @return bool|string Returns image html.
1373
+	 */
1374
+	function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1375
+	{
1376
+		$image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1377
+
1378
+		$html = geodir_show_image($image, $size, $no_image, false);
1379
+
1380
+		if (!empty($html) && $echo) {
1381
+			echo $html;
1382
+		} elseif (!empty($html)) {
1383
+			return $html;
1384
+		} else
1385
+			return false;
1386
+	}
1387 1387
 }
1388 1388
 
1389 1389
 if (!function_exists('geodir_get_images')) {
1390
-    /**
1391
-     * Gets the post images.
1392
-     *
1393
-     * @since 1.0.0
1394
-     * @package GeoDirectory
1395
-     * @global object $wpdb WordPress Database object.
1396
-     * @param int $post_id The post ID.
1397
-     * @param string $img_size Optional. Thumbnail size.
1398
-     * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1399
-     * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1400
-     * @param int|string $limit Optional. Number of images.
1401
-     * @return array|bool Returns images as an array. Each item is an object.
1402
-     */
1403
-    function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1404
-    {
1405
-        global $wpdb;
1406
-        if ($limit) {
1407
-            $limit_q = " LIMIT $limit ";
1408
-        } else {
1409
-            $limit_q = '';
1410
-        }
1411
-        $not_featured = '';
1412
-        $sub_dir = '';
1413
-        if (!$add_featured)
1414
-            $not_featured = " AND is_featured = 0 ";
1415
-
1416
-        $arrImages = $wpdb->get_results(
1417
-            $wpdb->prepare(
1418
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1419
-                array('%image%', $post_id)
1420
-            )
1421
-        );
1422
-
1423
-        $counter = 0;
1424
-        $return_arr = array();
1425
-
1426
-        if (!empty($arrImages)) {
1427
-            foreach ($arrImages as $attechment) {
1428
-
1429
-                $img_arr = array();
1430
-                $img_arr['id'] = $attechment->ID;
1431
-                $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1432
-
1433
-                $file_info = pathinfo($attechment->file);
1434
-
1435
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1436
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1437
-
1438
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1439
-                $uploads_baseurl = $uploads['baseurl'];
1440
-                $uploads_path = $uploads['path'];
1441
-
1442
-                $file_name = $file_info['basename'];
1443
-
1444
-                $uploads_url = $uploads_baseurl . $sub_dir;
1445
-                /*
1390
+	/**
1391
+	 * Gets the post images.
1392
+	 *
1393
+	 * @since 1.0.0
1394
+	 * @package GeoDirectory
1395
+	 * @global object $wpdb WordPress Database object.
1396
+	 * @param int $post_id The post ID.
1397
+	 * @param string $img_size Optional. Thumbnail size.
1398
+	 * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1399
+	 * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1400
+	 * @param int|string $limit Optional. Number of images.
1401
+	 * @return array|bool Returns images as an array. Each item is an object.
1402
+	 */
1403
+	function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1404
+	{
1405
+		global $wpdb;
1406
+		if ($limit) {
1407
+			$limit_q = " LIMIT $limit ";
1408
+		} else {
1409
+			$limit_q = '';
1410
+		}
1411
+		$not_featured = '';
1412
+		$sub_dir = '';
1413
+		if (!$add_featured)
1414
+			$not_featured = " AND is_featured = 0 ";
1415
+
1416
+		$arrImages = $wpdb->get_results(
1417
+			$wpdb->prepare(
1418
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1419
+				array('%image%', $post_id)
1420
+			)
1421
+		);
1422
+
1423
+		$counter = 0;
1424
+		$return_arr = array();
1425
+
1426
+		if (!empty($arrImages)) {
1427
+			foreach ($arrImages as $attechment) {
1428
+
1429
+				$img_arr = array();
1430
+				$img_arr['id'] = $attechment->ID;
1431
+				$img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1432
+
1433
+				$file_info = pathinfo($attechment->file);
1434
+
1435
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1436
+					$sub_dir = stripslashes_deep($file_info['dirname']);
1437
+
1438
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1439
+				$uploads_baseurl = $uploads['baseurl'];
1440
+				$uploads_path = $uploads['path'];
1441
+
1442
+				$file_name = $file_info['basename'];
1443
+
1444
+				$uploads_url = $uploads_baseurl . $sub_dir;
1445
+				/*
1446 1446
                 * Allows the filter of image src for such things as CDN change.
1447 1447
                 *
1448 1448
                 * @since 1.5.7
@@ -1451,523 +1451,523 @@  discard block
 block discarded – undo
1451 1451
                 * @param string $uploads_url The server upload directory url.
1452 1452
                 * @param string $uploads_baseurl The uploads dir base url.
1453 1453
                 */
1454
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1455
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1456
-                $width = 0;
1457
-                $height = 0;
1458
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1459
-                    $imagesize = getimagesize($img_arr['path']);
1460
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1461
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1462
-                }
1463
-                $img_arr['width'] = $width;
1464
-                $img_arr['height'] = $height;
1465
-
1466
-                $img_arr['file'] = $file_name; // add the title to the array
1467
-                $img_arr['title'] = $attechment->title; // add the title to the array
1468
-                $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1469
-                $img_arr['content'] = $attechment->content; // add the description to the array
1470
-                $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1471
-
1472
-                $return_arr[] = (object)$img_arr;
1473
-
1474
-                $counter++;
1475
-            }
1476
-            return (object)$return_arr;
1477
-        } else if ($no_images) {
1478
-            $default_img = '';
1479
-            $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1480
-            $post_type = get_post_type($post_id);
1481
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1482
-                $default_img = $default_catimg['src'];
1483
-            elseif ($no_images) {
1484
-                $default_img = get_option('geodir_listing_no_img');
1485
-            }
1486
-
1487
-            if (!empty($default_img)) {
1488
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1454
+				$img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1455
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1456
+				$width = 0;
1457
+				$height = 0;
1458
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1459
+					$imagesize = getimagesize($img_arr['path']);
1460
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1461
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1462
+				}
1463
+				$img_arr['width'] = $width;
1464
+				$img_arr['height'] = $height;
1465
+
1466
+				$img_arr['file'] = $file_name; // add the title to the array
1467
+				$img_arr['title'] = $attechment->title; // add the title to the array
1468
+				$img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1469
+				$img_arr['content'] = $attechment->content; // add the description to the array
1470
+				$img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1471
+
1472
+				$return_arr[] = (object)$img_arr;
1473
+
1474
+				$counter++;
1475
+			}
1476
+			return (object)$return_arr;
1477
+		} else if ($no_images) {
1478
+			$default_img = '';
1479
+			$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1480
+			$post_type = get_post_type($post_id);
1481
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1482
+				$default_img = $default_catimg['src'];
1483
+			elseif ($no_images) {
1484
+				$default_img = get_option('geodir_listing_no_img');
1485
+			}
1486
+
1487
+			if (!empty($default_img)) {
1488
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1489 1489
                 
1490
-                $image_path = $default_img;
1491
-                if (!path_is_absolute($image_path)) {
1492
-                    $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1493
-                }
1494
-
1495
-                $file_info = pathinfo($default_img);
1496
-                $file_name = $file_info['basename'];
1497
-
1498
-                $width = '';
1499
-                $height = '';
1500
-                if (is_file($image_path) && file_exists($image_path)) {
1501
-                    $imagesize = getimagesize($image_path);
1502
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1503
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1504
-                }
1490
+				$image_path = $default_img;
1491
+				if (!path_is_absolute($image_path)) {
1492
+					$image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1493
+				}
1494
+
1495
+				$file_info = pathinfo($default_img);
1496
+				$file_name = $file_info['basename'];
1497
+
1498
+				$width = '';
1499
+				$height = '';
1500
+				if (is_file($image_path) && file_exists($image_path)) {
1501
+					$imagesize = getimagesize($image_path);
1502
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1503
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1504
+				}
1505 1505
                 
1506
-                $img_arr = array();
1507
-                $img_arr['src'] = $default_img;
1508
-                $img_arr['path'] = $image_path;
1509
-                $img_arr['width'] = $width;
1510
-                $img_arr['height'] = $height;
1511
-                $img_arr['file'] = $file_name; // add the title to the array
1512
-                $img_arr['title'] = $file_info['filename']; // add the title to the array
1513
-                $img_arr['content'] = $file_info['filename']; // add the description to the array
1514
-
1515
-                $return_arr[] = (object)$img_arr;
1516
-
1517
-                return $return_arr;
1518
-            } else
1519
-                return false;
1520
-        }
1521
-    }
1506
+				$img_arr = array();
1507
+				$img_arr['src'] = $default_img;
1508
+				$img_arr['path'] = $image_path;
1509
+				$img_arr['width'] = $width;
1510
+				$img_arr['height'] = $height;
1511
+				$img_arr['file'] = $file_name; // add the title to the array
1512
+				$img_arr['title'] = $file_info['filename']; // add the title to the array
1513
+				$img_arr['content'] = $file_info['filename']; // add the description to the array
1514
+
1515
+				$return_arr[] = (object)$img_arr;
1516
+
1517
+				return $return_arr;
1518
+			} else
1519
+				return false;
1520
+		}
1521
+	}
1522 1522
 }
1523 1523
 
1524 1524
 if (!function_exists('geodir_show_image')) {
1525
-    /**
1526
-     * Show image using image details.
1527
-     *
1528
-     * @since 1.0.0
1529
-     * @package GeoDirectory
1530
-     * @param array|object $request Image info either as an array or object.
1531
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1532
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1533
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1534
-     * @return bool|string Returns image html.
1535
-     */
1536
-    function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1537
-    {
1538
-        $image = new stdClass();
1539
-
1540
-        $html = '';
1541
-        if (!empty($request)) {
1542
-            if (!is_object($request)){
1543
-                $request = (object)$request;
1544
-            }
1545
-
1546
-            if (isset($request->src) && !isset($request->path)) {
1547
-                $request->path = $request->src;
1548
-            }
1549
-
1550
-            /*
1525
+	/**
1526
+	 * Show image using image details.
1527
+	 *
1528
+	 * @since 1.0.0
1529
+	 * @package GeoDirectory
1530
+	 * @param array|object $request Image info either as an array or object.
1531
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1532
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1533
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1534
+	 * @return bool|string Returns image html.
1535
+	 */
1536
+	function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1537
+	{
1538
+		$image = new stdClass();
1539
+
1540
+		$html = '';
1541
+		if (!empty($request)) {
1542
+			if (!is_object($request)){
1543
+				$request = (object)$request;
1544
+			}
1545
+
1546
+			if (isset($request->src) && !isset($request->path)) {
1547
+				$request->path = $request->src;
1548
+			}
1549
+
1550
+			/*
1551 1551
              * getimagesize() works faster from path than url so we try and get path if we can.
1552 1552
              */
1553
-            $upload_dir = wp_upload_dir();
1554
-            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1555
-            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1556
-            if (strpos($img_no_http, $upload_no_http) !== false) {
1557
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1558
-            }
1553
+			$upload_dir = wp_upload_dir();
1554
+			$img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1555
+			$upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1556
+			if (strpos($img_no_http, $upload_no_http) !== false) {
1557
+				$request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1558
+			}
1559 1559
             
1560
-            $width = 0;
1561
-            $height = 0;
1562
-            if (is_file($request->path) && file_exists($request->path)) {
1563
-                $imagesize = getimagesize($request->path);
1564
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1565
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1566
-            }
1567
-
1568
-            $image->src = $request->src;
1569
-            $image->width = $width;
1570
-            $image->height = $height;
1571
-
1572
-            $max_size = (object)geodir_get_imagesize($size);
1573
-
1574
-            if (!is_wp_error($max_size)) {
1575
-                if ($image->width) {
1576
-                    if ($image->height >= $image->width) {
1577
-                        $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1578
-                    } else if ($image->width < ($max_size->h)) {
1579
-                        $width_per = round((($image->width / $max_size->w) * 100), 2);
1580
-                    } else
1581
-                        $width_per = 100;
1582
-                }
1583
-
1584
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1585
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1586
-                } else {
1587
-                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1588
-                        $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1589
-                    }else{
1590
-                        //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1591
-                        //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1592
-                        $html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1593
-
1594
-                    }
1595
-
1596
-                }
1597
-            }
1598
-        }
1599
-
1600
-        if (!empty($html) && $echo) {
1601
-            echo $html;
1602
-        } elseif (!empty($html)) {
1603
-            return $html;
1604
-        } else
1605
-            return false;
1606
-    }
1607
-}
1560
+			$width = 0;
1561
+			$height = 0;
1562
+			if (is_file($request->path) && file_exists($request->path)) {
1563
+				$imagesize = getimagesize($request->path);
1564
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1565
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1566
+			}
1608 1567
 
1609
-if (!function_exists('geodir_set_post_terms')) {
1610
-    /**
1611
-     * Set post Categories.
1612
-     *
1613
-     * @since 1.0.0
1614
-     * @package GeoDirectory
1615
-     * @global object $wpdb WordPress Database object.
1616
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1617
-     * @param int $post_id The post ID.
1618
-     * @param array $terms An array of term objects.
1619
-     * @param array $tt_ids An array of term taxonomy IDs.
1620
-     * @param string $taxonomy Taxonomy slug.
1621
-     */
1622
-    function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1623
-    {
1624
-        global $wpdb, $plugin_prefix;
1568
+			$image->src = $request->src;
1569
+			$image->width = $width;
1570
+			$image->height = $height;
1625 1571
 
1626
-        $post_type = get_post_type($post_id);
1572
+			$max_size = (object)geodir_get_imagesize($size);
1627 1573
 
1628
-        $table = $plugin_prefix . $post_type . '_detail';
1574
+			if (!is_wp_error($max_size)) {
1575
+				if ($image->width) {
1576
+					if ($image->height >= $image->width) {
1577
+						$width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1578
+					} else if ($image->width < ($max_size->h)) {
1579
+						$width_per = round((($image->width / $max_size->w) * 100), 2);
1580
+					} else
1581
+						$width_per = 100;
1582
+				}
1629 1583
 
1630
-        if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1584
+				if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1585
+					$html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1586
+				} else {
1587
+					if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1588
+						$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1589
+					}else{
1590
+						//$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1591
+						//$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1592
+						$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1593
+
1594
+					}
1595
+
1596
+				}
1597
+			}
1598
+		}
1599
+
1600
+		if (!empty($html) && $echo) {
1601
+			echo $html;
1602
+		} elseif (!empty($html)) {
1603
+			return $html;
1604
+		} else
1605
+			return false;
1606
+	}
1607
+}
1631 1608
 
1632
-            if ($taxonomy == $post_type . '_tags') {
1633
-                if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1634
-                    geodir_save_post_meta($post_id, 'post_tags', $terms);
1635
-                }
1636
-            } elseif ($taxonomy == $post_type . 'category') {
1637
-                $srcharr = array('"', '\\');
1638
-                $replarr = array("&quot;", '');
1609
+if (!function_exists('geodir_set_post_terms')) {
1610
+	/**
1611
+	 * Set post Categories.
1612
+	 *
1613
+	 * @since 1.0.0
1614
+	 * @package GeoDirectory
1615
+	 * @global object $wpdb WordPress Database object.
1616
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1617
+	 * @param int $post_id The post ID.
1618
+	 * @param array $terms An array of term objects.
1619
+	 * @param array $tt_ids An array of term taxonomy IDs.
1620
+	 * @param string $taxonomy Taxonomy slug.
1621
+	 */
1622
+	function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1623
+	{
1624
+		global $wpdb, $plugin_prefix;
1625
+
1626
+		$post_type = get_post_type($post_id);
1627
+
1628
+		$table = $plugin_prefix . $post_type . '_detail';
1629
+
1630
+		if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1631
+
1632
+			if ($taxonomy == $post_type . '_tags') {
1633
+				if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1634
+					geodir_save_post_meta($post_id, 'post_tags', $terms);
1635
+				}
1636
+			} elseif ($taxonomy == $post_type . 'category') {
1637
+				$srcharr = array('"', '\\');
1638
+				$replarr = array("&quot;", '');
1639 1639
 
1640
-                $post_obj = get_post($post_id);
1640
+				$post_obj = get_post($post_id);
1641 1641
 
1642
-                $cat_ids = array('0');
1643
-                if (is_array($tt_ids))
1644
-                    $cat_ids = $tt_ids;
1642
+				$cat_ids = array('0');
1643
+				if (is_array($tt_ids))
1644
+					$cat_ids = $tt_ids;
1645 1645
 
1646 1646
 
1647
-                if (!empty($cat_ids)) {
1648
-                    $cat_ids_array = $cat_ids;
1649
-                    $cat_ids_length = count($cat_ids_array);
1650
-                    $cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1651
-                    $format = implode(',', $cat_ids_format);
1647
+				if (!empty($cat_ids)) {
1648
+					$cat_ids_array = $cat_ids;
1649
+					$cat_ids_length = count($cat_ids_array);
1650
+					$cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1651
+					$format = implode(',', $cat_ids_format);
1652 1652
 
1653
-                    $cat_ids_array_del = $cat_ids_array;
1654
-                    $cat_ids_array_del[] = $post_id;
1653
+					$cat_ids_array_del = $cat_ids_array;
1654
+					$cat_ids_array_del[] = $post_id;
1655 1655
 
1656
-                    $wpdb->get_var(
1657
-                        $wpdb->prepare(
1658
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1659
-                            $cat_ids_array_del
1660
-                        )
1661
-                    );
1656
+					$wpdb->get_var(
1657
+						$wpdb->prepare(
1658
+							"DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1659
+							$cat_ids_array_del
1660
+						)
1661
+					);
1662 1662
 
1663 1663
 
1664
-                    $post_term = $wpdb->get_col(
1665
-                        $wpdb->prepare(
1666
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1667
-                            $cat_ids_array
1668
-                        )
1669
-                    );
1664
+					$post_term = $wpdb->get_col(
1665
+						$wpdb->prepare(
1666
+							"SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1667
+							$cat_ids_array
1668
+						)
1669
+					);
1670 1670
 
1671
-                }
1671
+				}
1672 1672
 
1673
-                $post_marker_json = '';
1673
+				$post_marker_json = '';
1674 1674
 
1675
-                if (!empty($post_term)):
1675
+				if (!empty($post_term)):
1676 1676
 
1677
-                    foreach ($post_term as $cat_id):
1677
+					foreach ($post_term as $cat_id):
1678 1678
 
1679
-                        $term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1680
-                        $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1679
+						$term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1680
+						$term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1681 1681
 
1682
-                        $post_title = $post_obj->title;
1683
-                        $title = str_replace($srcharr, $replarr, $post_title);
1682
+						$post_title = $post_obj->title;
1683
+						$title = str_replace($srcharr, $replarr, $post_title);
1684 1684
 
1685
-                        $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1686
-                        $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1685
+						$lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1686
+						$lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1687 1687
 
1688
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1689
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1688
+						$timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1689
+						$timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1690 1690
 
1691
-                        $json = '{';
1692
-                        $json .= '"id":"' . $post_id . '",';
1693
-                        $json .= '"lat_pos": "' . $lat . '",';
1694
-                        $json .= '"long_pos": "' . $lng . '",';
1695
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1696
-                        $json .= '"icon":"' . $term_icon . '",';
1697
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1698
-                        $json .= '}';
1691
+						$json = '{';
1692
+						$json .= '"id":"' . $post_id . '",';
1693
+						$json .= '"lat_pos": "' . $lat . '",';
1694
+						$json .= '"long_pos": "' . $lng . '",';
1695
+						$json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1696
+						$json .= '"icon":"' . $term_icon . '",';
1697
+						$json .= '"group":"catgroup' . $cat_id . '"';
1698
+						$json .= '}';
1699 1699
 
1700 1700
 
1701
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1702
-                            $post_marker_json = $json;
1701
+						if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1702
+							$post_marker_json = $json;
1703 1703
 
1704 1704
 
1705
-                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1705
+						if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1706 1706
 
1707
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1707
+							$json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1708 1708
 										post_title = %s,
1709 1709
 										json = %s
1710 1710
 										WHERE post_id = %d AND cat_id = %d ",
1711
-                                array($post_title, $json, $post_id, $cat_id));
1711
+								array($post_title, $json, $post_id, $cat_id));
1712 1712
 
1713
-                        } else {
1713
+						} else {
1714 1714
 
1715
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1715
+							$json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1716 1716
 										post_id = %d,
1717 1717
 										post_title = %s,
1718 1718
 										cat_id = %d,
1719 1719
 										json = %s",
1720
-                                array($post_id, $post_title, $cat_id, $json));
1720
+								array($post_id, $post_title, $cat_id, $json));
1721 1721
 
1722
-                        }
1722
+						}
1723 1723
 
1724
-                        $wpdb->query($json_query);
1724
+						$wpdb->query($json_query);
1725 1725
 
1726
-                    endforeach;
1726
+					endforeach;
1727 1727
 
1728
-                endif;
1728
+				endif;
1729 1729
 
1730
-                if (!empty($post_term) && is_array($post_term)) {
1731
-                    $categories = implode(',', $post_term);
1730
+				if (!empty($post_term) && is_array($post_term)) {
1731
+					$categories = implode(',', $post_term);
1732 1732
 
1733
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1733
+					if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1734 1734
 
1735
-                    if (empty($post_marker_json))
1736
-                        $post_marker_json = isset($json) ? $json : '';
1735
+					if (empty($post_marker_json))
1736
+						$post_marker_json = isset($json) ? $json : '';
1737 1737
 
1738
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1738
+					if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1739 1739
 
1740
-                        $wpdb->query(
1741
-                            $wpdb->prepare(
1742
-                                "UPDATE " . $table . " SET
1740
+						$wpdb->query(
1741
+							$wpdb->prepare(
1742
+								"UPDATE " . $table . " SET
1743 1743
 								" . $taxonomy . " = %s,
1744 1744
 								marker_json = %s
1745 1745
 								where post_id = %d",
1746
-                                array($categories, $post_marker_json, $post_id)
1747
-                            )
1748
-                        );
1746
+								array($categories, $post_marker_json, $post_id)
1747
+							)
1748
+						);
1749 1749
 
1750
-                        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1750
+						if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1751 1751
 
1752
-                            $categories = trim($categories, ',');
1752
+							$categories = trim($categories, ',');
1753 1753
 
1754
-                            if ($categories) {
1754
+							if ($categories) {
1755 1755
 
1756
-                                $categories = explode(',', $categories);
1756
+								$categories = explode(',', $categories);
1757 1757
 
1758
-                                $default_category = geodir_get_post_meta($post_id, 'default_category', true);
1758
+								$default_category = geodir_get_post_meta($post_id, 'default_category', true);
1759 1759
 
1760
-                                if (!in_array($default_category, $categories)) {
1760
+								if (!in_array($default_category, $categories)) {
1761 1761
 
1762
-                                    $wpdb->query(
1763
-                                        $wpdb->prepare(
1764
-                                            "UPDATE " . $table . " SET
1762
+									$wpdb->query(
1763
+										$wpdb->prepare(
1764
+											"UPDATE " . $table . " SET
1765 1765
 											default_category = %s
1766 1766
 											where post_id = %d",
1767
-                                            array($categories[0], $post_id)
1768
-                                        )
1769
-                                    );
1767
+											array($categories[0], $post_id)
1768
+										)
1769
+									);
1770 1770
 
1771
-                                    $default_category = $categories[0];
1771
+									$default_category = $categories[0];
1772 1772
 
1773
-                                }
1773
+								}
1774 1774
 
1775
-                                if ($default_category == '')
1776
-                                    $default_category = $categories[0];
1775
+								if ($default_category == '')
1776
+									$default_category = $categories[0];
1777 1777
 
1778
-                                geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1778
+								geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1779 1779
 
1780
-                            }
1780
+							}
1781 1781
 
1782
-                        }
1782
+						}
1783 1783
 
1784 1784
 
1785
-                    } else {
1785
+					} else {
1786 1786
 
1787
-                        $wpdb->query(
1788
-                            $wpdb->prepare(
1789
-                                "INSERT INTO " . $table . " SET
1787
+						$wpdb->query(
1788
+							$wpdb->prepare(
1789
+								"INSERT INTO " . $table . " SET
1790 1790
 								post_id = %d,
1791 1791
 								" . $taxonomy . " = %s,
1792 1792
 								marker_json = %s ",
1793 1793
 
1794
-                                array($post_id, $categories, $post_marker_json)
1795
-                            )
1796
-                        );
1797
-                    }
1798
-                }
1799
-            }
1800
-        }
1801
-    }
1794
+								array($post_id, $categories, $post_marker_json)
1795
+							)
1796
+						);
1797
+					}
1798
+				}
1799
+			}
1800
+		}
1801
+	}
1802 1802
 }
1803 1803
 
1804 1804
 if (!function_exists('geodir_get_infowindow_html')) {
1805
-    /**
1806
-     * Set post Map Marker info html.
1807
-     *
1808
-     * @since 1.0.0
1809
-     * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1810
-     * @package GeoDirectory
1811
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
1812
-     * @global object $gd_session GeoDirectory Session object.
1813
-     * @param object $postinfo_obj The post details object.
1814
-     * @param string $post_preview Is this a post preview?.
1815
-     * @return mixed|string|void
1816
-     */
1817
-    function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1818
-    {
1819
-        global $preview, $gd_session;
1820
-        $srcharr = array("'", "/", "-", '"', '\\');
1821
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1822
-
1823
-        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1824
-            $ID = '';
1825
-            $plink = '';
1826
-
1827
-            if (isset($postinfo_obj->pid)) {
1828
-                $ID = $postinfo_obj->pid;
1829
-                $plink = get_permalink($ID);
1830
-            }
1831
-
1832
-            $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1833
-            $lat = $postinfo_obj->post_latitude;
1834
-            $lng = $postinfo_obj->post_longitude;
1835
-            $address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));
1836
-            $contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));
1837
-            $timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));
1838
-        } else {
1839
-            $ID = $postinfo_obj->post_id;
1840
-            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1841
-            $plink = get_permalink($ID);
1842
-            $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1843
-            $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1844
-            $address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1845
-            $contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));
1846
-            $timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));
1847
-        }
1848
-
1849
-        // filter field as per price package
1850
-        global $geodir_addon_list;
1851
-        if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1852
-            $post_type = get_post_type($ID);
1853
-            $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1854
-            $field_name = 'geodir_contact';
1855
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1856
-                $contact = '';
1857
-            }
1858
-
1859
-            $field_name = 'geodir_timing';
1860
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1861
-                $timing = '';
1862
-            }
1863
-        }
1864
-
1865
-        if ($lat && $lng) {
1866
-            ob_start(); ?>
1805
+	/**
1806
+	 * Set post Map Marker info html.
1807
+	 *
1808
+	 * @since 1.0.0
1809
+	 * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1810
+	 * @package GeoDirectory
1811
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
1812
+	 * @global object $gd_session GeoDirectory Session object.
1813
+	 * @param object $postinfo_obj The post details object.
1814
+	 * @param string $post_preview Is this a post preview?.
1815
+	 * @return mixed|string|void
1816
+	 */
1817
+	function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1818
+	{
1819
+		global $preview, $gd_session;
1820
+		$srcharr = array("'", "/", "-", '"', '\\');
1821
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1822
+
1823
+		if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1824
+			$ID = '';
1825
+			$plink = '';
1826
+
1827
+			if (isset($postinfo_obj->pid)) {
1828
+				$ID = $postinfo_obj->pid;
1829
+				$plink = get_permalink($ID);
1830
+			}
1831
+
1832
+			$title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1833
+			$lat = $postinfo_obj->post_latitude;
1834
+			$lng = $postinfo_obj->post_longitude;
1835
+			$address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));
1836
+			$contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));
1837
+			$timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));
1838
+		} else {
1839
+			$ID = $postinfo_obj->post_id;
1840
+			$title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1841
+			$plink = get_permalink($ID);
1842
+			$lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1843
+			$lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1844
+			$address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1845
+			$contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));
1846
+			$timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));
1847
+		}
1848
+
1849
+		// filter field as per price package
1850
+		global $geodir_addon_list;
1851
+		if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1852
+			$post_type = get_post_type($ID);
1853
+			$package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1854
+			$field_name = 'geodir_contact';
1855
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1856
+				$contact = '';
1857
+			}
1858
+
1859
+			$field_name = 'geodir_timing';
1860
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1861
+				$timing = '';
1862
+			}
1863
+		}
1864
+
1865
+		if ($lat && $lng) {
1866
+			ob_start(); ?>
1867 1867
             <div class="gd-bubble" style="">
1868 1868
                 <div class="gd-bubble-inside">
1869 1869
                     <?php
1870
-                    $comment_count = '';
1871
-                    $rating_star = '';
1872
-                    if ($ID != '') {
1873
-                        $rating_star = '';
1874
-                        $comment_count = geodir_get_review_count_total($ID);
1875
-
1876
-                        if (!$preview) {
1877
-                            $post_avgratings = geodir_get_post_rating($ID);
1878
-
1879
-                            $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1880
-
1881
-                            /**
1882
-                             * Filter to change rating stars
1883
-                             *
1884
-                             * You can use this filter to change Rating stars.
1885
-                             *
1886
-                             * @since 1.0.0
1887
-                             * @package GeoDirectory
1888
-                             * @param string $rating_star Rating stars.
1889
-                             * @param float $post_avgratings Average ratings of the post.
1890
-                             * @param int $ID The post ID.
1891
-                             */
1892
-                            $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1893
-                        }
1894
-                    }
1895
-                    ?>
1870
+					$comment_count = '';
1871
+					$rating_star = '';
1872
+					if ($ID != '') {
1873
+						$rating_star = '';
1874
+						$comment_count = geodir_get_review_count_total($ID);
1875
+
1876
+						if (!$preview) {
1877
+							$post_avgratings = geodir_get_post_rating($ID);
1878
+
1879
+							$rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1880
+
1881
+							/**
1882
+							 * Filter to change rating stars
1883
+							 *
1884
+							 * You can use this filter to change Rating stars.
1885
+							 *
1886
+							 * @since 1.0.0
1887
+							 * @package GeoDirectory
1888
+							 * @param string $rating_star Rating stars.
1889
+							 * @param float $post_avgratings Average ratings of the post.
1890
+							 * @param int $ID The post ID.
1891
+							 */
1892
+							$rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1893
+						}
1894
+					}
1895
+					?>
1896 1896
                     <div class="geodir-bubble_desc">
1897 1897
                         <h4>
1898 1898
                             <a href="<?php if ($plink != '') {
1899
-                                echo $plink;
1900
-                            } else {
1901
-                                echo 'javascript:void(0);';
1902
-                            } ?>"><?php echo $title; ?></a>
1899
+								echo $plink;
1900
+							} else {
1901
+								echo 'javascript:void(0);';
1902
+							} ?>"><?php echo $title; ?></a>
1903 1903
                         </h4>
1904 1904
                         <?php
1905
-                        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1906
-                            $post_images = array();
1907
-                            if (!empty($postinfo_obj->post_images)) {
1908
-                                $post_images = explode(",", $postinfo_obj->post_images);
1909
-                            }
1910
-
1911
-                            if (!empty($post_images)) {
1912
-                                ?>
1905
+						if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1906
+							$post_images = array();
1907
+							if (!empty($postinfo_obj->post_images)) {
1908
+								$post_images = explode(",", $postinfo_obj->post_images);
1909
+							}
1910
+
1911
+							if (!empty($post_images)) {
1912
+								?>
1913 1913
                                 <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
1914
-                                        echo $plink;
1915
-                                    } else {
1916
-                                        echo 'javascript:void(0);';
1917
-                                    } ?>"><img alt="bubble image" style="max-height:50px;"
1914
+										echo $plink;
1915
+									} else {
1916
+										echo 'javascript:void(0);';
1917
+									} ?>"><img alt="bubble image" style="max-height:50px;"
1918 1918
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1919 1919
                             <?php
1920
-                            }else{
1921
-                                echo '<div class="geodir-bubble_image"></div>';
1922
-                            }
1923
-                        } else {
1924
-                            if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1925
-                                ?>
1920
+							}else{
1921
+								echo '<div class="geodir-bubble_image"></div>';
1922
+							}
1923
+						} else {
1924
+							if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1925
+								?>
1926 1926
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1927 1927
                             <?php
1928
-                            }else{
1929
-                                echo '<div class="geodir-bubble_image"></div>';
1930
-                            }
1931
-                        }
1932
-                        ?>
1928
+							}else{
1929
+								echo '<div class="geodir-bubble_image"></div>';
1930
+							}
1931
+						}
1932
+						?>
1933 1933
                         <div class="geodir-bubble-meta-side">
1934 1934
                             <?php
1935
-                            /**
1936
-                             * Fires before the meta info in the map info window.
1937
-                             *
1938
-                             * This can be used to add more info to the map info window before the normal meta info.
1939
-                             *
1940
-                             * @since 1.5.4
1941
-                             * @param int $ID The post id.
1942
-                             * @param object $postinfo_obj The posts info as an object.
1943
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1944
-                             */
1945
-                            do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1946
-                            ?>
1935
+							/**
1936
+							 * Fires before the meta info in the map info window.
1937
+							 *
1938
+							 * This can be used to add more info to the map info window before the normal meta info.
1939
+							 *
1940
+							 * @since 1.5.4
1941
+							 * @param int $ID The post id.
1942
+							 * @param object $postinfo_obj The posts info as an object.
1943
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1944
+							 */
1945
+							do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1946
+							?>
1947 1947
                             <span class="geodir_address"><i class="fa fa-home"></i> <?php echo $address; ?></span>
1948 1948
                             <?php if ($contact) { ?><span class="geodir_contact"><i
1949 1949
                                 class="fa fa-phone"></i> <?php echo $contact; ?></span><?php } ?>
1950 1950
                             <?php if ($timing) { ?><span class="geodir_timing"><i
1951 1951
                                 class="fa fa-clock-o"></i> <?php echo $timing; ?></span><?php }
1952 1952
 
1953
-                            /**
1954
-                             * Fires after the meta info in the map info window.
1955
-                             *
1956
-                             * This can be used to add more info to the map info window after the normal meta info.
1957
-                             *
1958
-                             * @since 1.4.2
1959
-                             * @param object $postinfo_obj The posts info as an object.
1960
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1961
-                             */
1962
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1963
-                            ?>
1953
+							/**
1954
+							 * Fires after the meta info in the map info window.
1955
+							 *
1956
+							 * This can be used to add more info to the map info window after the normal meta info.
1957
+							 *
1958
+							 * @since 1.4.2
1959
+							 * @param object $postinfo_obj The posts info as an object.
1960
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1961
+							 */
1962
+							do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1963
+							?>
1964 1964
                         </div>
1965 1965
                         <?php
1966 1966
 
1967
-                        if ($ID) {
1967
+						if ($ID) {
1968 1968
 
1969
-                            $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1970
-                            ?>
1969
+							$post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1970
+							?>
1971 1971
                             <div class="geodir-bubble-meta-fade"></div>
1972 1972
 
1973 1973
                             <div class="geodir-bubble-meta-bottom">
@@ -1987,69 +1987,69 @@  discard block
 block discarded – undo
1987 1987
                 </div>
1988 1988
             </div>
1989 1989
             <?php
1990
-            $html = ob_get_clean();
1991
-            /**
1992
-             * Filter to change infowindow html
1993
-             *
1994
-             * You can use this filter to change infowindow html.
1995
-             *
1996
-             * @since 1.0.0
1997
-             * @package GeoDirectory
1998
-             * @param string $html Infowindow html.
1999
-             * @param object $postinfo_obj The Post object.
2000
-             * @param bool|string $post_preview Is this a post preview?
2001
-             */
2002
-            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2003
-            return $html;
2004
-        }
2005
-    }
1990
+			$html = ob_get_clean();
1991
+			/**
1992
+			 * Filter to change infowindow html
1993
+			 *
1994
+			 * You can use this filter to change infowindow html.
1995
+			 *
1996
+			 * @since 1.0.0
1997
+			 * @package GeoDirectory
1998
+			 * @param string $html Infowindow html.
1999
+			 * @param object $postinfo_obj The Post object.
2000
+			 * @param bool|string $post_preview Is this a post preview?
2001
+			 */
2002
+			$html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2003
+			return $html;
2004
+		}
2005
+	}
2006 2006
 }
2007 2007
 
2008 2008
 
2009 2009
 if (!function_exists('geodir_new_post_default_status')) {
2010
-    /**
2011
-     * Default post status for new posts.
2012
-     *
2013
-     * @since 1.0.0
2014
-     * @package GeoDirectory
2015
-     * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2016
-     */
2017
-    function geodir_new_post_default_status()
2018
-    {
2019
-        if (get_option('geodir_new_post_default_status'))
2020
-            return get_option('geodir_new_post_default_status');
2021
-        else
2022
-            return 'publish';
2023
-
2024
-    }
2010
+	/**
2011
+	 * Default post status for new posts.
2012
+	 *
2013
+	 * @since 1.0.0
2014
+	 * @package GeoDirectory
2015
+	 * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2016
+	 */
2017
+	function geodir_new_post_default_status()
2018
+	{
2019
+		if (get_option('geodir_new_post_default_status'))
2020
+			return get_option('geodir_new_post_default_status');
2021
+		else
2022
+			return 'publish';
2023
+
2024
+	}
2025 2025
 }
2026 2026
 
2027 2027
 if (!function_exists('geodir_change_post_status')) {
2028
-    /**
2029
-     * Change post status of a post.
2030
-     *
2031
-     * @global object $wpdb WordPress Database object.
2032
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2033
-     * @param int|string $post_id The post ID.
2034
-     * @param string $status New post status. Ex: draft, publish etc.
2035
-     */
2036
-    function geodir_change_post_status($post_id = '', $status = '')
2037
-    {
2038
-        global $wpdb, $plugin_prefix;
2039
-
2040
-        $post_type = get_post_type($post_id);
2041
-
2042
-        $table = $plugin_prefix . $post_type . '_detail';
2043
-
2044
-        $wpdb->query(
2045
-            $wpdb->prepare(
2046
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2047
-                array($status, $post_id)
2048
-            )
2049
-        );
2050
-
2051
-
2052
-    }
2028
+	/**
2029
+	 * Change post status of a post.
2030
+	 *
2031
+	 * @global object $wpdb WordPress Database object.
2032
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2033
+	 * @param int|string $post_id The post ID.
2034
+	 * @param string $status New post status. Ex: draft, publish etc.
2035
+	 */
2036
+	function geodir_change_post_status($post_id = '', $status = '')
2037
+	{
2038
+		global $wpdb, $plugin_prefix;
2039
+
2040
+		$post_type = get_post_type($post_id);
2041
+
2042
+		$table = $plugin_prefix . $post_type . '_detail';
2043
+
2044
+		$wpdb->query(
2045
+			$wpdb->prepare(
2046
+				"UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2047
+				array($status, $post_id)
2048
+			)
2049
+		);
2050
+
2051
+
2052
+	}
2053 2053
 }
2054 2054
 
2055 2055
 /**
@@ -2063,13 +2063,13 @@  discard block
 block discarded – undo
2063 2063
  */
2064 2064
 function geodir_set_post_status($pid, $status)
2065 2065
 {
2066
-    if ($pid) {
2067
-        global $wpdb;
2068
-        $my_post = array();
2069
-        $my_post['post_status'] = $status;
2070
-        $my_post['ID'] = $pid;
2071
-        $last_postid = wp_update_post($my_post);
2072
-    }
2066
+	if ($pid) {
2067
+		global $wpdb;
2068
+		$my_post = array();
2069
+		$my_post['post_status'] = $status;
2070
+		$my_post['ID'] = $pid;
2071
+		$last_postid = wp_update_post($my_post);
2072
+	}
2073 2073
 }
2074 2074
 
2075 2075
 
@@ -2085,384 +2085,384 @@  discard block
 block discarded – undo
2085 2085
  */
2086 2086
 function geodir_update_poststatus($new_status, $old_status, $post)
2087 2087
 {
2088
-    global $wpdb;
2088
+	global $wpdb;
2089 2089
 
2090
-    $geodir_posttypes = geodir_get_posttypes();
2090
+	$geodir_posttypes = geodir_get_posttypes();
2091 2091
 
2092
-    if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2092
+	if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2093 2093
 
2094
-        geodir_change_post_status($post->ID, $new_status);
2095
-    }
2094
+		geodir_change_post_status($post->ID, $new_status);
2095
+	}
2096 2096
 }
2097 2097
 
2098 2098
 
2099 2099
 if (!function_exists('geodir_update_listing_info')) {
2100
-    /**
2101
-     * Update post info.
2102
-     *
2103
-     * @since 1.0.0
2104
-     * @package GeoDirectory
2105
-     * @global object $wpdb WordPress Database object.
2106
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2107
-     * @param int $updatingpost The updating post ID.
2108
-     * @param int $temppost The temporary post ID.
2109
-     * @todo fix post_id variable
2110
-     */
2111
-    function geodir_update_listing_info($updatingpost, $temppost)
2112
-    {
2113
-
2114
-        global $wpdb, $plugin_prefix;
2115
-
2116
-        $post_type = get_post_type($post_id);
2117
-
2118
-        $table = $plugin_prefix . $post_type . '_detail';
2119
-
2120
-        $wpdb->query(
2121
-            $wpdb->prepare(
2122
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2123
-                array($updatingpost, $temppost)
2124
-            )
2125
-        );
2126
-
2127
-        $wpdb->query(
2128
-            $wpdb->prepare(
2129
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2130
-                array($updatingpost, $temppost)
2131
-            )
2132
-        );
2133
-
2134
-        /* Update Attachments*/
2135
-
2136
-        $wpdb->query(
2137
-            $wpdb->prepare(
2138
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2139
-                array($updatingpost, $temppost)
2140
-            )
2141
-        );
2142
-
2143
-    }
2100
+	/**
2101
+	 * Update post info.
2102
+	 *
2103
+	 * @since 1.0.0
2104
+	 * @package GeoDirectory
2105
+	 * @global object $wpdb WordPress Database object.
2106
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2107
+	 * @param int $updatingpost The updating post ID.
2108
+	 * @param int $temppost The temporary post ID.
2109
+	 * @todo fix post_id variable
2110
+	 */
2111
+	function geodir_update_listing_info($updatingpost, $temppost)
2112
+	{
2113
+
2114
+		global $wpdb, $plugin_prefix;
2115
+
2116
+		$post_type = get_post_type($post_id);
2117
+
2118
+		$table = $plugin_prefix . $post_type . '_detail';
2119
+
2120
+		$wpdb->query(
2121
+			$wpdb->prepare(
2122
+				"UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2123
+				array($updatingpost, $temppost)
2124
+			)
2125
+		);
2126
+
2127
+		$wpdb->query(
2128
+			$wpdb->prepare(
2129
+				"UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2130
+				array($updatingpost, $temppost)
2131
+			)
2132
+		);
2133
+
2134
+		/* Update Attachments*/
2135
+
2136
+		$wpdb->query(
2137
+			$wpdb->prepare(
2138
+				"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2139
+				array($updatingpost, $temppost)
2140
+			)
2141
+		);
2142
+
2143
+	}
2144 2144
 }
2145 2145
 
2146 2146
 
2147 2147
 if (!function_exists('geodir_delete_listing_info')) {
2148
-    /**
2149
-     * Delete Listing info from details table for the given post id.
2150
-     *
2151
-     * @since 1.0.0
2152
-     * @package GeoDirectory
2153
-     * @global object $wpdb WordPress Database object.
2154
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2155
-     * @param int $deleted_postid The post ID.
2156
-     * @param bool $force Optional. Do you want to force delete it? Default: false.
2157
-     * @return bool|void
2158
-     */
2159
-    function geodir_delete_listing_info($deleted_postid, $force = false)
2160
-    {
2161
-        global $wpdb, $plugin_prefix;
2162
-
2163
-        // check for multisite deletions
2164
-        if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2165
-        } else {
2166
-            return;
2167
-        }
2168
-
2169
-        $post_type = get_post_type($deleted_postid);
2170
-
2171
-        $all_postypes = geodir_get_posttypes();
2172
-
2173
-        if (!in_array($post_type, $all_postypes))
2174
-            return false;
2175
-
2176
-        $table = $plugin_prefix . $post_type . '_detail';
2177
-
2178
-        /* Delete custom post meta*/
2179
-        $wpdb->query(
2180
-            $wpdb->prepare(
2181
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2182
-                array($deleted_postid)
2183
-            )
2184
-        );
2185
-
2186
-        /* Delete post map icons*/
2187
-
2188
-        $wpdb->query(
2189
-            $wpdb->prepare(
2190
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2191
-                array($deleted_postid)
2192
-            )
2193
-        );
2194
-
2195
-        /* Delete Attachments*/
2196
-        $postcurr_images = geodir_get_images($deleted_postid);
2197
-
2198
-        $wpdb->query(
2199
-            $wpdb->prepare(
2200
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2201
-                array($deleted_postid)
2202
-            )
2203
-        );
2204
-        geodir_remove_attachments($postcurr_images);
2205
-
2206
-    }
2148
+	/**
2149
+	 * Delete Listing info from details table for the given post id.
2150
+	 *
2151
+	 * @since 1.0.0
2152
+	 * @package GeoDirectory
2153
+	 * @global object $wpdb WordPress Database object.
2154
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2155
+	 * @param int $deleted_postid The post ID.
2156
+	 * @param bool $force Optional. Do you want to force delete it? Default: false.
2157
+	 * @return bool|void
2158
+	 */
2159
+	function geodir_delete_listing_info($deleted_postid, $force = false)
2160
+	{
2161
+		global $wpdb, $plugin_prefix;
2162
+
2163
+		// check for multisite deletions
2164
+		if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2165
+		} else {
2166
+			return;
2167
+		}
2168
+
2169
+		$post_type = get_post_type($deleted_postid);
2170
+
2171
+		$all_postypes = geodir_get_posttypes();
2172
+
2173
+		if (!in_array($post_type, $all_postypes))
2174
+			return false;
2175
+
2176
+		$table = $plugin_prefix . $post_type . '_detail';
2177
+
2178
+		/* Delete custom post meta*/
2179
+		$wpdb->query(
2180
+			$wpdb->prepare(
2181
+				"DELETE FROM " . $table . " WHERE `post_id` = %d",
2182
+				array($deleted_postid)
2183
+			)
2184
+		);
2185
+
2186
+		/* Delete post map icons*/
2187
+
2188
+		$wpdb->query(
2189
+			$wpdb->prepare(
2190
+				"DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2191
+				array($deleted_postid)
2192
+			)
2193
+		);
2194
+
2195
+		/* Delete Attachments*/
2196
+		$postcurr_images = geodir_get_images($deleted_postid);
2197
+
2198
+		$wpdb->query(
2199
+			$wpdb->prepare(
2200
+				"DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2201
+				array($deleted_postid)
2202
+			)
2203
+		);
2204
+		geodir_remove_attachments($postcurr_images);
2205
+
2206
+	}
2207 2207
 }
2208 2208
 
2209 2209
 
2210 2210
 if (!function_exists('geodir_add_to_favorite')) {
2211
-    /**
2212
-     * This function would add listing to favorite listing.
2213
-     *
2214
-     * @since 1.0.0
2215
-     * @package GeoDirectory
2216
-     * @global object $current_user Current user object.
2217
-     * @param int $post_id The post ID.
2218
-     */
2219
-    function geodir_add_to_favorite($post_id)
2220
-    {
2221
-
2222
-        global $current_user;
2223
-
2224
-        /**
2225
-         * Filter to modify "Unfavorite" text
2226
-         *
2227
-         * You can use this filter to rename "Unfavorite" text to something else.
2228
-         *
2229
-         * @since 1.0.0
2230
-         * @package GeoDirectory
2231
-         */
2232
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2233
-
2234
-        /**
2235
-         * Filter to modify "Remove from Favorites" text
2236
-         *
2237
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2238
-         *
2239
-         * @since 1.0.0
2240
-         * @package GeoDirectory
2241
-         */
2242
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2243
-
2244
-        /**
2245
-         * Filter to modify "fa fa-heart" icon
2246
-         *
2247
-         * You can use this filter to change "fa fa-heart" icon to something else.
2248
-         *
2249
-         * @since 1.0.0
2250
-         * @package GeoDirectory
2251
-         */
2252
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2211
+	/**
2212
+	 * This function would add listing to favorite listing.
2213
+	 *
2214
+	 * @since 1.0.0
2215
+	 * @package GeoDirectory
2216
+	 * @global object $current_user Current user object.
2217
+	 * @param int $post_id The post ID.
2218
+	 */
2219
+	function geodir_add_to_favorite($post_id)
2220
+	{
2221
+
2222
+		global $current_user;
2223
+
2224
+		/**
2225
+		 * Filter to modify "Unfavorite" text
2226
+		 *
2227
+		 * You can use this filter to rename "Unfavorite" text to something else.
2228
+		 *
2229
+		 * @since 1.0.0
2230
+		 * @package GeoDirectory
2231
+		 */
2232
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2233
+
2234
+		/**
2235
+		 * Filter to modify "Remove from Favorites" text
2236
+		 *
2237
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2238
+		 *
2239
+		 * @since 1.0.0
2240
+		 * @package GeoDirectory
2241
+		 */
2242
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2243
+
2244
+		/**
2245
+		 * Filter to modify "fa fa-heart" icon
2246
+		 *
2247
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2248
+		 *
2249
+		 * @since 1.0.0
2250
+		 * @package GeoDirectory
2251
+		 */
2252
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2253
+
2254
+		$user_meta_data = array();
2255
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2256
+
2257
+		if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2258
+			$user_meta_data[] = $post_id;
2259
+		}
2260
+
2261
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2262
+
2263
+		/**
2264
+		 * Called before adding the post from favourites.
2265
+		 *
2266
+		 * @since 1.0.0
2267
+		 * @package GeoDirectory
2268
+		 * @param int $post_id The post ID.
2269
+		 */
2270
+		do_action('geodir_before_add_from_favorite', $post_id);
2271
+
2272
+		echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2273
+
2274
+		/**
2275
+		 * Called after adding the post from favourites.
2276
+		 *
2277
+		 * @since 1.0.0
2278
+		 * @package GeoDirectory
2279
+		 * @param int $post_id The post ID.
2280
+		 */
2281
+		do_action('geodir_after_add_from_favorite', $post_id);
2253 2282
 
2254
-        $user_meta_data = array();
2255
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2256
-
2257
-        if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2258
-            $user_meta_data[] = $post_id;
2259
-        }
2260
-
2261
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2262
-
2263
-        /**
2264
-         * Called before adding the post from favourites.
2265
-         *
2266
-         * @since 1.0.0
2267
-         * @package GeoDirectory
2268
-         * @param int $post_id The post ID.
2269
-         */
2270
-        do_action('geodir_before_add_from_favorite', $post_id);
2271
-
2272
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2273
-
2274
-        /**
2275
-         * Called after adding the post from favourites.
2276
-         *
2277
-         * @since 1.0.0
2278
-         * @package GeoDirectory
2279
-         * @param int $post_id The post ID.
2280
-         */
2281
-        do_action('geodir_after_add_from_favorite', $post_id);
2282
-
2283
-    }
2283
+	}
2284 2284
 }
2285 2285
 
2286 2286
 if (!function_exists('geodir_remove_from_favorite')) {
2287
-    /**
2288
-     * This function would remove the favourited property earlier.
2289
-     *
2290
-     * @since 1.0.0
2291
-     * @package GeoDirectory
2292
-     * @global object $current_user Current user object.
2293
-     * @param int $post_id The post ID.
2294
-     */
2295
-    function geodir_remove_from_favorite($post_id)
2296
-    {
2297
-        global $current_user;
2298
-
2299
-        /**
2300
-         * Filter to modify "Add to Favorites" text
2301
-         *
2302
-         * You can use this filter to rename "Add to Favorites" text to something else.
2303
-         *
2304
-         * @since 1.0.0
2305
-         * @package GeoDirectory
2306
-         */
2307
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2308
-
2309
-        /**
2310
-         * Filter to modify "Favourite" text
2311
-         *
2312
-         * You can use this filter to rename "Favourite" text to something else.
2313
-         *
2314
-         * @since 1.0.0
2315
-         * @package GeoDirectory
2316
-         */
2317
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2318
-
2319
-        /**
2320
-         * Filter to modify "fa fa-heart" icon
2321
-         *
2322
-         * You can use this filter to change "fa fa-heart" icon to something else.
2323
-         *
2324
-         * @since 1.0.0
2325
-         * @package GeoDirectory
2326
-         */
2327
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2328
-
2329
-        $user_meta_data = array();
2330
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2331
-
2332
-        if (!empty($user_meta_data)) {
2287
+	/**
2288
+	 * This function would remove the favourited property earlier.
2289
+	 *
2290
+	 * @since 1.0.0
2291
+	 * @package GeoDirectory
2292
+	 * @global object $current_user Current user object.
2293
+	 * @param int $post_id The post ID.
2294
+	 */
2295
+	function geodir_remove_from_favorite($post_id)
2296
+	{
2297
+		global $current_user;
2298
+
2299
+		/**
2300
+		 * Filter to modify "Add to Favorites" text
2301
+		 *
2302
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2303
+		 *
2304
+		 * @since 1.0.0
2305
+		 * @package GeoDirectory
2306
+		 */
2307
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2308
+
2309
+		/**
2310
+		 * Filter to modify "Favourite" text
2311
+		 *
2312
+		 * You can use this filter to rename "Favourite" text to something else.
2313
+		 *
2314
+		 * @since 1.0.0
2315
+		 * @package GeoDirectory
2316
+		 */
2317
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2318
+
2319
+		/**
2320
+		 * Filter to modify "fa fa-heart" icon
2321
+		 *
2322
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2323
+		 *
2324
+		 * @since 1.0.0
2325
+		 * @package GeoDirectory
2326
+		 */
2327
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2328
+
2329
+		$user_meta_data = array();
2330
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2331
+
2332
+		if (!empty($user_meta_data)) {
2333
+
2334
+			if (($key = array_search($post_id, $user_meta_data)) !== false) {
2335
+				unset($user_meta_data[$key]);
2336
+			}
2333 2337
 
2334
-            if (($key = array_search($post_id, $user_meta_data)) !== false) {
2335
-                unset($user_meta_data[$key]);
2336
-            }
2338
+		}
2337 2339
 
2338
-        }
2340
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2339 2341
 
2340
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2342
+		/**
2343
+		 * Called before removing the post from favourites.
2344
+		 *
2345
+		 * @since 1.0.0
2346
+		 * @package GeoDirectory
2347
+		 * @param int $post_id The post ID.
2348
+		 */
2349
+		do_action('geodir_before_remove_from_favorite', $post_id);
2341 2350
 
2342
-        /**
2343
-         * Called before removing the post from favourites.
2344
-         *
2345
-         * @since 1.0.0
2346
-         * @package GeoDirectory
2347
-         * @param int $post_id The post ID.
2348
-         */
2349
-        do_action('geodir_before_remove_from_favorite', $post_id);
2351
+		echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2350 2352
 
2351
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2353
+		/**
2354
+		 * Called after removing the post from favourites.
2355
+		 *
2356
+		 * @since 1.0.0
2357
+		 * @package GeoDirectory
2358
+		 * @param int $post_id The post ID.
2359
+		 */
2360
+		do_action('geodir_after_remove_from_favorite', $post_id);
2352 2361
 
2353
-        /**
2354
-         * Called after removing the post from favourites.
2355
-         *
2356
-         * @since 1.0.0
2357
-         * @package GeoDirectory
2358
-         * @param int $post_id The post ID.
2359
-         */
2360
-        do_action('geodir_after_remove_from_favorite', $post_id);
2361
-
2362
-    }
2362
+	}
2363 2363
 }
2364 2364
 
2365 2365
 if (!function_exists('geodir_favourite_html')) {
2366
-    /**
2367
-     * This function would display the html content for add to favorite or remove from favorite.
2368
-     *
2369
-     * @since 1.0.0
2370
-     * @package GeoDirectory
2371
-     * @global object $current_user Current user object.
2372
-     * @global object $post The current post object.
2373
-     * @param int $user_id The user ID.
2374
-     * @param int $post_id The post ID.
2375
-     */
2376
-    function geodir_favourite_html($user_id, $post_id)
2377
-    {
2378
-
2379
-        global $current_user, $post;
2380
-
2381
-        /**
2382
-         * Filter to modify "Add to Favorites" text
2383
-         *
2384
-         * You can use this filter to rename "Add to Favorites" text to something else.
2385
-         *
2386
-         * @since 1.0.0
2387
-         * @package GeoDirectory
2388
-         */
2389
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2390
-
2391
-        /**
2392
-         * Filter to modify "Favourite" text
2393
-         *
2394
-         * You can use this filter to rename "Favourite" text to something else.
2395
-         *
2396
-         * @since 1.0.0
2397
-         * @package GeoDirectory
2398
-         */
2399
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2400
-
2401
-        /**
2402
-         * Filter to modify "Unfavorite" text
2403
-         *
2404
-         * You can use this filter to rename "Unfavorite" text to something else.
2405
-         *
2406
-         * @since 1.0.0
2407
-         * @package GeoDirectory
2408
-         */
2409
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2410
-
2411
-        /**
2412
-         * Filter to modify "Remove from Favorites" text
2413
-         *
2414
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2415
-         *
2416
-         * @since 1.0.0
2417
-         * @package GeoDirectory
2418
-         */
2419
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2420
-
2421
-        /**
2422
-         * Filter to modify "fa fa-heart" icon
2423
-         *
2424
-         * You can use this filter to change "fa fa-heart" icon to something else.
2425
-         *
2426
-         * @since 1.0.0
2427
-         * @package GeoDirectory
2428
-         */
2429
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2430
-
2431
-        /**
2432
-         * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2433
-         *
2434
-         * You can use this filter to change "fa fa-heart" icon to something else.
2435
-         *
2436
-         * @since 1.0.0
2437
-         * @package GeoDirectory
2438
-         */
2439
-        $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2440
-
2441
-        $user_meta_data = '';
2442
-        if (isset($current_user->data->ID))
2443
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2444
-
2445
-        if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2446
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2366
+	/**
2367
+	 * This function would display the html content for add to favorite or remove from favorite.
2368
+	 *
2369
+	 * @since 1.0.0
2370
+	 * @package GeoDirectory
2371
+	 * @global object $current_user Current user object.
2372
+	 * @global object $post The current post object.
2373
+	 * @param int $user_id The user ID.
2374
+	 * @param int $post_id The post ID.
2375
+	 */
2376
+	function geodir_favourite_html($user_id, $post_id)
2377
+	{
2378
+
2379
+		global $current_user, $post;
2380
+
2381
+		/**
2382
+		 * Filter to modify "Add to Favorites" text
2383
+		 *
2384
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2385
+		 *
2386
+		 * @since 1.0.0
2387
+		 * @package GeoDirectory
2388
+		 */
2389
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2390
+
2391
+		/**
2392
+		 * Filter to modify "Favourite" text
2393
+		 *
2394
+		 * You can use this filter to rename "Favourite" text to something else.
2395
+		 *
2396
+		 * @since 1.0.0
2397
+		 * @package GeoDirectory
2398
+		 */
2399
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2400
+
2401
+		/**
2402
+		 * Filter to modify "Unfavorite" text
2403
+		 *
2404
+		 * You can use this filter to rename "Unfavorite" text to something else.
2405
+		 *
2406
+		 * @since 1.0.0
2407
+		 * @package GeoDirectory
2408
+		 */
2409
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2410
+
2411
+		/**
2412
+		 * Filter to modify "Remove from Favorites" text
2413
+		 *
2414
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2415
+		 *
2416
+		 * @since 1.0.0
2417
+		 * @package GeoDirectory
2418
+		 */
2419
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2420
+
2421
+		/**
2422
+		 * Filter to modify "fa fa-heart" icon
2423
+		 *
2424
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2425
+		 *
2426
+		 * @since 1.0.0
2427
+		 * @package GeoDirectory
2428
+		 */
2429
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2430
+
2431
+		/**
2432
+		 * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2433
+		 *
2434
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2435
+		 *
2436
+		 * @since 1.0.0
2437
+		 * @package GeoDirectory
2438
+		 */
2439
+		$unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2440
+
2441
+		$user_meta_data = '';
2442
+		if (isset($current_user->data->ID))
2443
+			$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2444
+
2445
+		if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2446
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2447 2447
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2448 2448
                 onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2449 2449
                 title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2450 2450
             </a>   </span><?php
2451 2451
 
2452
-        } else {
2452
+		} else {
2453 2453
 
2454
-            if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2455
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2456
-            } else
2457
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2454
+			if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2455
+				$script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2456
+			} else
2457
+				$script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2458 2458
 
2459
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2459
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2460 2460
                                                                                         href="javascript:void(0);"
2461 2461
                                                                                         onclick="<?php echo $script_text;?>"
2462 2462
                                                                                         title="<?php echo $add_favourite_text;?>"><i
2463 2463
                     class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2464 2464
         <?php }
2465
-    }
2465
+	}
2466 2466
 }
2467 2467
 
2468 2468
 
@@ -2479,54 +2479,54 @@  discard block
 block discarded – undo
2479 2479
 function geodir_get_cat_postcount($term = array())
2480 2480
 {
2481 2481
 
2482
-    if (!empty($term)) {
2482
+	if (!empty($term)) {
2483 2483
 
2484
-        global $wpdb, $plugin_prefix;
2484
+		global $wpdb, $plugin_prefix;
2485 2485
 
2486
-        $where = '';
2487
-        $join = '';
2488
-        if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2489
-            $taxonomy_obj = get_taxonomy($term->taxonomy);
2486
+		$where = '';
2487
+		$join = '';
2488
+		if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2489
+			$taxonomy_obj = get_taxonomy($term->taxonomy);
2490 2490
 
2491
-            $post_type = $taxonomy_obj->object_type[0];
2491
+			$post_type = $taxonomy_obj->object_type[0];
2492 2492
 
2493
-            $table = $plugin_prefix . $post_type . '_detail';
2493
+			$table = $plugin_prefix . $post_type . '_detail';
2494 2494
 
2495
-            /**
2496
-             * Filter to modify the 'join' query
2497
-             *
2498
-             * @since 1.0.0
2499
-             * @package GeoDirectory
2500
-             * @param object|array $term category / term object that need to be processed.
2501
-             * @param string $join The join query.
2502
-             */
2503
-            $join = apply_filters('geodir_cat_post_count_join', $join, $term);
2495
+			/**
2496
+			 * Filter to modify the 'join' query
2497
+			 *
2498
+			 * @since 1.0.0
2499
+			 * @package GeoDirectory
2500
+			 * @param object|array $term category / term object that need to be processed.
2501
+			 * @param string $join The join query.
2502
+			 */
2503
+			$join = apply_filters('geodir_cat_post_count_join', $join, $term);
2504 2504
 
2505
-            /**
2506
-             * Filter to modify the 'where' query
2507
-             *
2508
-             * @since 1.0.0
2509
-             * @package GeoDirectory
2510
-             * @param object|array $term category / term object that need to be processed.
2511
-             * @param string $where The where query.
2512
-             */
2513
-            $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2505
+			/**
2506
+			 * Filter to modify the 'where' query
2507
+			 *
2508
+			 * @since 1.0.0
2509
+			 * @package GeoDirectory
2510
+			 * @param object|array $term category / term object that need to be processed.
2511
+			 * @param string $where The where query.
2512
+			 */
2513
+			$where = apply_filters('geodir_cat_post_count_where', $where, $term);
2514 2514
 
2515
-            $count_query = "SELECT count(post_id) FROM
2515
+			$count_query = "SELECT count(post_id) FROM
2516 2516
 							" . $table . " as pd " . $join . "
2517 2517
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2518 2518
 
2519
-            $cat_post_count = $wpdb->get_var($count_query);
2520
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2521
-                $cat_post_count = 0;
2519
+			$cat_post_count = $wpdb->get_var($count_query);
2520
+			if (empty($cat_post_count) || is_wp_error($cat_post_count))
2521
+				$cat_post_count = 0;
2522 2522
 
2523
-            return $cat_post_count;
2523
+			return $cat_post_count;
2524 2524
 
2525
-        } else
2525
+		} else
2526 2526
 
2527
-            return $term->count;
2528
-    }
2529
-    return false;
2527
+			return $term->count;
2528
+	}
2529
+	return false;
2530 2530
 
2531 2531
 }
2532 2532
 
@@ -2539,17 +2539,17 @@  discard block
 block discarded – undo
2539 2539
  */
2540 2540
 function geodir_allow_post_type_frontend()
2541 2541
 {
2542
-    $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2542
+	$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2543 2543
 
2544
-    if (!is_admin() && isset($_REQUEST['listing_type'])
2545
-        && !empty($geodir_allow_posttype_frontend)
2546
-        && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2547
-    ) {
2544
+	if (!is_admin() && isset($_REQUEST['listing_type'])
2545
+		&& !empty($geodir_allow_posttype_frontend)
2546
+		&& !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2547
+	) {
2548 2548
 
2549
-        wp_redirect(home_url());
2550
-        exit;
2549
+		wp_redirect(home_url());
2550
+		exit;
2551 2551
 
2552
-    }
2552
+	}
2553 2553
 
2554 2554
 }
2555 2555
 
@@ -2566,20 +2566,20 @@  discard block
 block discarded – undo
2566 2566
  */
2567 2567
 function geodir_excerpt_length($length)
2568 2568
 {
2569
-    global $wp_query, $geodir_is_widget_listing;
2569
+	global $wp_query, $geodir_is_widget_listing;
2570 2570
 	if ($geodir_is_widget_listing) {
2571 2571
 		return $length;
2572 2572
 	}
2573 2573
 	
2574
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2575
-        $length = get_option('geodir_desc_word_limit');
2576
-    elseif (get_query_var('excerpt_length'))
2577
-        $length = get_query_var('excerpt_length');
2574
+	if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2575
+		$length = get_option('geodir_desc_word_limit');
2576
+	elseif (get_query_var('excerpt_length'))
2577
+		$length = get_query_var('excerpt_length');
2578 2578
 
2579
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2580
-        $length = get_option('geodir_author_desc_word_limit');
2579
+	if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2580
+		$length = get_option('geodir_author_desc_word_limit');
2581 2581
 
2582
-    return $length;
2582
+	return $length;
2583 2583
 }
2584 2584
 
2585 2585
 /**
@@ -2594,13 +2594,13 @@  discard block
 block discarded – undo
2594 2594
  */
2595 2595
 function geodir_excerpt_more($more)
2596 2596
 {
2597
-    global $post;
2598
-    $all_postypes = geodir_get_posttypes();
2599
-    if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2600
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2601
-    }
2597
+	global $post;
2598
+	$all_postypes = geodir_get_posttypes();
2599
+	if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2600
+		return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2601
+	}
2602 2602
 
2603
-    return $more;
2603
+	return $more;
2604 2604
 }
2605 2605
 
2606 2606
 
@@ -2617,63 +2617,63 @@  discard block
 block discarded – undo
2617 2617
  */
2618 2618
 function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)
2619 2619
 {
2620
-    global $plugin_prefix, $wpdb;
2620
+	global $plugin_prefix, $wpdb;
2621 2621
 
2622
-    $gd_taxonomies = geodir_get_taxonomies();
2622
+	$gd_taxonomies = geodir_get_taxonomies();
2623 2623
 
2624
-    if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2624
+	if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2625 2625
 
2626
-        $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2627
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2626
+		$geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2627
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
2628 2628
 
2629
-        $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2630
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2629
+		$path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2630
+		$term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2631 2631
 
2632
-        $posts = $wpdb->get_results(
2633
-            $wpdb->prepare(
2634
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2635
-                array($term_id, $taxonomy)
2636
-            )
2637
-        );
2632
+		$posts = $wpdb->get_results(
2633
+			$wpdb->prepare(
2634
+				"SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2635
+				array($term_id, $taxonomy)
2636
+			)
2637
+		);
2638 2638
 
2639
-        if (!empty($posts)):
2640
-            foreach ($posts as $post_obj) {
2639
+		if (!empty($posts)):
2640
+			foreach ($posts as $post_obj) {
2641 2641
 
2642
-                $lat = $post_obj->post_latitude;
2643
-                $lng = $post_obj->post_longitude;
2642
+				$lat = $post_obj->post_latitude;
2643
+				$lng = $post_obj->post_longitude;
2644 2644
 
2645
-                $json = '{';
2646
-                $json .= '"id":"' . $post_obj->post_id . '",';
2647
-                $json .= '"lat_pos": "' . $lat . '",';
2648
-                $json .= '"long_pos": "' . $lng . '",';
2649
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2650
-                $json .= '"icon":"' . $term_icon . '",';
2651
-                $json .= '"group":"catgroup' . $term_id . '"';
2652
-                $json .= '}';
2645
+				$json = '{';
2646
+				$json .= '"id":"' . $post_obj->post_id . '",';
2647
+				$json .= '"lat_pos": "' . $lat . '",';
2648
+				$json .= '"long_pos": "' . $lng . '",';
2649
+				$json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2650
+				$json .= '"icon":"' . $term_icon . '",';
2651
+				$json .= '"group":"catgroup' . $term_id . '"';
2652
+				$json .= '}';
2653 2653
 
2654
-                if ($post_obj->default_category == $term_id) {
2654
+				if ($post_obj->default_category == $term_id) {
2655 2655
 
2656
-                    $wpdb->query(
2657
-                        $wpdb->prepare(
2658
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2659
-                            array($json, $post_obj->post_id)
2660
-                        )
2661
-                    );
2662
-                }
2656
+					$wpdb->query(
2657
+						$wpdb->prepare(
2658
+							"UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2659
+							array($json, $post_obj->post_id)
2660
+						)
2661
+					);
2662
+				}
2663 2663
 
2664
-                $wpdb->query(
2665
-                    $wpdb->prepare(
2666
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2667
-                        array($json, $post_obj->post_id, $term_id)
2668
-                    )
2669
-                );
2664
+				$wpdb->query(
2665
+					$wpdb->prepare(
2666
+						"UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2667
+						array($json, $post_obj->post_id, $term_id)
2668
+					)
2669
+				);
2670 2670
 
2671
-            }
2671
+			}
2672 2672
 
2673 2673
 
2674
-        endif;
2674
+		endif;
2675 2675
 
2676
-    }
2676
+	}
2677 2677
 
2678 2678
 }
2679 2679
 
@@ -2687,14 +2687,14 @@  discard block
 block discarded – undo
2687 2687
  */
2688 2688
 function geodir_get_listing_author($listing_id = '')
2689 2689
 {
2690
-    if ($listing_id == '') {
2691
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2692
-            $listing_id = $_REQUEST['pid'];
2693
-        }
2694
-    }
2695
-    $listing = get_post(strip_tags($listing_id));
2696
-    $listing_author_id = $listing->post_author;
2697
-    return $listing_author_id;
2690
+	if ($listing_id == '') {
2691
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2692
+			$listing_id = $_REQUEST['pid'];
2693
+		}
2694
+	}
2695
+	$listing = get_post(strip_tags($listing_id));
2696
+	$listing_author_id = $listing->post_author;
2697
+	return $listing_author_id;
2698 2698
 }
2699 2699
 
2700 2700
 
@@ -2709,11 +2709,11 @@  discard block
 block discarded – undo
2709 2709
  */
2710 2710
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2711 2711
 {
2712
-    $listing_author_id = geodir_get_listing_author($listing_id);
2713
-    if ($listing_author_id == $user_id)
2714
-        return true;
2715
-    else
2716
-        return false;
2712
+	$listing_author_id = geodir_get_listing_author($listing_id);
2713
+	if ($listing_author_id == $user_id)
2714
+		return true;
2715
+	else
2716
+		return false;
2717 2717
 
2718 2718
 }
2719 2719
 
@@ -2729,17 +2729,17 @@  discard block
 block discarded – undo
2729 2729
  */
2730 2730
 function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true)
2731 2731
 {
2732
-    global $current_user;
2733
-    if ($exclude_admin) {
2734
-        foreach ($current_user->caps as $key => $caps) {
2735
-            if (geodir_strtolower($key) == 'administrator') {
2736
-                return true;
2737
-                break;
2738
-            }
2739
-        }
2740
-    }
2741
-
2742
-    return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2732
+	global $current_user;
2733
+	if ($exclude_admin) {
2734
+		foreach ($current_user->caps as $key => $caps) {
2735
+			if (geodir_strtolower($key) == 'administrator') {
2736
+				return true;
2737
+				break;
2738
+			}
2739
+		}
2740
+	}
2741
+
2742
+	return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2743 2743
 }
2744 2744
 
2745 2745
 
@@ -2755,17 +2755,17 @@  discard block
 block discarded – undo
2755 2755
 function geodir_only_supportable_attachments_remove($file)
2756 2756
 {
2757 2757
 
2758
-    global $wpdb;
2758
+	global $wpdb;
2759 2759
 
2760
-    $matches = array();
2760
+	$matches = array();
2761 2761
 
2762
-    $pattern = '/-\d+x\d+\./';
2763
-    preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2762
+	$pattern = '/-\d+x\d+\./';
2763
+	preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2764 2764
 
2765
-    if (empty($matches))
2766
-        return '';
2767
-    else
2768
-        return $file;
2765
+	if (empty($matches))
2766
+		return '';
2767
+	else
2768
+		return $file;
2769 2769
 
2770 2770
 }
2771 2771
 
@@ -2782,78 +2782,78 @@  discard block
 block discarded – undo
2782 2782
 function geodir_set_wp_featured_image($post_id)
2783 2783
 {
2784 2784
 
2785
-    global $wpdb, $plugin_prefix;
2786
-    $uploads = wp_upload_dir();
2785
+	global $wpdb, $plugin_prefix;
2786
+	$uploads = wp_upload_dir();
2787 2787
 //	print_r($uploads ) ;
2788
-    $post_first_image = $wpdb->get_results(
2789
-        $wpdb->prepare(
2790
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2791
-        )
2792
-    );
2788
+	$post_first_image = $wpdb->get_results(
2789
+		$wpdb->prepare(
2790
+			"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2791
+		)
2792
+	);
2793 2793
 
2794
-    $old_attachment_name = '';
2795
-    $post_thumbnail_id = '';
2796
-    if (has_post_thumbnail($post_id)) {
2794
+	$old_attachment_name = '';
2795
+	$post_thumbnail_id = '';
2796
+	if (has_post_thumbnail($post_id)) {
2797 2797
 
2798
-        if (has_post_thumbnail($post_id)) {
2798
+		if (has_post_thumbnail($post_id)) {
2799 2799
 
2800
-            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2800
+			$post_thumbnail_id = get_post_thumbnail_id($post_id);
2801 2801
 
2802
-            $old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2802
+			$old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2803 2803
 
2804
-        }
2805
-    }
2806
-
2807
-    if (!empty($post_first_image)) {
2804
+		}
2805
+	}
2808 2806
 
2809
-        $post_type = get_post_type($post_id);
2807
+	if (!empty($post_first_image)) {
2810 2808
 
2811
-        $table_name = $plugin_prefix . $post_type . '_detail';
2809
+		$post_type = get_post_type($post_id);
2812 2810
 
2813
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2811
+		$table_name = $plugin_prefix . $post_type . '_detail';
2814 2812
 
2815
-        $new_attachment_name = basename($post_first_image[0]->file);
2813
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2816 2814
 
2817
-        if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2815
+		$new_attachment_name = basename($post_first_image[0]->file);
2818 2816
 
2819
-            if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2817
+		if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2820 2818
 
2821
-                add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2819
+			if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2822 2820
 
2823
-                wp_delete_attachment($post_thumbnail_id);
2821
+				add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2824 2822
 
2825
-            }
2826
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2823
+				wp_delete_attachment($post_thumbnail_id);
2827 2824
 
2828
-            $attachment = array(
2829
-                'post_mime_type' => $post_first_image[0]->mime_type,
2830
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2831
-                'post_parent' => $post_id,
2832
-                'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2833
-                'post_content' => ''
2834
-            );
2825
+			}
2826
+			$filename = $uploads['basedir'] . $post_first_image[0]->file;
2827
+
2828
+			$attachment = array(
2829
+				'post_mime_type' => $post_first_image[0]->mime_type,
2830
+				'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2831
+				'post_parent' => $post_id,
2832
+				'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2833
+				'post_content' => ''
2834
+			);
2835 2835
 
2836 2836
 
2837
-            $id = wp_insert_attachment($attachment, $filename, $post_id);
2837
+			$id = wp_insert_attachment($attachment, $filename, $post_id);
2838 2838
 
2839
-            if (!is_wp_error($id)) {
2839
+			if (!is_wp_error($id)) {
2840 2840
 
2841
-                set_post_thumbnail($post_id, $id);
2841
+				set_post_thumbnail($post_id, $id);
2842 2842
 
2843
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2844
-                wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2843
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
2844
+				wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2845 2845
 
2846
-            }
2846
+			}
2847 2847
 
2848
-        }
2848
+		}
2849 2849
 
2850
-    } else {
2851
-        //set_post_thumbnail($post_id,-1);
2850
+	} else {
2851
+		//set_post_thumbnail($post_id,-1);
2852 2852
 
2853
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2854
-            wp_delete_attachment($post_thumbnail_id);
2853
+		if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2854
+			wp_delete_attachment($post_thumbnail_id);
2855 2855
 
2856
-    }
2856
+	}
2857 2857
 }
2858 2858
 
2859 2859
 
@@ -2868,53 +2868,53 @@  discard block
 block discarded – undo
2868 2868
  */
2869 2869
 function gd_copy_original_translation()
2870 2870
 {
2871
-    if (function_exists('icl_object_id')) {
2872
-        global $wpdb, $table_prefix, $plugin_prefix;
2873
-        $post_id = absint($_POST['post_id']);
2874
-        $upload_dir = wp_upload_dir();
2875
-        $post_type = get_post_type($_POST['post_id']);
2876
-        $table = $plugin_prefix . $post_type . '_detail';
2877
-
2878
-        $post_arr = $wpdb->get_results($wpdb->prepare(
2879
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2880
-            array($post_id)
2881
-        )
2882
-            , ARRAY_A);
2883
-
2884
-        $arrImages = $wpdb->get_results(
2885
-            $wpdb->prepare(
2886
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2887
-                array('%image%', $post_id)
2888
-            )
2889
-        );
2890
-        if ($arrImages) {
2891
-            $image_arr = array();
2892
-            foreach ($arrImages as $img) {
2893
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2894
-            }
2895
-            $comma_separated = implode(",", $image_arr);
2896
-            $post_arr[0]['post_images'] = $comma_separated;
2897
-        }
2898
-
2899
-
2900
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2901
-        $cat_arr = array_filter(explode(",", $cats));
2902
-        $trans_cat = array();
2903
-        foreach ($cat_arr as $cat) {
2904
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2905
-        }
2906
-
2907
-
2908
-        $post_arr[0]['categories'] = array_filter($trans_cat);
2871
+	if (function_exists('icl_object_id')) {
2872
+		global $wpdb, $table_prefix, $plugin_prefix;
2873
+		$post_id = absint($_POST['post_id']);
2874
+		$upload_dir = wp_upload_dir();
2875
+		$post_type = get_post_type($_POST['post_id']);
2876
+		$table = $plugin_prefix . $post_type . '_detail';
2877
+
2878
+		$post_arr = $wpdb->get_results($wpdb->prepare(
2879
+			"SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2880
+			array($post_id)
2881
+		)
2882
+			, ARRAY_A);
2883
+
2884
+		$arrImages = $wpdb->get_results(
2885
+			$wpdb->prepare(
2886
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2887
+				array('%image%', $post_id)
2888
+			)
2889
+		);
2890
+		if ($arrImages) {
2891
+			$image_arr = array();
2892
+			foreach ($arrImages as $img) {
2893
+				$image_arr[] = $upload_dir['baseurl'] . $img->file;
2894
+			}
2895
+			$comma_separated = implode(",", $image_arr);
2896
+			$post_arr[0]['post_images'] = $comma_separated;
2897
+		}
2898
+
2899
+
2900
+		$cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2901
+		$cat_arr = array_filter(explode(",", $cats));
2902
+		$trans_cat = array();
2903
+		foreach ($cat_arr as $cat) {
2904
+			$trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2905
+		}
2906
+
2907
+
2908
+		$post_arr[0]['categories'] = array_filter($trans_cat);
2909 2909
 //print_r($image_arr);
2910
-        //print_r($arrImages);
2911
-        //echo $_REQUEST['lang'];
2910
+		//print_r($arrImages);
2911
+		//echo $_REQUEST['lang'];
2912 2912
 //print_r($post_arr);
2913 2913
 //print_r($trans_cat);
2914
-        echo json_encode($post_arr[0]);
2914
+		echo json_encode($post_arr[0]);
2915 2915
 
2916
-    }
2917
-    die();
2916
+	}
2917
+	die();
2918 2918
 }
2919 2919
 
2920 2920
 
@@ -2934,54 +2934,54 @@  discard block
 block discarded – undo
2934 2934
 function geodir_get_custom_fields_type($listing_type = '')
2935 2935
 {
2936 2936
 
2937
-    global $wpdb;
2937
+	global $wpdb;
2938 2938
 
2939
-    if ($listing_type == '')
2940
-        $listing_type = 'gd_place';
2939
+	if ($listing_type == '')
2940
+		$listing_type = 'gd_place';
2941 2941
 
2942
-    $fields_info = array();
2942
+	$fields_info = array();
2943 2943
 
2944
-    $get_data = $wpdb->get_results(
2945
-        $wpdb->prepare(
2946
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2947
-            array($listing_type)
2948
-        )
2949
-    );
2944
+	$get_data = $wpdb->get_results(
2945
+		$wpdb->prepare(
2946
+			"SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2947
+			array($listing_type)
2948
+		)
2949
+	);
2950 2950
 
2951
-    if (!empty($get_data)) {
2951
+	if (!empty($get_data)) {
2952 2952
 
2953
-        foreach ($get_data as $data) {
2953
+		foreach ($get_data as $data) {
2954 2954
 
2955
-            if ($data->field_type == 'address') {
2955
+			if ($data->field_type == 'address') {
2956 2956
 
2957
-                $extra_fields = unserialize($data->extra_fields);
2957
+				$extra_fields = unserialize($data->extra_fields);
2958 2958
 
2959
-                $prefix = $data->htmlvar_name . '_';
2959
+				$prefix = $data->htmlvar_name . '_';
2960 2960
 
2961
-                $fields_info[$prefix . 'address'] = $data->field_type;
2961
+				$fields_info[$prefix . 'address'] = $data->field_type;
2962 2962
 
2963
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2964
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2963
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2964
+					$fields_info[$prefix . 'zip'] = $data->field_type;
2965 2965
 
2966
-            } else {
2966
+			} else {
2967 2967
 
2968
-                $fields_info[$data->htmlvar_name] = $data->field_type;
2968
+				$fields_info[$data->htmlvar_name] = $data->field_type;
2969 2969
 
2970
-            }
2970
+			}
2971 2971
 
2972
-        }
2972
+		}
2973 2973
 
2974
-    }
2974
+	}
2975 2975
 
2976
-    /**
2977
-     * Filter to modify custom fields info using listing post type.
2978
-     *
2979
-     * @since 1.0.0
2980
-     * @package GeoDirectory
2981
-     * @return array $fields_info Custom fields info.
2982
-     * @param string $listing_type The listing post type.
2983
-     */
2984
-    return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2976
+	/**
2977
+	 * Filter to modify custom fields info using listing post type.
2978
+	 *
2979
+	 * @since 1.0.0
2980
+	 * @package GeoDirectory
2981
+	 * @return array $fields_info Custom fields info.
2982
+	 * @param string $listing_type The listing post type.
2983
+	 */
2984
+	return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2985 2985
 }
2986 2986
 
2987 2987
 
@@ -2996,58 +2996,58 @@  discard block
 block discarded – undo
2996 2996
  */
2997 2997
 function geodir_function_post_updated($post_ID, $post_after, $post_before)
2998 2998
 {
2999
-    $post_type = get_post_type($post_ID);
2999
+	$post_type = get_post_type($post_ID);
3000 3000
 
3001
-    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3002
-        // send notification to client when post moves from draft to publish
3003
-        if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3004
-            $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3005
-            $post_author_data = get_userdata($post_author_id);
3001
+	if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3002
+		// send notification to client when post moves from draft to publish
3003
+		if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3004
+			$post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3005
+			$post_author_data = get_userdata($post_author_id);
3006 3006
 
3007
-            $to_name = geodir_get_client_name($post_author_id);
3007
+			$to_name = geodir_get_client_name($post_author_id);
3008 3008
 
3009
-            $from_email = geodir_get_site_email_id();
3010
-            $from_name = get_site_emailName();
3011
-            $to_email = $post_author_data->user_email;
3009
+			$from_email = geodir_get_site_email_id();
3010
+			$from_name = get_site_emailName();
3011
+			$to_email = $post_author_data->user_email;
3012 3012
 
3013
-            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3014
-                $to_email = $post_author_data->user_email;
3015
-            }
3013
+			if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3014
+				$to_email = $post_author_data->user_email;
3015
+			}
3016 3016
 
3017
-            $message_type = 'listing_published';
3017
+			$message_type = 'listing_published';
3018 3018
 
3019
-            if (get_option('geodir_post_published_email_subject') == '') {
3020
-                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3021
-            }
3019
+			if (get_option('geodir_post_published_email_subject') == '') {
3020
+				update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3021
+			}
3022 3022
 
3023
-            if (get_option('geodir_post_published_email_content') == '') {
3024
-                update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3025
-            }
3023
+			if (get_option('geodir_post_published_email_content') == '') {
3024
+				update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3025
+			}
3026 3026
 
3027
-            /**
3028
-             * Called before sending the email when listing gets published.
3029
-             *
3030
-             * @since 1.0.0
3031
-             * @package GeoDirectory
3032
-             * @param object $post_after The post object after update.
3033
-             * @param object $post_before The post object before update.
3034
-             */
3035
-            do_action('geodir_before_listing_published_email', $post_after, $post_before);
3036
-            if (is_email($to_email)) {
3037
-                geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3038
-            }
3027
+			/**
3028
+			 * Called before sending the email when listing gets published.
3029
+			 *
3030
+			 * @since 1.0.0
3031
+			 * @package GeoDirectory
3032
+			 * @param object $post_after The post object after update.
3033
+			 * @param object $post_before The post object before update.
3034
+			 */
3035
+			do_action('geodir_before_listing_published_email', $post_after, $post_before);
3036
+			if (is_email($to_email)) {
3037
+				geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3038
+			}
3039 3039
 
3040
-            /**
3041
-             * Called after sending the email when listing gets published.
3042
-             *
3043
-             * @since 1.0.0
3044
-             * @package GeoDirectory
3045
-             * @param object $post_after The post object after update.
3046
-             * @param object $post_before The post object before update.
3047
-             */
3048
-            do_action('geodir_after_listing_published_email', $post_after, $post_before);
3049
-        }
3050
-    }
3040
+			/**
3041
+			 * Called after sending the email when listing gets published.
3042
+			 *
3043
+			 * @since 1.0.0
3044
+			 * @package GeoDirectory
3045
+			 * @param object $post_after The post object after update.
3046
+			 * @param object $post_before The post object before update.
3047
+			 */
3048
+			do_action('geodir_after_listing_published_email', $post_after, $post_before);
3049
+		}
3050
+	}
3051 3051
 }
3052 3052
 
3053 3053
 add_action('wp_head', 'geodir_fb_like_thumbnail');
@@ -3061,14 +3061,14 @@  discard block
 block discarded – undo
3061 3061
  */
3062 3062
 function geodir_fb_like_thumbnail(){
3063 3063
 
3064
-    // return if not a single post
3065
-    if(!is_single()){return;}
3064
+	// return if not a single post
3065
+	if(!is_single()){return;}
3066 3066
 
3067
-    global $post;
3068
-    if(isset($post->featured_image) && $post->featured_image){
3069
-        $upload_dir = wp_upload_dir();
3070
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3071
-        echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3067
+	global $post;
3068
+	if(isset($post->featured_image) && $post->featured_image){
3069
+		$upload_dir = wp_upload_dir();
3070
+		$thumb = $upload_dir['baseurl'].$post->featured_image;
3071
+		echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3072 3072
 
3073
-    }
3073
+	}
3074 3074
 }
3075 3075
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_template_tags.php 1 patch
Indentation   +344 added lines, -344 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function geodir_core_dequeue_script()
24 24
 {
25
-    wp_dequeue_script('flexslider');
25
+	wp_dequeue_script('flexslider');
26 26
 }
27 27
 
28 28
 add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100);
@@ -35,159 +35,159 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
39
-    $geodir_map_name = geodir_map_name();
40
-
41
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
-        $is_detail_page = true;
43
-    }
44
-
45
-    wp_enqueue_script('jquery');
46
-
47
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
48
-    wp_enqueue_script('geodirectory-script');
49
-
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
-        'geodir_ajax_url' => geodir_get_ajax_url(),
55
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
-    );
58
-
59
-    /**
60
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
-     *
62
-     * This is used by addons to add JS translatable variables.
63
-     *
64
-     * @since 1.4.4
65
-     * @param array $geodir_vars_data {
66
-     *    geodir var data used by addons to add JS translatable variables.
67
-     *
68
-     *    @type string $siteurl Site url.
69
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
-     *    @type int $is_rtl Checks if current locale is RTL.
73
-     *
74
-     * }
75
-     */
76
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
-
78
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
-
80
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
-
83
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    wp_enqueue_script('geodirectory-lightbox-jquery');
85
-
86
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
-    if ($is_detail_page) {
88
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
89
-    }
90
-
91
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
92
-        $map_lang = "&language=" . geodir_get_map_default_language();
93
-        /**
94
-         * Filter the variables that are added to the end of the google maps script call.
95
-         *
96
-         * This i used to change things like google maps language etc.
97
-         *
98
-         * @since 1.0.0
99
-         * @param string $var The string to filter, default is empty string.
100
-         */
101
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
102
-        wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
103
-    }
38
+	$is_detail_page = false;
39
+	$geodir_map_name = geodir_map_name();
40
+
41
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+		$is_detail_page = true;
43
+	}
44
+
45
+	wp_enqueue_script('jquery');
46
+
47
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
48
+	wp_enqueue_script('geodirectory-script');
49
+
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+		'geodir_ajax_url' => geodir_get_ajax_url(),
55
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
+	);
58
+
59
+	/**
60
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
+	 *
62
+	 * This is used by addons to add JS translatable variables.
63
+	 *
64
+	 * @since 1.4.4
65
+	 * @param array $geodir_vars_data {
66
+	 *    geodir var data used by addons to add JS translatable variables.
67
+	 *
68
+	 *    @type string $siteurl Site url.
69
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
+	 *    @type int $is_rtl Checks if current locale is RTL.
73
+	 *
74
+	 * }
75
+	 */
76
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
+
78
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
+
80
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+
83
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
+	wp_enqueue_script('geodirectory-lightbox-jquery');
85
+
86
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
+	if ($is_detail_page) {
88
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
89
+	}
90
+
91
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
92
+		$map_lang = "&language=" . geodir_get_map_default_language();
93
+		/**
94
+		 * Filter the variables that are added to the end of the google maps script call.
95
+		 *
96
+		 * This i used to change things like google maps language etc.
97
+		 *
98
+		 * @since 1.0.0
99
+		 * @param string $var The string to filter, default is empty string.
100
+		 */
101
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
102
+		wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
103
+	}
104 104
     
105
-    if ($geodir_map_name == 'osm') {
106
-        // Leaflet OpenStreetMap
107
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
108
-        wp_enqueue_style('geodirectory-leaflet-style');
105
+	if ($geodir_map_name == 'osm') {
106
+		// Leaflet OpenStreetMap
107
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
108
+		wp_enqueue_style('geodirectory-leaflet-style');
109 109
             
110
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
111
-        wp_enqueue_script('geodirectory-leaflet-script');
110
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
111
+		wp_enqueue_script('geodirectory-leaflet-script');
112 112
         
113
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
114
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
115
-    }
116
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
113
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
114
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
115
+	}
116
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
117 117
     
118
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
119
-    wp_enqueue_script('geodirectory-goMap-script');
120
-
121
-
122
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
123
-    wp_enqueue_script('chosen');
124
-
125
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
126
-    wp_enqueue_script('geodirectory-choose-ajax');
127
-
128
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
129
-
130
-    if (is_page() && geodir_is_page('add-listing')) {
131
-        // SCRIPT FOR UPLOAD
132
-        wp_enqueue_script('plupload-all');
133
-        wp_enqueue_script('jquery-ui-sortable');
134
-
135
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
136
-        wp_enqueue_script('geodirectory-plupload-script');
137
-        // SCRIPT FOR UPLOAD END
138
-
139
-        // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
140
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
141
-            $ajax_url = admin_url('admin-ajax.php');
142
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
143
-            $ajax_url = admin_url('admin-ajax.php');
144
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
145
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
146
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
147
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
148
-        } else {
149
-            $ajax_url = admin_url('admin-ajax.php');
150
-        }
118
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
119
+	wp_enqueue_script('geodirectory-goMap-script');
120
+
121
+
122
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
123
+	wp_enqueue_script('chosen');
124
+
125
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
126
+	wp_enqueue_script('geodirectory-choose-ajax');
127
+
128
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
129
+
130
+	if (is_page() && geodir_is_page('add-listing')) {
131
+		// SCRIPT FOR UPLOAD
132
+		wp_enqueue_script('plupload-all');
133
+		wp_enqueue_script('jquery-ui-sortable');
134
+
135
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
136
+		wp_enqueue_script('geodirectory-plupload-script');
137
+		// SCRIPT FOR UPLOAD END
138
+
139
+		// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
140
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
141
+			$ajax_url = admin_url('admin-ajax.php');
142
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
143
+			$ajax_url = admin_url('admin-ajax.php');
144
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
145
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
146
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
147
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
148
+		} else {
149
+			$ajax_url = admin_url('admin-ajax.php');
150
+		}
151 151
 
152
-        // place js config array for plupload
153
-        $plupload_init = array(
154
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
155
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
156
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
157
-            'drop_element' => 'dropbox', // will be adjusted per uploader
158
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
159
-            'multiple_queues' => true,
160
-            'max_file_size' => geodir_max_upload_size(),
161
-            'url' => $ajax_url,
162
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
163
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
164
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
165
-            'multipart' => true,
166
-            'urlstream_upload' => true,
167
-            'multi_selection' => false, // will be added per uploader
168
-            // additional post data to send to our ajax hook
169
-            'multipart_params' => array(
170
-                '_ajax_nonce' => "", // will be added per uploader
171
-                'action' => 'plupload_action', // the ajax action name
172
-                'imgid' => 0 // will be added per uploader
173
-            )
174
-        );
175
-        $base_plupload_config = json_encode($plupload_init);
176
-
177
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
178
-            'upload_img_size' => geodir_max_upload_size());
179
-
180
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
181
-
182
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
183
-    } // End if for add place page
184
-
185
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
186
-    if ($is_detail_page) {
152
+		// place js config array for plupload
153
+		$plupload_init = array(
154
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
155
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
156
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
157
+			'drop_element' => 'dropbox', // will be adjusted per uploader
158
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
159
+			'multiple_queues' => true,
160
+			'max_file_size' => geodir_max_upload_size(),
161
+			'url' => $ajax_url,
162
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
163
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
164
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
165
+			'multipart' => true,
166
+			'urlstream_upload' => true,
167
+			'multi_selection' => false, // will be added per uploader
168
+			// additional post data to send to our ajax hook
169
+			'multipart_params' => array(
170
+				'_ajax_nonce' => "", // will be added per uploader
171
+				'action' => 'plupload_action', // the ajax action name
172
+				'imgid' => 0 // will be added per uploader
173
+			)
174
+		);
175
+		$base_plupload_config = json_encode($plupload_init);
176
+
177
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
178
+			'upload_img_size' => geodir_max_upload_size());
179
+
180
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
181
+
182
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
183
+	} // End if for add place page
184
+
185
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
186
+	if ($is_detail_page) {
187 187
 		wp_enqueue_script('geodirectory-post-custom-js');
188 188
 	}
189 189
 
190
-    // font awesome rating script
190
+	// font awesome rating script
191 191
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
192 192
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
193 193
 		wp_enqueue_script('geodir-barrating-js');
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 		wp_enqueue_script('geodir-jRating-js');
197 197
 	}
198 198
 
199
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
200
-    wp_enqueue_script('geodir-on-document-load');
199
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
200
+	wp_enqueue_script('geodir-on-document-load');
201 201
 
202
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
-    wp_enqueue_script('google-geometa');
202
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
+	wp_enqueue_script('google-geometa');
204 204
 }
205 205
 
206 206
 /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
  */
215 215
 function geodir_header_scripts()
216 216
 {
217
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
218
-    echo stripslashes(get_option('geodir_header_scripts'));
217
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
218
+	echo stripslashes(get_option('geodir_header_scripts'));
219 219
 }
220 220
 
221 221
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 function geodir_footer_scripts()
232 232
 {	
233 233
 	echo stripslashes(get_option('geodir_ga_tracking_code'));
234
-    echo stripslashes(get_option('geodir_footer_scripts'));
234
+	echo stripslashes(get_option('geodir_footer_scripts'));
235 235
 }
236 236
 
237 237
 
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
249
-        return $url;
250
-    else if (is_admin())
251
-        return str_replace('#asyncload', '', $url);
252
-    else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
248
+	if (strpos($url, '#asyncload')===false)
249
+		return $url;
250
+	else if (is_admin())
251
+		return str_replace('#asyncload', '', $url);
252
+	else
253
+		return str_replace('#asyncload', '', $url)."' async='async";
254 254
 }
255 255
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 256
 
@@ -264,55 +264,55 @@  discard block
 block discarded – undo
264 264
 {
265 265
 
266 266
 
267
-    if(get_option('geodir_scss_core')) {
267
+	if(get_option('geodir_scss_core')) {
268 268
 
269 269
 
270
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
271
-        wp_enqueue_style('geodirectory-frontend-style');
270
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
271
+		wp_enqueue_style('geodirectory-frontend-style');
272 272
 
273
-        wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
274
-        wp_enqueue_style('geodirectory-media-style');
273
+		wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
274
+		wp_enqueue_style('geodirectory-media-style');
275 275
 
276 276
 
277
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
278
-        wp_enqueue_style('geodirectory-jquery-ui-css');
277
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
278
+		wp_enqueue_style('geodirectory-jquery-ui-css');
279 279
 
280
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
281
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
280
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
281
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
282 282
 
283
-        wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
284
-        wp_enqueue_style('geodirectory-flexslider-css');
283
+		wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
284
+		wp_enqueue_style('geodirectory-flexslider-css');
285 285
 
286
-        wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
287
-        wp_enqueue_style('geodirectory-thic-box-css');
286
+		wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
287
+		wp_enqueue_style('geodirectory-thic-box-css');
288 288
 
289
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
290
-        wp_enqueue_style('geodirectory-pluplodar-css');
289
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
290
+		wp_enqueue_style('geodirectory-pluplodar-css');
291 291
 
292
-        wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
293
-        wp_enqueue_style('geodirectory-lightbox-css');
292
+		wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
293
+		wp_enqueue_style('geodirectory-lightbox-css');
294 294
 
295
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
296
-        wp_enqueue_style('geodir-rating-style');
295
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
296
+		wp_enqueue_style('geodir-rating-style');
297 297
 
298
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299
-        wp_enqueue_style('geodir-chosen-style');
298
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299
+		wp_enqueue_style('geodir-chosen-style');
300 300
 
301
-    }else{
302
-        wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303
-        wp_enqueue_style('geodir-core-scss');
301
+	}else{
302
+		wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303
+		wp_enqueue_style('geodir-core-scss');
304 304
 
305
-        wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
305
+		wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
306 306
 
307
-    }
307
+	}
308 308
 
309
-    if(is_rtl()){
310
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
311
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
312
-    }
309
+	if(is_rtl()){
310
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
311
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
312
+	}
313 313
 
314
-    wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
315
-    wp_enqueue_style('geodirectory-font-awesome');
314
+	wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
315
+	wp_enqueue_style('geodirectory-font-awesome');
316 316
 
317 317
 
318 318
 }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function geodir_get_sidebar()
328 328
 {
329
-    get_sidebar('geodirectory');
329
+	get_sidebar('geodirectory');
330 330
 }
331 331
 
332 332
 /**
@@ -345,122 +345,122 @@  discard block
 block discarded – undo
345 345
  * @param bool $always_show Do you want to show the pagination always? Default: false.
346 346
  */
347 347
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
348
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
348
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
349 349
 
350
-    if (empty($prelabel)) {
351
-        $prelabel = '<strong>&laquo;</strong>';
352
-    }
350
+	if (empty($prelabel)) {
351
+		$prelabel = '<strong>&laquo;</strong>';
352
+	}
353 353
 
354
-    if (empty($nxtlabel)) {
355
-        $nxtlabel = '<strong>&raquo;</strong>';
356
-    }
354
+	if (empty($nxtlabel)) {
355
+		$nxtlabel = '<strong>&raquo;</strong>';
356
+	}
357 357
 
358
-    $half_pages_to_show = round($pages_to_show / 2);
358
+	$half_pages_to_show = round($pages_to_show / 2);
359 359
 
360
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
361
-        return;
360
+	if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
361
+		return;
362 362
 
363
-    if (!is_single()) {
364
-        if (function_exists('geodir_location_geo_home_link')) {
365
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
366
-        }
367
-        $numposts = $wp_query->found_posts;
363
+	if (!is_single()) {
364
+		if (function_exists('geodir_location_geo_home_link')) {
365
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
366
+		}
367
+		$numposts = $wp_query->found_posts;
368 368
 
369
-        $max_page = ceil($numposts / $posts_per_page);
369
+		$max_page = ceil($numposts / $posts_per_page);
370 370
 
371
-        if (empty($paged)) {
372
-            $paged = 1;
373
-        }
371
+		if (empty($paged)) {
372
+			$paged = 1;
373
+		}
374 374
         
375
-        $post_type = geodir_get_current_posttype();
376
-        $listing_type_name = get_post_type_plural_label($post_type);
377
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
378
-            $term = array();
375
+		$post_type = geodir_get_current_posttype();
376
+		$listing_type_name = get_post_type_plural_label($post_type);
377
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
378
+			$term = array();
379 379
             
380
-            if (is_tax()) {
381
-                $term_id = get_queried_object_id();
382
-                $taxonomy = get_query_var('taxonomy');
380
+			if (is_tax()) {
381
+				$term_id = get_queried_object_id();
382
+				$taxonomy = get_query_var('taxonomy');
383 383
 
384
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
385
-                    $term = get_term($term_id, $post_type . 'category');
386
-                }
387
-            }
384
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
385
+					$term = get_term($term_id, $post_type . 'category');
386
+				}
387
+			}
388 388
             
389
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
390
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
389
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
390
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
391 391
                 
392
-                if (!is_array($taxonomy_search)) {
393
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
394
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
395
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
396
-                }
397
-            }
392
+				if (!is_array($taxonomy_search)) {
393
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
394
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
395
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
396
+				}
397
+			}
398 398
             
399
-            if (!empty($term) && !is_wp_error($term)) {
400
-                $listing_type_name = $term->name;
401
-            }
402
-        }
399
+			if (!empty($term) && !is_wp_error($term)) {
400
+				$listing_type_name = $term->name;
401
+			}
402
+		}
403 403
 
404
-        if ($max_page > 1 || $always_show) {            
405
-            // Extra pagination info
406
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
407
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
408
-            $end_no = min($paged * $posts_per_page, $numposts);
404
+		if ($max_page > 1 || $always_show) {            
405
+			// Extra pagination info
406
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
407
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
408
+			$end_no = min($paged * $posts_per_page, $numposts);
409 409
 
410
-            if ($geodir_pagination_more_info != '') {
411
-                if ($listing_type_name) {
412
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
413
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
414
-                } else {
415
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
416
-                }
417
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
418
-                /**
419
-                 * Adds an extra pagination info above/under pagination.
420
-                 *
421
-                 * @since 1.5.9
422
-                 *
423
-                 * @param string $pagination_info Extra pagination info content.
424
-                 * @param string $listing_type_name Listing results type.
425
-                 * @param string $start_no First result number.
426
-                 * @param string $end_no Last result number.
427
-                 * @param string $numposts Total number of listings.
428
-                 * @param string $post_type The post type.
429
-                 */
430
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
410
+			if ($geodir_pagination_more_info != '') {
411
+				if ($listing_type_name) {
412
+					$listing_type_name = __($listing_type_name, 'geodirectory');
413
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
414
+				} else {
415
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
416
+				}
417
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
418
+				/**
419
+				 * Adds an extra pagination info above/under pagination.
420
+				 *
421
+				 * @since 1.5.9
422
+				 *
423
+				 * @param string $pagination_info Extra pagination info content.
424
+				 * @param string $listing_type_name Listing results type.
425
+				 * @param string $start_no First result number.
426
+				 * @param string $end_no Last result number.
427
+				 * @param string $numposts Total number of listings.
428
+				 * @param string $post_type The post type.
429
+				 */
430
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
431 431
                 
432
-                if ($geodir_pagination_more_info == 'before') {
433
-                    $before = $before . $pagination_info;
434
-                } else if ($geodir_pagination_more_info == 'after') {
435
-                    $after = $pagination_info . $after;
436
-                }
437
-            }
432
+				if ($geodir_pagination_more_info == 'before') {
433
+					$before = $before . $pagination_info;
434
+				} else if ($geodir_pagination_more_info == 'after') {
435
+					$after = $pagination_info . $after;
436
+				}
437
+			}
438 438
             
439
-            echo "$before <div class='Navi gd-navi'>";
440
-            if ($paged >= ($pages_to_show - 1)) {
441
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
442
-            }
443
-            previous_posts_link($prelabel);
444
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
445
-                if ($i >= 1 && $i <= $max_page) {
446
-                    if ($i == $paged) {
447
-                        echo "<strong class='on'>$i</strong>";
448
-                    } else {
449
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
450
-                    }
451
-                }
452
-            }
453
-            next_posts_link($nxtlabel, $max_page);
454
-            if (($paged + $half_pages_to_show) < ($max_page)) {
455
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
456
-            }
457
-            echo "</div> $after";
458
-        }
439
+			echo "$before <div class='Navi gd-navi'>";
440
+			if ($paged >= ($pages_to_show - 1)) {
441
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
442
+			}
443
+			previous_posts_link($prelabel);
444
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
445
+				if ($i >= 1 && $i <= $max_page) {
446
+					if ($i == $paged) {
447
+						echo "<strong class='on'>$i</strong>";
448
+					} else {
449
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
450
+					}
451
+				}
452
+			}
453
+			next_posts_link($nxtlabel, $max_page);
454
+			if (($paged + $half_pages_to_show) < ($max_page)) {
455
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
456
+			}
457
+			echo "</div> $after";
458
+		}
459 459
         
460
-        if (function_exists('geodir_location_geo_home_link')) {
461
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
462
-        }
463
-    }
460
+		if (function_exists('geodir_location_geo_home_link')) {
461
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
462
+		}
463
+	}
464 464
 }
465 465
 
466 466
 /**
@@ -471,20 +471,20 @@  discard block
 block discarded – undo
471 471
  */
472 472
 function geodir_listingsearch_scripts()
473 473
 {
474
-    if (get_option('gd_search_dist') != '') {
475
-        $dist = get_option('gd_search_dist');
476
-    } else {
477
-        $dist = 500;
478
-    }
479
-    $dist_dif = 1000;
480
-
481
-    if ($dist <= 5000) $dist_dif = 500;
482
-    if ($dist <= 1000) $dist_dif = 100;
483
-    if ($dist <= 500) $dist_dif = 50;
484
-    if ($dist <= 100) $dist_dif = 10;
485
-    if ($dist <= 50) $dist_dif = 5;
486
-
487
-    ?>
474
+	if (get_option('gd_search_dist') != '') {
475
+		$dist = get_option('gd_search_dist');
476
+	} else {
477
+		$dist = 500;
478
+	}
479
+	$dist_dif = 1000;
480
+
481
+	if ($dist <= 5000) $dist_dif = 500;
482
+	if ($dist <= 1000) $dist_dif = 100;
483
+	if ($dist <= 500) $dist_dif = 50;
484
+	if ($dist <= 100) $dist_dif = 10;
485
+	if ($dist <= 50) $dist_dif = 5;
486
+
487
+	?>
488 488
     <script type="text/javascript">
489 489
 
490 490
         jQuery(function ($) {
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 function geodir_add_sharelocation_scripts()
544 544
 {
545 545
 
546
-    $default_search_for_text = SEARCH_FOR_TEXT;
547
-    if (get_option('geodir_search_field_default_text'))
548
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
546
+	$default_search_for_text = SEARCH_FOR_TEXT;
547
+	if (get_option('geodir_search_field_default_text'))
548
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
549 549
 
550
-    $default_near_text = NEAR_TEXT;
551
-    if (get_option('geodir_near_field_default_text'))
552
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
550
+	$default_near_text = NEAR_TEXT;
551
+	if (get_option('geodir_near_field_default_text'))
552
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
553 553
 
554
-    ?>
554
+	?>
555 555
 
556 556
 
557 557
     <script type="text/javascript">
@@ -632,14 +632,14 @@  discard block
 block discarded – undo
632 632
                     initialise2();
633 633
                 } else {
634 634
                     <?php
635
-                    $near_add = get_option('geodir_search_near_addition');
636
-                    /**
637
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
638
-                     *
639
-                     * @since 1.0.0
640
-                     */
641
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
642
-                    ?>
635
+					$near_add = get_option('geodir_search_near_addition');
636
+					/**
637
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
638
+					 *
639
+					 * @since 1.0.0
640
+					 */
641
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
642
+					?>
643 643
                     if (window.gdMaps === 'google') {
644 644
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
645 645
                             function (results, status) {
@@ -742,30 +742,30 @@  discard block
 block discarded – undo
742 742
  */
743 743
 function geodir_show_badges_on_image($which, $post, $link)
744 744
 {
745
-    $return = '';
746
-    switch ($which) {
747
-        case 'featured':
748
-            /**
749
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
750
-             *
751
-             * @since 1.0.0
752
-             * @param object $post The post object.
753
-             * @param string $link The link to the post.
754
-             */
755
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
756
-            break;
757
-        case 'new' :
758
-            /**
759
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
760
-             *
761
-             * @since 1.0.0
762
-             * @param object $post The post object.
763
-             * @param string $link The link to the post.
764
-             */
765
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
766
-            break;
767
-
768
-    }
745
+	$return = '';
746
+	switch ($which) {
747
+		case 'featured':
748
+			/**
749
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
750
+			 *
751
+			 * @since 1.0.0
752
+			 * @param object $post The post object.
753
+			 * @param string $link The link to the post.
754
+			 */
755
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
756
+			break;
757
+		case 'new' :
758
+			/**
759
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
760
+			 *
761
+			 * @since 1.0.0
762
+			 * @param object $post The post object.
763
+			 * @param string $link The link to the post.
764
+			 */
765
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
766
+			break;
767
+
768
+	}
769 769
     
770
-    return $return;
770
+	return $return;
771 771
 }
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 1 patch
Indentation   +1480 added lines, -1480 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,32 +335,32 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_share_this_button',
351
-                'geodir_detail_page_google_analytics',
352
-                'geodir_edit_post_link',
353
-                //'geodir_detail_page_review_rating',
354
-                'geodir_detail_page_more_info'
355
-            ) // end of array 
356
-        ); // end of apply filter
357
-    if (!empty($arr_detail_page_sidebar_content)) {
358
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
359
-            if (function_exists($content_function)) {
360
-                add_action('geodir_detail_page_sidebar', $content_function);
361
-            }
362
-        }
363
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_share_this_button',
351
+				'geodir_detail_page_google_analytics',
352
+				'geodir_edit_post_link',
353
+				//'geodir_detail_page_review_rating',
354
+				'geodir_detail_page_more_info'
355
+			) // end of array 
356
+		); // end of apply filter
357
+	if (!empty($arr_detail_page_sidebar_content)) {
358
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
359
+			if (function_exists($content_function)) {
360
+				add_action('geodir_detail_page_sidebar', $content_function);
361
+			}
362
+		}
363
+	}
364 364
 }
365 365
 
366 366
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function geodir_add_to_favourite_link()
377 377
 {
378
-    global $post, $preview;
379
-    if (!$preview && geodir_is_page('detail')) {
380
-        ?>
378
+	global $post, $preview;
379
+	if (!$preview && geodir_is_page('detail')) {
380
+		?>
381 381
         <p class="edit_link">
382 382
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
383 383
         </p>
384 384
     <?php
385
-    }
385
+	}
386 386
 }
387 387
 
388 388
 /**
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function geodir_social_sharing_buttons()
398 398
 {
399
-    global $preview;
400
-    ob_start(); // Start  buffering;
401
-    /**
402
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
-     *
404
-     * @since 1.0.0
405
-     */
406
-    do_action('geodir_before_social_sharing_buttons');
407
-    if (!$preview) {
408
-        ?>
399
+	global $preview;
400
+	ob_start(); // Start  buffering;
401
+	/**
402
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
+	 *
404
+	 * @since 1.0.0
405
+	 */
406
+	do_action('geodir_before_social_sharing_buttons');
407
+	if (!$preview) {
408
+		?>
409 409
         <div class="likethis">
410 410
             <?php geodir_twitter_tweet_button(); ?>
411 411
             <?php geodir_fb_like_button(); ?>
412 412
             <?php geodir_google_plus_button(); ?>
413 413
         </div>
414 414
     <?php
415
-    }// end of if, if its a preview or not
416
-
417
-    /**
418
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
-     *
420
-     * @since 1.0.0
421
-     */
422
-    do_action('geodir_after_social_sharing_buttons');
423
-    $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
-        /**
428
-         * Filter the geodir_social_sharing_buttons() function content.
429
-         *
430
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
-         */
432
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
-    }
415
+	}// end of if, if its a preview or not
416
+
417
+	/**
418
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
+	 *
420
+	 * @since 1.0.0
421
+	 */
422
+	do_action('geodir_after_social_sharing_buttons');
423
+	$content_html = ob_get_clean();
424
+	if (trim($content_html) != '')
425
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
+		/**
428
+		 * Filter the geodir_social_sharing_buttons() function content.
429
+		 *
430
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
+		 */
432
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
+	}
434 434
 
435 435
 
436 436
 }
@@ -446,39 +446,39 @@  discard block
 block discarded – undo
446 446
  */
447 447
 function geodir_share_this_button()
448 448
 {
449
-    global $preview;
450
-    ob_start(); // Start buffering;
451
-    /**
452
-     * This is called before the share this html in the function geodir_share_this_button()
453
-     *
454
-     * @since 1.0.0
455
-     */
456
-    do_action('geodir_before_share_this_button');
457
-    if (!$preview) {
458
-        ?>
449
+	global $preview;
450
+	ob_start(); // Start buffering;
451
+	/**
452
+	 * This is called before the share this html in the function geodir_share_this_button()
453
+	 *
454
+	 * @since 1.0.0
455
+	 */
456
+	do_action('geodir_before_share_this_button');
457
+	if (!$preview) {
458
+		?>
459 459
         <div class="share clearfix">
460 460
             <?php geodir_share_this_button_code(); ?>
461 461
         </div>
462 462
     <?php
463
-    }// end of if, if its a preview or not
464
-    /**
465
-     * This is called after the share this html in the function geodir_share_this_button()
466
-     *
467
-     * @since 1.0.0
468
-     */
469
-    do_action('geodir_after_share_this_button');
470
-    $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
-        /**
475
-         * Filter the geodir_share_this_button() function content.
476
-         *
477
-         * @param string $content_html The output html of the geodir_share_this_button() function.
478
-         * @since 1.0.0
479
-         */
480
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
-    }
463
+	}// end of if, if its a preview or not
464
+	/**
465
+	 * This is called after the share this html in the function geodir_share_this_button()
466
+	 *
467
+	 * @since 1.0.0
468
+	 */
469
+	do_action('geodir_after_share_this_button');
470
+	$content_html = ob_get_clean();
471
+	if (trim($content_html) != '')
472
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
+		/**
475
+		 * Filter the geodir_share_this_button() function content.
476
+		 *
477
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
478
+		 * @since 1.0.0
479
+		 */
480
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
+	}
482 482
 
483 483
 }
484 484
 
@@ -494,46 +494,46 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_edit_post_link()
496 496
 {
497
-    global $post, $preview;
498
-    ob_start(); // Start buffering;
499
-    /**
500
-     * This is called before the edit post link html in the function geodir_edit_post_link()
501
-     *
502
-     * @since 1.0.0
503
-     */
504
-    do_action('geodir_before_edit_post_link');
505
-    if (!$preview) {
506
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
497
+	global $post, $preview;
498
+	ob_start(); // Start buffering;
499
+	/**
500
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
501
+	 *
502
+	 * @since 1.0.0
503
+	 */
504
+	do_action('geodir_before_edit_post_link');
505
+	if (!$preview) {
506
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
507 507
         
508
-        if ($is_current_user_owner) {
509
-            $post_id = $post->ID;
508
+		if ($is_current_user_owner) {
509
+			$post_id = $post->ID;
510 510
             
511
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
513
-            }
511
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
+				$post_id = (int)$_REQUEST['pid'];
513
+			}
514 514
 
515
-            $postlink = get_permalink(geodir_add_listing_page_id());
516
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
-        }
519
-    }// end of if, if its a preview or not
520
-    /**
521
-     * This is called after the edit post link html in the function geodir_edit_post_link()
522
-     *
523
-     * @since 1.0.0
524
-     */
525
-    do_action('geodir_after_edit_post_link');
526
-    $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
-        /**
531
-         * Filter the geodir_edit_post_link() function content.
532
-         *
533
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
534
-         */
535
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
-    }
515
+			$postlink = get_permalink(geodir_add_listing_page_id());
516
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
+		}
519
+	}// end of if, if its a preview or not
520
+	/**
521
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
522
+	 *
523
+	 * @since 1.0.0
524
+	 */
525
+	do_action('geodir_after_edit_post_link');
526
+	$content_html = ob_get_clean();
527
+	if (trim($content_html) != '')
528
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
+		/**
531
+		 * Filter the geodir_edit_post_link() function content.
532
+		 *
533
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
534
+		 */
535
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
+	}
537 537
 }
538 538
 
539 539
 /**
@@ -547,41 +547,41 @@  discard block
 block discarded – undo
547 547
  */
548 548
 function geodir_detail_page_google_analytics()
549 549
 {
550
-    global $post;
551
-    $package_info = array();
552
-    $package_info = geodir_post_package_info($package_info, $post);
550
+	global $post;
551
+	$package_info = array();
552
+	$package_info = geodir_post_package_info($package_info, $post);
553 553
 
554
-    $id = trim(get_option('geodir_ga_id'));
554
+	$id = trim(get_option('geodir_ga_id'));
555 555
 
556
-    if (!$id) {
557
-        return; //if no Google Analytics ID then bail.
558
-    }
556
+	if (!$id) {
557
+		return; //if no Google Analytics ID then bail.
558
+	}
559 559
 
560
-    ob_start(); // Start buffering;
561
-    /**
562
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
-     *
564
-     * @since 1.0.0
565
-     */
566
-    do_action('geodir_before_google_analytics');
560
+	ob_start(); // Start buffering;
561
+	/**
562
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
+	 *
564
+	 * @since 1.0.0
565
+	 */
566
+	do_action('geodir_before_google_analytics');
567 567
     
568
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
569
-    /**
570
-     * Filter the time interval to check & refresh new users results.
571
-     *
572
-     * @since 1.5.9
573
-     *
574
-     * @param int $refresh_time Time interval to check & refresh new users results.
575
-     */
576
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
-    $refresh_time = absint($refresh_time * 1000);
568
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
569
+	/**
570
+	 * Filter the time interval to check & refresh new users results.
571
+	 *
572
+	 * @since 1.5.9
573
+	 *
574
+	 * @param int $refresh_time Time interval to check & refresh new users results.
575
+	 */
576
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
+	$refresh_time = absint($refresh_time * 1000);
578 578
     
579
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
579
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
584
-        ?>
581
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
584
+		?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587 587
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
834 834
 
835 835
                     <?php
836
-                    // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
844
-                    ?>
836
+					// Here we list the shorthand days of the week so it can be used in translation.
837
+					__("Mon",'geodirectory');
838
+					__("Tue",'geodirectory');
839
+					__("Wed",'geodirectory');
840
+					__("Thu",'geodirectory');
841
+					__("Fri",'geodirectory');
842
+					__("Sat",'geodirectory');
843
+					__("Sun",'geodirectory');
844
+					?>
845 845
 
846 846
                     labels = [
847 847
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1090,24 +1090,24 @@  discard block
 block discarded – undo
1090 1090
         </span>
1091 1091
 
1092 1092
     <?php
1093
-    }
1094
-    /**
1095
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
-     *
1097
-     * @since 1.0.0
1098
-     */
1099
-    do_action('geodir_after_google_analytics');
1100
-    $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
-        /**
1105
-         * Filter the geodir_edit_post_link() function content.
1106
-         *
1107
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
-         */
1109
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
-    }
1093
+	}
1094
+	/**
1095
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
+	 *
1097
+	 * @since 1.0.0
1098
+	 */
1099
+	do_action('geodir_after_google_analytics');
1100
+	$content_html = ob_get_clean();
1101
+	if (trim($content_html) != '')
1102
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
+		/**
1105
+		 * Filter the geodir_edit_post_link() function content.
1106
+		 *
1107
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
+		 */
1109
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
+	}
1111 1111
 }
1112 1112
 
1113 1113
 /**
@@ -1123,90 +1123,90 @@  discard block
 block discarded – undo
1123 1123
  */
1124 1124
 function geodir_detail_page_review_rating()
1125 1125
 {
1126
-    global $post, $preview, $post_images;
1127
-    ob_start(); // Start  buffering;
1128
-    /**
1129
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
-     *
1131
-     * This is called outside the check for an actual rating and the check for preview page.
1132
-     *
1133
-     * @since 1.0.0
1134
-     */
1135
-    do_action('geodir_before_detail_page_review_rating');
1136
-
1137
-    $comment_count = geodir_get_review_count_total($post->ID);
1138
-    $post_avgratings = geodir_get_post_rating($post->ID);
1139
-
1140
-    if ($post_avgratings != 0 && !$preview) {
1141
-        /**
1142
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
-         *
1144
-         * This is called inside the check for an actual rating and the check for preview page.
1145
-         *
1146
-         * @since 1.0.0
1147
-         * @param float $post_avgratings Average rating for the surrent post.
1148
-         * @param int $post->ID Current post ID.
1149
-         */
1150
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
-
1152
-        $html = '<p style=" float:left;">';
1153
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126
+	global $post, $preview, $post_images;
1127
+	ob_start(); // Start  buffering;
1128
+	/**
1129
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
+	 *
1131
+	 * This is called outside the check for an actual rating and the check for preview page.
1132
+	 *
1133
+	 * @since 1.0.0
1134
+	 */
1135
+	do_action('geodir_before_detail_page_review_rating');
1136
+
1137
+	$comment_count = geodir_get_review_count_total($post->ID);
1138
+	$post_avgratings = geodir_get_post_rating($post->ID);
1139
+
1140
+	if ($post_avgratings != 0 && !$preview) {
1141
+		/**
1142
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
+		 *
1144
+		 * This is called inside the check for an actual rating and the check for preview page.
1145
+		 *
1146
+		 * @since 1.0.0
1147
+		 * @param float $post_avgratings Average rating for the surrent post.
1148
+		 * @param int $post->ID Current post ID.
1149
+		 */
1150
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
+
1152
+		$html = '<p style=" float:left;">';
1153
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159 1159
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1160 1160
 
1161
-        $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1161
+		$html .= '<span class="item">';
1162
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1163 1163
 
1164
-        if ($post_images) {
1165
-            foreach ($post_images as $img) {
1166
-                $post_img = $img->src;
1167
-                break;
1168
-            }
1169
-        }
1170
-
1171
-        if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
-        }
1174
-
1175
-        $html .= '</span>';
1176
-
1177
-        echo $html .= '</div>';
1178
-        /**
1179
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
-         *
1181
-         * This is called inside the check for an actual rating and the check for preview page.
1182
-         *
1183
-         * @since 1.0.0
1184
-         * @param float $post_avgratings Average rating for the surrent post.
1185
-         * @param int $post->ID Current post ID.
1186
-         */
1187
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
-    }
1189
-    /**
1190
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
-     *
1192
-     * This is called outside the check for an actual rating and the check for preview page.
1193
-     *
1194
-     * @since 1.0.0
1195
-     */
1196
-    do_action('geodir_after_detail_page_review_rating');
1197
-    $content_html = ob_get_clean();
1198
-    if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
-    }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
-        /**
1203
-         * Filter the geodir_detail_page_review_rating() function content.
1204
-         *
1205
-         * @since 1.0.0
1206
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
-         */
1208
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
-    }
1164
+		if ($post_images) {
1165
+			foreach ($post_images as $img) {
1166
+				$post_img = $img->src;
1167
+				break;
1168
+			}
1169
+		}
1170
+
1171
+		if (isset($post_img) && $post_img) {
1172
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
+		}
1174
+
1175
+		$html .= '</span>';
1176
+
1177
+		echo $html .= '</div>';
1178
+		/**
1179
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
+		 *
1181
+		 * This is called inside the check for an actual rating and the check for preview page.
1182
+		 *
1183
+		 * @since 1.0.0
1184
+		 * @param float $post_avgratings Average rating for the surrent post.
1185
+		 * @param int $post->ID Current post ID.
1186
+		 */
1187
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
+	}
1189
+	/**
1190
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
+	 *
1192
+	 * This is called outside the check for an actual rating and the check for preview page.
1193
+	 *
1194
+	 * @since 1.0.0
1195
+	 */
1196
+	do_action('geodir_after_detail_page_review_rating');
1197
+	$content_html = ob_get_clean();
1198
+	if (trim($content_html) != '') {
1199
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
+	}
1201
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
+		/**
1203
+		 * Filter the geodir_detail_page_review_rating() function content.
1204
+		 *
1205
+		 * @since 1.0.0
1206
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
+		 */
1208
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
+	}
1210 1210
 }
1211 1211
 
1212 1212
 /**
@@ -1218,35 +1218,35 @@  discard block
 block discarded – undo
1218 1218
  */
1219 1219
 function geodir_detail_page_more_info()
1220 1220
 {
1221
-    ob_start(); // Start  buffering;
1222
-    /**
1223
-     * This is called before the info section html.
1224
-     *
1225
-     * @since 1.0.0
1226
-     */
1227
-    do_action('geodir_before_detail_page_more_info');
1228
-    if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1229
-        echo $geodir_post_detail_fields;
1230
-    }
1231
-    /**
1232
-     * This is called after the info section html.
1233
-     *
1234
-     * @since 1.0.0
1235
-     */
1236
-    do_action('geodir_after_detail_page_more_info');
1237
-
1238
-    $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
-        /**
1243
-         * Filter the output html for function geodir_detail_page_more_info().
1244
-         *
1245
-         * @since 1.0.0
1246
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
-         */
1248
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
-    }
1221
+	ob_start(); // Start  buffering;
1222
+	/**
1223
+	 * This is called before the info section html.
1224
+	 *
1225
+	 * @since 1.0.0
1226
+	 */
1227
+	do_action('geodir_before_detail_page_more_info');
1228
+	if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1229
+		echo $geodir_post_detail_fields;
1230
+	}
1231
+	/**
1232
+	 * This is called after the info section html.
1233
+	 *
1234
+	 * @since 1.0.0
1235
+	 */
1236
+	do_action('geodir_after_detail_page_more_info');
1237
+
1238
+	$content_html = ob_get_clean();
1239
+	if (trim($content_html) != '')
1240
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
+		/**
1243
+		 * Filter the output html for function geodir_detail_page_more_info().
1244
+		 *
1245
+		 * @since 1.0.0
1246
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
+		 */
1248
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
+	}
1250 1250
 }
1251 1251
 
1252 1252
 
@@ -1260,15 +1260,15 @@  discard block
 block discarded – undo
1260 1260
  */
1261 1261
 function geodir_localize_all_js_msg()
1262 1262
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1263
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
-        $ajax_url = admin_url('admin-ajax.php');
1265
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
-        $ajax_url = admin_url('admin-ajax.php');
1267
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
-    }
1263
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
+		$ajax_url = admin_url('admin-ajax.php');
1265
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
+		$ajax_url = admin_url('admin-ajax.php');
1267
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
+	}
1272 1272
 	
1273 1273
 	/**
1274 1274
 	 * Filter the allowed image type extensions for post images.
@@ -1278,59 +1278,59 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1280 1280
 	
1281
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1282
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
-    $default_marker_width = $default_marker_size['w'];
1284
-    $default_marker_height = $default_marker_size['h'];
1281
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1282
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
+	$default_marker_width = $default_marker_size['w'];
1284
+	$default_marker_height = $default_marker_size['h'];
1285 1285
     
1286
-    $arr_alert_msg = array(
1287
-        'geodir_plugin_url' => geodir_plugin_url(),
1288
-        'geodir_admin_ajax_url' => $ajax_url,
1289
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
-        //start not show alert msg
1294
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
-        // end not show alert msg
1300
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
-        //start not show alert msg
1302
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1303
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1304
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1305
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1306
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1307
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1308
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1309
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1310
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1311
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1312
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1313
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1314
-        'geodir_default_marker_icon' => $default_marker_icon,
1315
-        'geodir_default_marker_w' => $default_marker_width,
1316
-        'geodir_default_marker_h' => $default_marker_height,
1317
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1318
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1319
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1320
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1321
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1322
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1323
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1324
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1325
-        /* on/off dragging for phone devices */
1326
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1327
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1328
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1329
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1330
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1331
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1332
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1333
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1286
+	$arr_alert_msg = array(
1287
+		'geodir_plugin_url' => geodir_plugin_url(),
1288
+		'geodir_admin_ajax_url' => $ajax_url,
1289
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
+		//start not show alert msg
1294
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
+		// end not show alert msg
1300
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
+		//start not show alert msg
1302
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1303
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1304
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1305
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1306
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1307
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1308
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1309
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1310
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1311
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1312
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1313
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1314
+		'geodir_default_marker_icon' => $default_marker_icon,
1315
+		'geodir_default_marker_w' => $default_marker_width,
1316
+		'geodir_default_marker_h' => $default_marker_height,
1317
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1318
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1319
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1320
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1321
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1322
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1323
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1324
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1325
+		/* on/off dragging for phone devices */
1326
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1327
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1328
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1329
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1330
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1331
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1332
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1333
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1334 1334
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1335 1335
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1336 1336
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1338,29 +1338,29 @@  discard block
 block discarded – undo
1338 1338
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1339 1339
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1340 1340
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1341
-        'geodir_map_name' => geodir_map_name(),
1342
-    );
1343
-
1344
-    /**
1345
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1346
-     *
1347
-     * With this filter you can add, remove or change translated JS strings.
1348
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1349
-     *
1350
-     * @since 1.0.0
1351
-     */
1352
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1353
-
1354
-    foreach ($arr_alert_msg as $key => $value) {
1355
-        if (!is_scalar($value))
1356
-            continue;
1357
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358
-    }
1341
+		'geodir_map_name' => geodir_map_name(),
1342
+	);
1343
+
1344
+	/**
1345
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1346
+	 *
1347
+	 * With this filter you can add, remove or change translated JS strings.
1348
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1349
+	 *
1350
+	 * @since 1.0.0
1351
+	 */
1352
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1359 1353
 
1360
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1361
-    echo '<script>';
1362
-    echo $script;
1363
-    echo '</script>';
1354
+	foreach ($arr_alert_msg as $key => $value) {
1355
+		if (!is_scalar($value))
1356
+			continue;
1357
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358
+	}
1359
+
1360
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1361
+	echo '<script>';
1362
+	echo $script;
1363
+	echo '</script>';
1364 1364
 }
1365 1365
 
1366 1366
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1376,9 +1376,9 @@  discard block
 block discarded – undo
1376 1376
  */
1377 1377
 function geodir_admin_bar_site_menu($wp_admin_bar)
1378 1378
 {
1379
-    if (get_option("geodir_installed")) {
1380
-        $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1381
-    }
1379
+	if (get_option("geodir_installed")) {
1380
+		$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1381
+	}
1382 1382
 }
1383 1383
 
1384 1384
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1404,25 +1404,25 @@  discard block
 block discarded – undo
1404 1404
  */
1405 1405
 function geodir_store_sidebars()
1406 1406
 {
1407
-    global $geodir_sidebars;
1408
-    global $sidebars_widgets;
1409
-
1410
-    if (!is_array($sidebars_widgets))
1411
-        $sidebars_widgets = wp_get_sidebars_widgets();
1412
-    $geodir_old_sidebars = array();
1413
-
1414
-    if (is_array($geodir_sidebars)) {
1415
-        foreach ($geodir_sidebars as $val) {
1416
-            if (is_array($sidebars_widgets)) {
1417
-                if (array_key_exists($val, $sidebars_widgets))
1418
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1419
-                else
1420
-                    $geodir_old_sidebars[$val] = array();
1421
-            }
1422
-        }
1423
-    }
1424
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1425
-    geodir_option_version_backup('geodir_sidebars');
1407
+	global $geodir_sidebars;
1408
+	global $sidebars_widgets;
1409
+
1410
+	if (!is_array($sidebars_widgets))
1411
+		$sidebars_widgets = wp_get_sidebars_widgets();
1412
+	$geodir_old_sidebars = array();
1413
+
1414
+	if (is_array($geodir_sidebars)) {
1415
+		foreach ($geodir_sidebars as $val) {
1416
+			if (is_array($sidebars_widgets)) {
1417
+				if (array_key_exists($val, $sidebars_widgets))
1418
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1419
+				else
1420
+					$geodir_old_sidebars[$val] = array();
1421
+			}
1422
+		}
1423
+	}
1424
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1425
+	geodir_option_version_backup('geodir_sidebars');
1426 1426
 
1427 1427
 }
1428 1428
 
@@ -1436,34 +1436,34 @@  discard block
 block discarded – undo
1436 1436
  */
1437 1437
 function geodir_restore_sidebars()
1438 1438
 {
1439
-    global $sidebars_widgets;
1440
-
1441
-    if (!is_array($sidebars_widgets))
1442
-        $sidebars_widgets = wp_get_sidebars_widgets();
1443
-
1444
-    if (is_array($sidebars_widgets)) {
1445
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1446
-        if (is_array($geodir_old_sidebars)) {
1447
-            foreach ($geodir_old_sidebars as $key => $val) {
1448
-                //if(array_key_exists($key, $sidebars_widgets))
1449
-                {
1450
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1451
-                }
1439
+	global $sidebars_widgets;
1452 1440
 
1441
+	if (!is_array($sidebars_widgets))
1442
+		$sidebars_widgets = wp_get_sidebars_widgets();
1453 1443
 
1454
-            }
1455
-        }
1444
+	if (is_array($sidebars_widgets)) {
1445
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1446
+		if (is_array($geodir_old_sidebars)) {
1447
+			foreach ($geodir_old_sidebars as $key => $val) {
1448
+				//if(array_key_exists($key, $sidebars_widgets))
1449
+				{
1450
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1451
+				}
1456 1452
 
1457
-        // now clear all non geodiretory sidebars 
1458
-        foreach ($sidebars_widgets as $key => $val) {
1459
-            if (!array_key_exists($key, $geodir_old_sidebars)) {
1460
-                $sidebars_widgets[$key] = array();
1461
-            }
1462
-        }
1463
-    }
1464 1453
 
1465
-    update_option('sidebars_widgets', $sidebars_widgets);
1466
-    update_option('geodir_sidebars', '');
1454
+			}
1455
+		}
1456
+
1457
+		// now clear all non geodiretory sidebars 
1458
+		foreach ($sidebars_widgets as $key => $val) {
1459
+			if (!array_key_exists($key, $geodir_old_sidebars)) {
1460
+				$sidebars_widgets[$key] = array();
1461
+			}
1462
+		}
1463
+	}
1464
+
1465
+	update_option('sidebars_widgets', $sidebars_widgets);
1466
+	update_option('geodir_sidebars', '');
1467 1467
 }
1468 1468
 
1469 1469
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1476,9 +1476,9 @@  discard block
 block discarded – undo
1476 1476
  */
1477 1477
 function geodir_after_listing_post_gridview()
1478 1478
 {
1479
-    global $gridview_columns;
1479
+	global $gridview_columns;
1480 1480
 
1481
-    $gridview_columns = '';
1481
+	$gridview_columns = '';
1482 1482
 
1483 1483
 }
1484 1484
 
@@ -1506,11 +1506,11 @@  discard block
 block discarded – undo
1506 1506
  */
1507 1507
 function so_handle_038($url, $original_url, $_context)
1508 1508
 {
1509
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1510
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1511
-    }
1509
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1510
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1511
+	}
1512 1512
 
1513
-    return $url;
1513
+	return $url;
1514 1514
 }
1515 1515
 
1516 1516
 
@@ -1526,34 +1526,34 @@  discard block
 block discarded – undo
1526 1526
 function geodir_after_main_form_fields() {
1527 1527
 	global $gd_session;
1528 1528
 	
1529
-    if (get_option('geodir_accept_term_condition')) {
1530
-        global $post;
1531
-        $term_condition = '';
1532
-        if (isset($_REQUEST['backandedit'])) {
1533
-            $post = (object)$gd_session->get('listing');
1534
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1535
-        }
1536
-
1537
-        ?>
1529
+	if (get_option('geodir_accept_term_condition')) {
1530
+		global $post;
1531
+		$term_condition = '';
1532
+		if (isset($_REQUEST['backandedit'])) {
1533
+			$post = (object)$gd_session->get('listing');
1534
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1535
+		}
1536
+
1537
+		?>
1538 1538
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1539 1539
             <label>&nbsp;</label>
1540 1540
 
1541 1541
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1542 1542
 				<span style="display:block"> 
1543 1543
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1544
-                    echo 'checked="checked"';
1545
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1544
+					echo 'checked="checked"';
1545
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1546 1546
                        class="geodir_textfield" value="1"
1547 1547
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1548 1548
 				</span>
1549 1549
             </div>
1550 1550
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1551
-                    _e($required_msg, 'geodirectory');
1552
-                } ?></span>
1551
+					_e($required_msg, 'geodirectory');
1552
+				} ?></span>
1553 1553
         </div>
1554 1554
     <?php
1555 1555
 
1556
-    }
1556
+	}
1557 1557
 }
1558 1558
 
1559 1559
 
@@ -1578,42 +1578,42 @@  discard block
 block discarded – undo
1578 1578
  */
1579 1579
 function geodir_detail_page_tab_is_display($is_display, $tab)
1580 1580
 {
1581
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1581
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1582 1582
 
1583
-    if ($tab == 'post_profile') {
1584
-        /** This action is documented in geodirectory_template_actions.php */
1585
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1583
+	if ($tab == 'post_profile') {
1584
+		/** This action is documented in geodirectory_template_actions.php */
1585
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1586 1586
         
1587
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1588
-            $is_display = false;
1589
-        }
1590
-    }
1587
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1588
+			$is_display = false;
1589
+		}
1590
+	}
1591 1591
     
1592
-    if ($tab == 'post_info')
1593
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1592
+	if ($tab == 'post_info')
1593
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1594 1594
 
1595
-    if ($tab == 'post_images')
1596
-        $is_display = (!empty($post_images)) ? true : false;
1595
+	if ($tab == 'post_images')
1596
+		$is_display = (!empty($post_images)) ? true : false;
1597 1597
 
1598
-    if ($tab == 'post_video')
1599
-        $is_display = (!empty($video)) ? true : false;
1598
+	if ($tab == 'post_video')
1599
+		$is_display = (!empty($video)) ? true : false;
1600 1600
 
1601
-    if ($tab == 'special_offers')
1602
-        $is_display = (!empty($special_offers)) ? true : false;
1601
+	if ($tab == 'special_offers')
1602
+		$is_display = (!empty($special_offers)) ? true : false;
1603 1603
 
1604
-    if ($tab == 'reviews')
1605
-        $is_display = (geodir_is_page('detail')) ? true : false;
1604
+	if ($tab == 'reviews')
1605
+		$is_display = (geodir_is_page('detail')) ? true : false;
1606 1606
 
1607
-    if ($tab == 'related_listing') {
1608
-       $message = __('No listings found which match your selection.', 'geodirectory');
1607
+	if ($tab == 'related_listing') {
1608
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1609 1609
        
1610
-       /** This action is documented in geodirectory-functions/template_functions.php */
1611
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1610
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1611
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1612 1612
        
1613
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1614
-    }
1613
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1614
+	}
1615 1615
 
1616
-    return $is_display;
1616
+	return $is_display;
1617 1617
 }
1618 1618
 
1619 1619
 
@@ -1629,69 +1629,69 @@  discard block
 block discarded – undo
1629 1629
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1630 1630
  */
1631 1631
 function geodir_changes_in_custom_fields_table() {
1632
-    global $wpdb, $plugin_prefix;
1632
+	global $wpdb, $plugin_prefix;
1633 1633
 	
1634 1634
 	// Remove unused virtual page
1635 1635
 	$listings_page_id = (int)get_option('geodir_listing_page');
1636 1636
 	if ($listings_page_id) {
1637 1637
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1638
-        delete_option('geodir_listing_page');
1638
+		delete_option('geodir_listing_page');
1639 1639
 	}
1640 1640
 
1641
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1642
-        $wpdb->query(
1643
-            $wpdb->prepare(
1644
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1645
-                array('1', '1', 'admin')
1646
-            )
1647
-        );
1641
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1642
+		$wpdb->query(
1643
+			$wpdb->prepare(
1644
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1645
+				array('1', '1', 'admin')
1646
+			)
1647
+		);
1648 1648
 
1649 1649
 
1650
-        /* --- terms meta value set --- */
1650
+		/* --- terms meta value set --- */
1651 1651
 
1652
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1652
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1653 1653
 
1654
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1654
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1655 1655
 
1656
-        if (!empty($options_data)) {
1656
+		if (!empty($options_data)) {
1657 1657
 
1658
-            foreach ($options_data as $optobj) {
1658
+			foreach ($options_data as $optobj) {
1659 1659
 
1660
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1660
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1661 1661
 
1662
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1662
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1663 1663
 
1664
-                if (!empty($taxonomies_data)) {
1664
+				if (!empty($taxonomies_data)) {
1665 1665
 
1666
-                    foreach ($taxonomies_data as $taxobj) {
1666
+					foreach ($taxonomies_data as $taxobj) {
1667 1667
 
1668
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1669
-                        $post_type = $taxObject->object_type[0];
1668
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1669
+						$post_type = $taxObject->object_type[0];
1670 1670
 
1671
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1671
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1672 1672
 
1673
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1673
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1674 1674
 
1675
-                        if ($duplicate_data) {
1675
+						if ($duplicate_data) {
1676 1676
 
1677
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1677
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1678 1678
 
1679
-                        } else {
1679
+						} else {
1680 1680
 
1681
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1681
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1682 1682
 
1683
-                        }
1683
+						}
1684 1684
 
1685
-                    }
1685
+					}
1686 1686
 
1687
-                }
1687
+				}
1688 1688
 
1689
-            }
1690
-        }
1689
+			}
1690
+		}
1691 1691
 
1692
-        update_option('geodir_changes_in_custom_fields_table', '1');
1692
+		update_option('geodir_changes_in_custom_fields_table', '1');
1693 1693
 
1694
-    }
1694
+	}
1695 1695
 
1696 1696
 }
1697 1697
 
@@ -1710,24 +1710,24 @@  discard block
 block discarded – undo
1710 1710
 function geodir_location_slug_check($slug)
1711 1711
 {
1712 1712
 
1713
-    global $wpdb, $table_prefix;
1713
+	global $wpdb, $table_prefix;
1714 1714
 
1715
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1715
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1716 1716
 
1717
-    if ($slug_exists) {
1717
+	if ($slug_exists) {
1718 1718
 
1719
-        $suffix = 1;
1720
-        do {
1721
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1722
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1723
-            $suffix++;
1724
-        } while ($location_slug_check && $suffix < 100);
1719
+		$suffix = 1;
1720
+		do {
1721
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1722
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1723
+			$suffix++;
1724
+		} while ($location_slug_check && $suffix < 100);
1725 1725
 
1726
-        $slug = $alt_location_name;
1726
+		$slug = $alt_location_name;
1727 1727
 
1728
-    }
1728
+	}
1729 1729
 
1730
-    return $slug;
1730
+	return $slug;
1731 1731
 
1732 1732
 }
1733 1733
 
@@ -1752,42 +1752,42 @@  discard block
 block discarded – undo
1752 1752
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1753 1753
 {
1754 1754
 
1755
-    global $wpdb, $plugin_prefix, $table_prefix;
1755
+	global $wpdb, $plugin_prefix, $table_prefix;
1756 1756
 
1757
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1757
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1758 1758
 
1759
-    $slug = $tern_data->slug;
1759
+	$slug = $tern_data->slug;
1760 1760
 
1761
-    /**
1762
-     * Filter if a term slug exists.
1763
-     *
1764
-     * @since 1.0.0
1765
-     * @package GeoDirectory
1766
-     * @param bool $bool Default: false.
1767
-     * @param string $slug The term slug.
1768
-     * @param int $term_id The term ID.
1769
-     */
1770
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1761
+	/**
1762
+	 * Filter if a term slug exists.
1763
+	 *
1764
+	 * @since 1.0.0
1765
+	 * @package GeoDirectory
1766
+	 * @param bool $bool Default: false.
1767
+	 * @param string $slug The term slug.
1768
+	 * @param int $term_id The term ID.
1769
+	 */
1770
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1771 1771
 
1772
-    if ($slug_exists) {
1772
+	if ($slug_exists) {
1773 1773
 
1774
-        $suffix = 1;
1775
-        do {
1776
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1774
+		$suffix = 1;
1775
+		do {
1776
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1777 1777
 
1778
-            /** This action is documented in geodirectory_hooks_actions.php */
1779
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1778
+			/** This action is documented in geodirectory_hooks_actions.php */
1779
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1780 1780
 
1781
-            $suffix++;
1782
-        } while ($term_slug_check && $suffix < 100);
1781
+			$suffix++;
1782
+		} while ($term_slug_check && $suffix < 100);
1783 1783
 
1784
-        $slug = $new_slug;
1784
+		$slug = $new_slug;
1785 1785
 
1786
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1786
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1787 1787
 
1788
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1788
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1789 1789
 
1790
-    }
1790
+	}
1791 1791
 	
1792 1792
 	// Update tag in detail table.
1793 1793
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1828,21 +1828,21 @@  discard block
 block discarded – undo
1828 1828
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1829 1829
 {
1830 1830
 
1831
-    global $wpdb, $table_prefix;
1831
+	global $wpdb, $table_prefix;
1832 1832
 
1833
-    $default_location = geodir_get_default_location();
1833
+	$default_location = geodir_get_default_location();
1834 1834
 
1835
-    $country_slug = $default_location->country_slug;
1836
-    $region_slug = $default_location->region_slug;
1837
-    $city_slug = $default_location->city_slug;
1835
+	$country_slug = $default_location->country_slug;
1836
+	$region_slug = $default_location->region_slug;
1837
+	$city_slug = $default_location->city_slug;
1838 1838
 
1839
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1840
-        return $slug_exists = true;
1839
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1840
+		return $slug_exists = true;
1841 1841
 
1842
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1843
-        return $slug_exists = true;
1842
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1843
+		return $slug_exists = true;
1844 1844
 
1845
-    return $slug_exists;
1845
+	return $slug_exists;
1846 1846
 }
1847 1847
 
1848 1848
 
@@ -1861,75 +1861,75 @@  discard block
 block discarded – undo
1861 1861
  */
1862 1862
 function geodir_custom_page_title($title = '', $sep = '')
1863 1863
 {
1864
-    global $wp;
1865
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1866
-        return $title;
1867
-    }
1864
+	global $wp;
1865
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1866
+		return $title;
1867
+	}
1868 1868
 
1869
-    if ($sep == '') {
1870
-        /**
1871
-         * Filter the page title separator.
1872
-         *
1873
-         * @since 1.0.0
1874
-         * @package GeoDirectory
1875
-         * @param string $sep The separator, default: `|`.
1876
-         */
1877
-        $sep = apply_filters('geodir_page_title_separator', '|');
1878
-    }
1869
+	if ($sep == '') {
1870
+		/**
1871
+		 * Filter the page title separator.
1872
+		 *
1873
+		 * @since 1.0.0
1874
+		 * @package GeoDirectory
1875
+		 * @param string $sep The separator, default: `|`.
1876
+		 */
1877
+		$sep = apply_filters('geodir_page_title_separator', '|');
1878
+	}
1879 1879
 
1880 1880
 
1881
-    $gd_page = '';
1882
-    if(geodir_is_page('home')){
1883
-        $gd_page = 'home';
1884
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1885
-    }
1886
-    elseif(geodir_is_page('detail')){
1887
-        $gd_page = 'detail';
1888
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1889
-    }
1890
-    elseif(geodir_is_page('pt')){
1891
-        $gd_page = 'pt';
1892
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1893
-    }
1894
-    elseif(geodir_is_page('listing')){
1895
-        $gd_page = 'listing';
1896
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1897
-    }
1898
-    elseif(geodir_is_page('location')){
1899
-        $gd_page = 'location';
1900
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1901
-    }
1902
-    elseif(geodir_is_page('search')){
1903
-        $gd_page = 'search';
1904
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1905
-    }
1906
-    elseif(geodir_is_page('add-listing')){
1907
-        $gd_page = 'add-listing';
1908
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1909
-    }
1910
-    elseif(geodir_is_page('author')){
1911
-        $gd_page = 'author';
1912
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1913
-    }
1914
-    elseif(geodir_is_page('login')){
1915
-        $gd_page = 'login';
1916
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1917
-    }
1918
-    elseif(geodir_is_page('listing-success')){
1919
-        $gd_page = 'listing-success';
1920
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1921
-    }
1881
+	$gd_page = '';
1882
+	if(geodir_is_page('home')){
1883
+		$gd_page = 'home';
1884
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1885
+	}
1886
+	elseif(geodir_is_page('detail')){
1887
+		$gd_page = 'detail';
1888
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1889
+	}
1890
+	elseif(geodir_is_page('pt')){
1891
+		$gd_page = 'pt';
1892
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1893
+	}
1894
+	elseif(geodir_is_page('listing')){
1895
+		$gd_page = 'listing';
1896
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1897
+	}
1898
+	elseif(geodir_is_page('location')){
1899
+		$gd_page = 'location';
1900
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1901
+	}
1902
+	elseif(geodir_is_page('search')){
1903
+		$gd_page = 'search';
1904
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1905
+	}
1906
+	elseif(geodir_is_page('add-listing')){
1907
+		$gd_page = 'add-listing';
1908
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1909
+	}
1910
+	elseif(geodir_is_page('author')){
1911
+		$gd_page = 'author';
1912
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1913
+	}
1914
+	elseif(geodir_is_page('login')){
1915
+		$gd_page = 'login';
1916
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1917
+	}
1918
+	elseif(geodir_is_page('listing-success')){
1919
+		$gd_page = 'listing-success';
1920
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1921
+	}
1922 1922
 
1923 1923
 
1924
-    /**
1925
-     * Filter page meta title to replace variables.
1926
-     *
1927
-     * @since 1.5.4
1928
-     * @param string $title The page title including variables.
1929
-     * @param string $gd_page The GeoDirectory page type if any.
1930
-     * @param string $sep The title separator symbol.
1931
-     */
1932
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1924
+	/**
1925
+	 * Filter page meta title to replace variables.
1926
+	 *
1927
+	 * @since 1.5.4
1928
+	 * @param string $title The page title including variables.
1929
+	 * @param string $gd_page The GeoDirectory page type if any.
1930
+	 * @param string $sep The title separator symbol.
1931
+	 */
1932
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1933 1933
 
1934 1934
 }
1935 1935
 
@@ -1945,33 +1945,33 @@  discard block
 block discarded – undo
1945 1945
 function geodir_set_post_attachment()
1946 1946
 {
1947 1947
 
1948
-    if (!get_option('geodir_set_post_attachments')) {
1948
+	if (!get_option('geodir_set_post_attachments')) {
1949 1949
 
1950
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1951
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1950
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1951
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1952 1952
 
1953
-        $all_postypes = geodir_get_posttypes();
1953
+		$all_postypes = geodir_get_posttypes();
1954 1954
 
1955
-        $args = array(
1956
-            'posts_per_page' => -1,
1957
-            'post_type' => $all_postypes,
1958
-            'post_status' => 'publish');
1955
+		$args = array(
1956
+			'posts_per_page' => -1,
1957
+			'post_type' => $all_postypes,
1958
+			'post_status' => 'publish');
1959 1959
 
1960
-        $posts_array = get_posts($args);
1960
+		$posts_array = get_posts($args);
1961 1961
 
1962
-        if (!empty($posts_array)) {
1962
+		if (!empty($posts_array)) {
1963 1963
 
1964
-            foreach ($posts_array as $post) {
1964
+			foreach ($posts_array as $post) {
1965 1965
 
1966
-                geodir_set_wp_featured_image($post->ID);
1966
+				geodir_set_wp_featured_image($post->ID);
1967 1967
 
1968
-            }
1968
+			}
1969 1969
 
1970
-        }
1970
+		}
1971 1971
 
1972
-        update_option('geodir_set_post_attachments', '1');
1972
+		update_option('geodir_set_post_attachments', '1');
1973 1973
 
1974
-    }
1974
+	}
1975 1975
 
1976 1976
 }
1977 1977
 
@@ -1988,19 +1988,19 @@  discard block
 block discarded – undo
1988 1988
 function geodir_remove_url_seperator()
1989 1989
 {
1990 1990
 
1991
-    if (!get_option('geodir_remove_url_seperator')) {
1991
+	if (!get_option('geodir_remove_url_seperator')) {
1992 1992
 
1993
-        if (get_option('geodir_listingurl_separator'))
1994
-            delete_option('geodir_listingurl_separator');
1993
+		if (get_option('geodir_listingurl_separator'))
1994
+			delete_option('geodir_listingurl_separator');
1995 1995
 
1996
-        if (get_option('geodir_detailurl_separator'))
1997
-            delete_option('geodir_detailurl_separator');
1996
+		if (get_option('geodir_detailurl_separator'))
1997
+			delete_option('geodir_detailurl_separator');
1998 1998
 
1999
-        flush_rewrite_rules(false);
1999
+		flush_rewrite_rules(false);
2000 2000
 
2001
-        update_option('geodir_remove_url_seperator', '1');
2001
+		update_option('geodir_remove_url_seperator', '1');
2002 2002
 
2003
-    }
2003
+	}
2004 2004
 
2005 2005
 }
2006 2006
 
@@ -2016,19 +2016,19 @@  discard block
 block discarded – undo
2016 2016
  */
2017 2017
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2018 2018
 {
2019
-    foreach ($permalink_arr as $key => $value) {
2019
+	foreach ($permalink_arr as $key => $value) {
2020 2020
 
2021
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2022
-            unset($permalink_arr[$key]);
2021
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2022
+			unset($permalink_arr[$key]);
2023 2023
 
2024
-    }
2024
+	}
2025 2025
 
2026
-    return $permalink_arr;
2026
+	return $permalink_arr;
2027 2027
 
2028 2028
 }
2029 2029
 
2030 2030
 if (!is_admin()) {
2031
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2031
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2032 2032
 }
2033 2033
 /**
2034 2034
  * Set status from draft to publish.
@@ -2041,13 +2041,13 @@  discard block
 block discarded – undo
2041 2041
  */
2042 2042
 function geodir_set_status_draft_to_publish_for_own_post($post)
2043 2043
 {
2044
-    global $wp;
2045
-    $user_id = get_current_user_id();
2044
+	global $wp;
2045
+	$user_id = get_current_user_id();
2046 2046
 
2047
-    if (!empty($post) && $post[0]->post_author == $user_id) {
2048
-        $post[0]->post_status = 'publish';
2049
-    }
2050
-    return $post;
2047
+	if (!empty($post) && $post[0]->post_author == $user_id) {
2048
+		$post[0]->post_status = 'publish';
2049
+	}
2050
+	return $post;
2051 2051
 }
2052 2052
 
2053 2053
 
@@ -2139,33 +2139,33 @@  discard block
 block discarded – undo
2139 2139
  */
2140 2140
 function geodir_detail_page_tab_headings_change($tabs_arr)
2141 2141
 {
2142
-    global $wpdb;
2142
+	global $wpdb;
2143 2143
 
2144
-    $post_type = geodir_get_current_posttype();
2144
+	$post_type = geodir_get_current_posttype();
2145 2145
 
2146
-    $all_postypes = geodir_get_posttypes();
2146
+	$all_postypes = geodir_get_posttypes();
2147 2147
 
2148
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2148
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2149 2149
 
2150
-        if (array_key_exists('post_video', $tabs_arr)) {
2150
+		if (array_key_exists('post_video', $tabs_arr)) {
2151 2151
 
2152
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2152
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2153 2153
 
2154
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2155
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2156
-        }
2154
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2155
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2156
+		}
2157 2157
 
2158
-        if (array_key_exists('special_offers', $tabs_arr)) {
2158
+		if (array_key_exists('special_offers', $tabs_arr)) {
2159 2159
 
2160
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2160
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2161 2161
 
2162
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2163
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2164
-        }
2162
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2163
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2164
+		}
2165 2165
 
2166
-    }
2166
+	}
2167 2167
 
2168
-    return $tabs_arr;
2168
+	return $tabs_arr;
2169 2169
 
2170 2170
 }
2171 2171
 
@@ -2178,10 +2178,10 @@  discard block
 block discarded – undo
2178 2178
  */
2179 2179
 function geodir_remove_template_redirect_actions()
2180 2180
 {
2181
-    if (geodir_is_page('login')){
2182
-        remove_all_actions('template_redirect');
2183
-        remove_action('init', 'avia_modify_front', 10);
2184
-    }
2181
+	if (geodir_is_page('login')){
2182
+		remove_all_actions('template_redirect');
2183
+		remove_action('init', 'avia_modify_front', 10);
2184
+	}
2185 2185
 }
2186 2186
 
2187 2187
 
@@ -2203,51 +2203,51 @@  discard block
 block discarded – undo
2203 2203
 function geodirectory_before_featured_image_delete($attachment_id)
2204 2204
 {
2205 2205
 
2206
-    global $wpdb, $plugin_prefix;
2206
+	global $wpdb, $plugin_prefix;
2207 2207
 
2208
-    $post_id = get_post_field('post_parent', $attachment_id);
2208
+	$post_id = get_post_field('post_parent', $attachment_id);
2209 2209
 
2210
-    $attachment_url = wp_get_attachment_url($attachment_id);
2210
+	$attachment_url = wp_get_attachment_url($attachment_id);
2211 2211
 
2212
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2212
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2213 2213
 
2214
-        $post_type = get_post_type($post_id);
2214
+		$post_type = get_post_type($post_id);
2215 2215
 
2216
-        $all_postypes = geodir_get_posttypes();
2216
+		$all_postypes = geodir_get_posttypes();
2217 2217
 
2218
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2219
-            return false;
2218
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2219
+			return false;
2220 2220
 
2221
-        $uploads = wp_upload_dir();
2221
+		$uploads = wp_upload_dir();
2222 2222
 
2223
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2223
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2224 2224
 
2225
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2225
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2226 2226
 
2227
-        $wpdb->query(
2228
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2229
-                array($post_id, $split_img_file_path)
2230
-            )
2231
-        );
2227
+		$wpdb->query(
2228
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2229
+				array($post_id, $split_img_file_path)
2230
+			)
2231
+		);
2232 2232
 
2233
-        $attachment_data = $wpdb->get_row(
2234
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2235
-                array($post_id)
2236
-            )
2237
-        );
2233
+		$attachment_data = $wpdb->get_row(
2234
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2235
+				array($post_id)
2236
+			)
2237
+		);
2238 2238
 
2239
-        if (!empty($attachment_data)) {
2240
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2241
-        }
2239
+		if (!empty($attachment_data)) {
2240
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2241
+		}
2242 2242
 
2243 2243
 
2244
-        $table_name = $plugin_prefix . $post_type . '_detail';
2244
+		$table_name = $plugin_prefix . $post_type . '_detail';
2245 2245
 
2246
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2246
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2247 2247
 
2248
-        geodir_set_wp_featured_image($post_id);
2248
+		geodir_set_wp_featured_image($post_id);
2249 2249
 
2250
-    }
2250
+	}
2251 2251
 
2252 2252
 }
2253 2253
 
@@ -2265,79 +2265,79 @@  discard block
 block discarded – undo
2265 2265
 function geodir_temp_set_post_attachment()
2266 2266
 {
2267 2267
 
2268
-    global $wpdb, $plugin_prefix;
2268
+	global $wpdb, $plugin_prefix;
2269 2269
 
2270
-    $all_postypes = geodir_get_posttypes();
2270
+	$all_postypes = geodir_get_posttypes();
2271 2271
 
2272
-    foreach ($all_postypes as $posttype) {
2272
+	foreach ($all_postypes as $posttype) {
2273 2273
 
2274
-        $tablename = $plugin_prefix . $posttype . '_detail';
2274
+		$tablename = $plugin_prefix . $posttype . '_detail';
2275 2275
 
2276
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2276
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2277 2277
 
2278
-        if (!empty($get_post_data)) {
2278
+		if (!empty($get_post_data)) {
2279 2279
 
2280
-            foreach ($get_post_data as $data) {
2280
+			foreach ($get_post_data as $data) {
2281 2281
 
2282
-                $post_id = $data->post_id;
2282
+				$post_id = $data->post_id;
2283 2283
 
2284
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2284
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2285 2285
 
2286
-                if (!empty($attachment_data)) {
2286
+				if (!empty($attachment_data)) {
2287 2287
 
2288
-                    foreach ($attachment_data as $attach) {
2288
+					foreach ($attachment_data as $attach) {
2289 2289
 
2290
-                        $file_info = pathinfo($attach->file);
2290
+						$file_info = pathinfo($attach->file);
2291 2291
 
2292
-                        $sub_dir = '';
2293
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2294
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2292
+						$sub_dir = '';
2293
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2294
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2295 2295
 
2296
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2297
-                        $uploads_path = $uploads['basedir'];
2296
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2297
+						$uploads_path = $uploads['basedir'];
2298 2298
 
2299
-                        $file_name = $file_info['basename'];
2299
+						$file_name = $file_info['basename'];
2300 2300
 
2301
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2301
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2302 2302
 
2303
-                        if (!file_exists($img_arr['path'])) {
2303
+						if (!file_exists($img_arr['path'])) {
2304 2304
 
2305
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2305
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2306 2306
 
2307
-                        }
2307
+						}
2308 2308
 
2309
-                    }
2309
+					}
2310 2310
 
2311
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2311
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2312 2312
 
2313
-                    if (!empty($attachment_data)) {
2313
+					if (!empty($attachment_data)) {
2314 2314
 
2315
-                        if ($attachment_data->ID)
2316
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2315
+						if ($attachment_data->ID)
2316
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2317 2317
 
2318
-                    } else {
2318
+					} else {
2319 2319
 
2320
-                        if (has_post_thumbnail($post_id)) {
2320
+						if (has_post_thumbnail($post_id)) {
2321 2321
 
2322
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2322
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2323 2323
 
2324
-                            wp_delete_attachment($post_thumbnail_id);
2324
+							wp_delete_attachment($post_thumbnail_id);
2325 2325
 
2326
-                        }
2326
+						}
2327 2327
 
2328
-                    }
2328
+					}
2329 2329
 
2330
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2330
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2331 2331
 
2332
-                    geodir_set_wp_featured_image($post_id);
2332
+					geodir_set_wp_featured_image($post_id);
2333 2333
 
2334
-                }
2334
+				}
2335 2335
 
2336
-            }
2336
+			}
2337 2337
 
2338
-        }
2338
+		}
2339 2339
 
2340
-    }
2340
+	}
2341 2341
 
2342 2342
 }
2343 2343
 
@@ -2355,9 +2355,9 @@  discard block
 block discarded – undo
2355 2355
 function geodir_default_rating_star_icon()
2356 2356
 {
2357 2357
 
2358
-    if (!get_option('geodir_default_rating_star_icon')) {
2359
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2360
-    }
2358
+	if (!get_option('geodir_default_rating_star_icon')) {
2359
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2360
+	}
2361 2361
 
2362 2362
 }
2363 2363
 
@@ -2375,27 +2375,27 @@  discard block
 block discarded – undo
2375 2375
  */
2376 2376
 function geodir_user_post_listing_count($user_id=null)
2377 2377
 {
2378
-    global $wpdb, $plugin_prefix, $current_user;
2379
-    if(!$user_id){
2380
-        $user_id = $current_user->ID;
2381
-    }
2378
+	global $wpdb, $plugin_prefix, $current_user;
2379
+	if(!$user_id){
2380
+		$user_id = $current_user->ID;
2381
+	}
2382 2382
 
2383
-    $user_id = $current_user->ID;
2384
-    $all_postypes = geodir_get_posttypes();
2385
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2383
+	$user_id = $current_user->ID;
2384
+	$all_postypes = geodir_get_posttypes();
2385
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2386 2386
 
2387
-    $user_listing = array();
2388
-    if (is_array($all_posts) && !empty($all_posts)) {
2389
-        foreach ($all_posts as $ptype) {
2390
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2387
+	$user_listing = array();
2388
+	if (is_array($all_posts) && !empty($all_posts)) {
2389
+		foreach ($all_posts as $ptype) {
2390
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2391 2391
 
2392
-            if ($total_posts > 0) {
2393
-                $user_listing[$ptype] = $total_posts;
2394
-            }
2395
-        }
2396
-    }
2392
+			if ($total_posts > 0) {
2393
+				$user_listing[$ptype] = $total_posts;
2394
+			}
2395
+		}
2396
+	}
2397 2397
 
2398
-    return $user_listing;
2398
+	return $user_listing;
2399 2399
 }
2400 2400
 
2401 2401
 
@@ -2415,579 +2415,579 @@  discard block
 block discarded – undo
2415 2415
  */
2416 2416
 function geodir_detail_page_custom_field_tab($tabs_arr)
2417 2417
 {
2418
-    global $post;
2419
-
2420
-    $post_type = geodir_get_current_posttype();
2421
-    $all_postypes = geodir_get_posttypes();
2422
-
2423
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2424
-        $package_info = array();
2425
-        $package_info = geodir_post_package_info($package_info, $post);
2426
-        $post_package_id = $package_info->pid;
2427
-        $fields_location = 'detail';
2428
-
2429
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2430
-        if (!empty($custom_fields)) {
2431
-            $parse_custom_fields = array();
2432
-            foreach ($custom_fields as $field) {
2433
-                $field = stripslashes_deep($field); // strip slashes
2418
+	global $post;
2419
+
2420
+	$post_type = geodir_get_current_posttype();
2421
+	$all_postypes = geodir_get_posttypes();
2422
+
2423
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2424
+		$package_info = array();
2425
+		$package_info = geodir_post_package_info($package_info, $post);
2426
+		$post_package_id = $package_info->pid;
2427
+		$fields_location = 'detail';
2428
+
2429
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2430
+		if (!empty($custom_fields)) {
2431
+			$parse_custom_fields = array();
2432
+			foreach ($custom_fields as $field) {
2433
+				$field = stripslashes_deep($field); // strip slashes
2434 2434
                 
2435
-                $type = $field;
2436
-                $field_name = $field['htmlvar_name'];
2437
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2438
-                    $post->{$field_name} = $_REQUEST[$field_name];
2439
-                }
2440
-
2441
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2442
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2443
-                        continue;
2444
-                    }
2445
-
2446
-                    $parse_custom_fields[] = $field;
2447
-                }
2448
-            }
2449
-            $custom_fields = $parse_custom_fields;
2450
-        }
2451
-
2452
-        if (!empty($custom_fields)) {
2453
-            $field_set_start = 0;
2454
-            $fieldset_count = 0;
2455
-            $fieldset = '';
2456
-            $total_fields = count($custom_fields);
2457
-            $count_field = 0;
2458
-            $fieldset_arr = array();
2459
-            $i = 0;
2460
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2461
-
2462
-            foreach ($custom_fields as $field) {
2463
-                $count_field++;
2464
-                $field_name = $field['htmlvar_name'];
2465
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2466
-                    $post->{$field_name} = $_REQUEST[$field_name];
2467
-                }
2468
-
2469
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2470
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2471
-                    $site_title = trim($field['site_title']);
2472
-                    $type = $field;
2473
-                    $html = '';
2474
-                    $html_var = $field_name;
2475
-                    $field_icon = '';
2476
-                    $variables_array = array();
2477
-
2478
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2479
-                        continue;
2480
-                    }
2481
-
2482
-                    if ($type['type'] != 'fieldset') {
2483
-                        $i++;
2484
-                        $variables_array['post_id'] = $post->ID;
2485
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2486
-                        $variables_array['value'] = '';
2487
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2488
-                    }
2489
-
2490
-                    if (strpos($type['field_icon'], 'http') !== false) {
2491
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2492
-                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2493
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2494
-                    }
2435
+				$type = $field;
2436
+				$field_name = $field['htmlvar_name'];
2437
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2438
+					$post->{$field_name} = $_REQUEST[$field_name];
2439
+				}
2440
+
2441
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2442
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2443
+						continue;
2444
+					}
2445
+
2446
+					$parse_custom_fields[] = $field;
2447
+				}
2448
+			}
2449
+			$custom_fields = $parse_custom_fields;
2450
+		}
2495 2451
 
2496
-                    switch ($type['type']) {
2497
-                        case 'fieldset': {
2498
-                            $i = 0;
2499
-                            $fieldset_count++;
2500
-                            $field_set_start = 1;
2501
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2502
-                            $fieldset_arr[$fieldset_count]['label'] = $label;
2503
-                        }
2504
-                            break;
2505
-                        case 'url': {
2506
-                            if (strpos($field_icon, 'http') !== false) {
2507
-                                $field_icon_af = '';
2508
-                            } elseif ($field_icon == '') {
2509
-
2510
-                                if ($type['name'] == 'geodir_facebook') {
2511
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2512
-                                } elseif ($type['name'] == 'geodir_twitter') {
2513
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2514
-                                } else {
2515
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2516
-                                }
2517
-
2518
-                            } else {
2519
-                                $field_icon_af = $field_icon;
2520
-                                $field_icon = '';
2521
-                            }
2452
+		if (!empty($custom_fields)) {
2453
+			$field_set_start = 0;
2454
+			$fieldset_count = 0;
2455
+			$fieldset = '';
2456
+			$total_fields = count($custom_fields);
2457
+			$count_field = 0;
2458
+			$fieldset_arr = array();
2459
+			$i = 0;
2460
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2461
+
2462
+			foreach ($custom_fields as $field) {
2463
+				$count_field++;
2464
+				$field_name = $field['htmlvar_name'];
2465
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2466
+					$post->{$field_name} = $_REQUEST[$field_name];
2467
+				}
2468
+
2469
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2470
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2471
+					$site_title = trim($field['site_title']);
2472
+					$type = $field;
2473
+					$html = '';
2474
+					$html_var = $field_name;
2475
+					$field_icon = '';
2476
+					$variables_array = array();
2477
+
2478
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2479
+						continue;
2480
+					}
2481
+
2482
+					if ($type['type'] != 'fieldset') {
2483
+						$i++;
2484
+						$variables_array['post_id'] = $post->ID;
2485
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2486
+						$variables_array['value'] = '';
2487
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2488
+					}
2489
+
2490
+					if (strpos($type['field_icon'], 'http') !== false) {
2491
+						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2492
+					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2493
+						$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2494
+					}
2495
+
2496
+					switch ($type['type']) {
2497
+						case 'fieldset': {
2498
+							$i = 0;
2499
+							$fieldset_count++;
2500
+							$field_set_start = 1;
2501
+							$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2502
+							$fieldset_arr[$fieldset_count]['label'] = $label;
2503
+						}
2504
+							break;
2505
+						case 'url': {
2506
+							if (strpos($field_icon, 'http') !== false) {
2507
+								$field_icon_af = '';
2508
+							} elseif ($field_icon == '') {
2509
+
2510
+								if ($type['name'] == 'geodir_facebook') {
2511
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2512
+								} elseif ($type['name'] == 'geodir_twitter') {
2513
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2514
+								} else {
2515
+									$field_icon_af = '<i class="fa fa-link"></i>';
2516
+								}
2517
+
2518
+							} else {
2519
+								$field_icon_af = $field_icon;
2520
+								$field_icon = '';
2521
+							}
2522 2522
                             
2523
-                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2524
-
2525
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2526
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2527
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2528
-
2529
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2530
-
2531
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2532
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2533
-
2534
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2535
-                                /**
2536
-                                 * Filer the custom field website name.
2537
-                                 *
2538
-                                 * @since 1.0.0
2539
-                                 * @param string $title The field name default: "Website".
2540
-                                 * @param string $website The website address.
2541
-                                 * @param int $post->ID The post ID.
2542
-                                 */
2543
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2544
-                        }
2545
-                            break;
2546
-                        case 'phone': {
2547
-                            if (strpos($field_icon, 'http') !== false) {
2548
-                                $field_icon_af = '';
2549
-                            } elseif ($field_icon == '') {
2550
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2551
-                            } else {
2552
-                                $field_icon_af = $field_icon;
2553
-                                $field_icon = '';
2554
-                            }
2555
-
2556
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2557
-
2558
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2559
-                            if ($field_set_start == 1 && $site_title != '') {
2560
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2561
-                            }
2562
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2563
-                        }
2564
-                            break;
2565
-                        case 'time': {
2566
-                            $value = '';
2567
-                            if ($post->{$type['htmlvar_name']} != '')
2568
-                                $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2569
-
2570
-                            if (strpos($field_icon, 'http') !== false) {
2571
-                                $field_icon_af = '';
2572
-                            } elseif ($field_icon == '') {
2573
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2574
-                            } else {
2575
-                                $field_icon_af = $field_icon;
2576
-                                $field_icon = '';
2577
-                            }
2578
-
2579
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2580
-
2581
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2582
-                            if ($field_set_start == 1 && $site_title != '') {
2583
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2584
-                            }
2585
-                            $html .= ' </span>' . stripslashes($value) . '</div>';
2586
-                        }
2587
-                            break;
2588
-                        case 'datepicker': {
2589
-                            $date_format = geodir_default_date_format();
2590
-                            if ($type['extra_fields'] != '') {
2591
-                                $date_format = unserialize($type['extra_fields']);
2592
-                                $date_format = $date_format['date_format'];
2593
-                            }
2594
-
2595
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2596
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2597
-
2598
-                            $date_format = str_replace($search, $replace, $date_format);
2599
-
2600
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2601
-
2602
-                            $value = '';
2603
-                            if ($post->{$type['htmlvar_name']} != '')
2604
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2605
-
2606
-                            if (strpos($field_icon, 'http') !== false) {
2607
-                                $field_icon_af = '';
2608
-                            } elseif ($field_icon == '') {
2609
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2610
-                            } else {
2611
-                                $field_icon_af = $field_icon;
2612
-                                $field_icon = '';
2613
-                            }
2614
-
2615
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2616
-
2617
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2618
-                            if ($field_set_start == 1 && $site_title != '') {
2619
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2620
-                            }
2621
-                            $html .= ' </span>' . $value . '</div>';
2622
-                        }
2623
-                            break;
2624
-                        case 'text': {
2625
-                            if (strpos($field_icon, 'http') !== false) {
2626
-                                $field_icon_af = '';
2627
-                            } elseif ($field_icon == '') {
2628
-                                $field_icon_af = '';
2629
-                            } else {
2630
-                                $field_icon_af = $field_icon;
2631
-                                $field_icon = '';
2632
-                            }
2633
-
2634
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2635
-
2636
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2637
-                            if ($field_set_start == 1 && $site_title != '') {
2638
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2639
-                            }
2640
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2641
-                        }
2642
-                            break;
2643
-                        case 'radio': {
2644
-
2645
-                            if ($post->{$type['htmlvar_name']} != '') {
2646
-                                if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2647
-                                    $html_val = __('No', 'geodirectory');
2648
-                                } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2649
-                                    $html_val = __('Yes', 'geodirectory');
2650
-                                } else {
2651
-                                    $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2523
+							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2524
+
2525
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2526
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2527
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2528
+
2529
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2530
+
2531
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2532
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2533
+
2534
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2535
+								/**
2536
+								 * Filer the custom field website name.
2537
+								 *
2538
+								 * @since 1.0.0
2539
+								 * @param string $title The field name default: "Website".
2540
+								 * @param string $website The website address.
2541
+								 * @param int $post->ID The post ID.
2542
+								 */
2543
+								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2544
+						}
2545
+							break;
2546
+						case 'phone': {
2547
+							if (strpos($field_icon, 'http') !== false) {
2548
+								$field_icon_af = '';
2549
+							} elseif ($field_icon == '') {
2550
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2551
+							} else {
2552
+								$field_icon_af = $field_icon;
2553
+								$field_icon = '';
2554
+							}
2555
+
2556
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2557
+
2558
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2559
+							if ($field_set_start == 1 && $site_title != '') {
2560
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2561
+							}
2562
+							$html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2563
+						}
2564
+							break;
2565
+						case 'time': {
2566
+							$value = '';
2567
+							if ($post->{$type['htmlvar_name']} != '')
2568
+								$value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2569
+
2570
+							if (strpos($field_icon, 'http') !== false) {
2571
+								$field_icon_af = '';
2572
+							} elseif ($field_icon == '') {
2573
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2574
+							} else {
2575
+								$field_icon_af = $field_icon;
2576
+								$field_icon = '';
2577
+							}
2578
+
2579
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2580
+
2581
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2582
+							if ($field_set_start == 1 && $site_title != '') {
2583
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2584
+							}
2585
+							$html .= ' </span>' . stripslashes($value) . '</div>';
2586
+						}
2587
+							break;
2588
+						case 'datepicker': {
2589
+							$date_format = geodir_default_date_format();
2590
+							if ($type['extra_fields'] != '') {
2591
+								$date_format = unserialize($type['extra_fields']);
2592
+								$date_format = $date_format['date_format'];
2593
+							}
2594
+
2595
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2596
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
2597
+
2598
+							$date_format = str_replace($search, $replace, $date_format);
2599
+
2600
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2601
+
2602
+							$value = '';
2603
+							if ($post->{$type['htmlvar_name']} != '')
2604
+								$value = date($date_format, strtotime($post_htmlvar_value));
2605
+
2606
+							if (strpos($field_icon, 'http') !== false) {
2607
+								$field_icon_af = '';
2608
+							} elseif ($field_icon == '') {
2609
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2610
+							} else {
2611
+								$field_icon_af = $field_icon;
2612
+								$field_icon = '';
2613
+							}
2614
+
2615
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2616
+
2617
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2618
+							if ($field_set_start == 1 && $site_title != '') {
2619
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2620
+							}
2621
+							$html .= ' </span>' . $value . '</div>';
2622
+						}
2623
+							break;
2624
+						case 'text': {
2625
+							if (strpos($field_icon, 'http') !== false) {
2626
+								$field_icon_af = '';
2627
+							} elseif ($field_icon == '') {
2628
+								$field_icon_af = '';
2629
+							} else {
2630
+								$field_icon_af = $field_icon;
2631
+								$field_icon = '';
2632
+							}
2633
+
2634
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2635
+
2636
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2637
+							if ($field_set_start == 1 && $site_title != '') {
2638
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2639
+							}
2640
+							$html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2641
+						}
2642
+							break;
2643
+						case 'radio': {
2644
+
2645
+							if ($post->{$type['htmlvar_name']} != '') {
2646
+								if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2647
+									$html_val = __('No', 'geodirectory');
2648
+								} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2649
+									$html_val = __('Yes', 'geodirectory');
2650
+								} else {
2651
+									$html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2652 2652
                                     
2653
-                                    if (!empty($type['option_values'])) {
2654
-                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2653
+									if (!empty($type['option_values'])) {
2654
+										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2655 2655
                                         
2656
-                                        if (!empty($cf_option_values)) {
2657
-                                            foreach ($cf_option_values as $cf_option_value) {
2658
-                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2659
-                                                    $html_val = $cf_option_value['label'];
2660
-                                                }
2661
-                                            }
2662
-                                        }
2663
-                                    }
2664
-                                }
2665
-
2666
-                                if (strpos($field_icon, 'http') !== false) {
2667
-                                    $field_icon_af = '';
2668
-                                } else if ($field_icon == '') {
2669
-                                    $field_icon_af = '';
2670
-                                } else {
2671
-                                    $field_icon_af = $field_icon;
2672
-                                    $field_icon = '';
2673
-                                }
2674
-
2675
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2676
-
2677
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2678
-
2679
-                                if ($field_set_start == 1 && $site_title != '') {
2680
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2681
-                                }
2682
-
2683
-                                $html .= ' </span>' . $html_val . '</div>';
2684
-                            }
2685
-                        }
2686
-                            break;
2687
-                        case 'checkbox': {
2688
-                            $html_var = $type['htmlvar_name'];
2689
-                            $html_val = $type['htmlvar_name'];
2690
-
2691
-                            if ((int)$post->{$html_var} == 1) {
2692
-
2693
-                                if ($post->{$type['htmlvar_name']} == '1') {
2694
-                                    $html_val = __('Yes', 'geodirectory');
2695
-                                } else {
2696
-                                    $html_val = __('No', 'geodirectory');
2697
-                                }
2698
-
2699
-                                if (strpos($field_icon, 'http') !== false) {
2700
-                                    $field_icon_af = '';
2701
-                                } else if ($field_icon == '') {
2702
-                                    $field_icon_af = '';
2703
-                                } else {
2704
-                                    $field_icon_af = $field_icon;
2705
-                                    $field_icon = '';
2706
-                                }
2707
-
2708
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2709
-
2710
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2711
-
2712
-                                if ($field_set_start == 1 && $site_title != '') {
2713
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2714
-                                }
2715
-
2716
-                                $html .= ' </span>' . $html_val . '</div>';
2717
-                            }
2718
-                        }
2719
-                            break;
2720
-                        case 'select': {
2721
-                            if (strpos($field_icon, 'http') !== false) {
2722
-                                $field_icon_af = '';
2723
-                            } elseif ($field_icon == '') {
2724
-                                $field_icon_af = '';
2725
-                            } else {
2726
-                                $field_icon_af = $field_icon;
2727
-                                $field_icon = '';
2728
-                            }
2656
+										if (!empty($cf_option_values)) {
2657
+											foreach ($cf_option_values as $cf_option_value) {
2658
+												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2659
+													$html_val = $cf_option_value['label'];
2660
+												}
2661
+											}
2662
+										}
2663
+									}
2664
+								}
2665
+
2666
+								if (strpos($field_icon, 'http') !== false) {
2667
+									$field_icon_af = '';
2668
+								} else if ($field_icon == '') {
2669
+									$field_icon_af = '';
2670
+								} else {
2671
+									$field_icon_af = $field_icon;
2672
+									$field_icon = '';
2673
+								}
2674
+
2675
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2676
+
2677
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2678
+
2679
+								if ($field_set_start == 1 && $site_title != '') {
2680
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2681
+								}
2682
+
2683
+								$html .= ' </span>' . $html_val . '</div>';
2684
+							}
2685
+						}
2686
+							break;
2687
+						case 'checkbox': {
2688
+							$html_var = $type['htmlvar_name'];
2689
+							$html_val = $type['htmlvar_name'];
2690
+
2691
+							if ((int)$post->{$html_var} == 1) {
2692
+
2693
+								if ($post->{$type['htmlvar_name']} == '1') {
2694
+									$html_val = __('Yes', 'geodirectory');
2695
+								} else {
2696
+									$html_val = __('No', 'geodirectory');
2697
+								}
2698
+
2699
+								if (strpos($field_icon, 'http') !== false) {
2700
+									$field_icon_af = '';
2701
+								} else if ($field_icon == '') {
2702
+									$field_icon_af = '';
2703
+								} else {
2704
+									$field_icon_af = $field_icon;
2705
+									$field_icon = '';
2706
+								}
2707
+
2708
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2709
+
2710
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2711
+
2712
+								if ($field_set_start == 1 && $site_title != '') {
2713
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2714
+								}
2715
+
2716
+								$html .= ' </span>' . $html_val . '</div>';
2717
+							}
2718
+						}
2719
+							break;
2720
+						case 'select': {
2721
+							if (strpos($field_icon, 'http') !== false) {
2722
+								$field_icon_af = '';
2723
+							} elseif ($field_icon == '') {
2724
+								$field_icon_af = '';
2725
+							} else {
2726
+								$field_icon_af = $field_icon;
2727
+								$field_icon = '';
2728
+							}
2729 2729
                             
2730
-                            $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2730
+							$field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2731 2731
                             
2732
-                            if (!empty($type['option_values'])) {
2733
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2732
+							if (!empty($type['option_values'])) {
2733
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2734 2734
                                 
2735
-                                if (!empty($cf_option_values)) {
2736
-                                    foreach ($cf_option_values as $cf_option_value) {
2737
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2738
-                                            $field_value = $cf_option_value['label'];
2739
-                                        }
2740
-                                    }
2741
-                                }
2742
-                            }
2743
-
2744
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2745
-
2746
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2747
-                            if ($field_set_start == 1 && $site_title != '') {
2748
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2749
-                            }
2750
-                            $html .= ' </span>' . $field_value . '</div>';
2751
-                        }
2752
-                            break;
2753
-                        case 'multiselect': {
2754
-                            if (is_array($post->{$type['htmlvar_name']})) {
2755
-                                $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2756
-                            }
2757
-
2758
-                            if (strpos($field_icon, 'http') !== false) {
2759
-                                $field_icon_af = '';
2760
-                            } elseif ($field_icon == '') {
2761
-                                $field_icon_af = '';
2762
-                            } else {
2763
-                                $field_icon_af = $field_icon;
2764
-                                $field_icon = '';
2765
-                            }
2766
-
2767
-                            $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2768
-
2769
-                            $option_values = array();
2770
-                            if (!empty($type['option_values'])) {
2771
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2735
+								if (!empty($cf_option_values)) {
2736
+									foreach ($cf_option_values as $cf_option_value) {
2737
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2738
+											$field_value = $cf_option_value['label'];
2739
+										}
2740
+									}
2741
+								}
2742
+							}
2743
+
2744
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2745
+
2746
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2747
+							if ($field_set_start == 1 && $site_title != '') {
2748
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2749
+							}
2750
+							$html .= ' </span>' . $field_value . '</div>';
2751
+						}
2752
+							break;
2753
+						case 'multiselect': {
2754
+							if (is_array($post->{$type['htmlvar_name']})) {
2755
+								$post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2756
+							}
2757
+
2758
+							if (strpos($field_icon, 'http') !== false) {
2759
+								$field_icon_af = '';
2760
+							} elseif ($field_icon == '') {
2761
+								$field_icon_af = '';
2762
+							} else {
2763
+								$field_icon_af = $field_icon;
2764
+								$field_icon = '';
2765
+							}
2766
+
2767
+							$field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2768
+
2769
+							$option_values = array();
2770
+							if (!empty($type['option_values'])) {
2771
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2772 2772
                                 
2773
-                                if (!empty($cf_option_values)) {
2774
-                                    foreach ($cf_option_values as $cf_option_value) {
2775
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2776
-                                            $option_values[] = $cf_option_value['label'];
2777
-                                        }
2778
-                                    }
2779
-                                }
2780
-                            }
2781
-
2782
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2783
-
2784
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2785
-                            if ($field_set_start == 1 && $site_title != '') {
2786
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2787
-                            }
2788
-                            $html .= ' </span>';
2789
-
2790
-                            if (count($option_values) > 1) {
2791
-                                $html .= '<ul>';
2792
-                                foreach ($option_values as $val) {
2793
-                                    $html .= '<li>' . $val . '</li>';
2794
-                                }
2795
-                                $html .= '</ul>';
2796
-                            } else {
2797
-                                $html .= $post->{$type['htmlvar_name']};
2798
-                            }
2799
-                            $html .= '</div>';
2800
-                        }
2801
-                            break;
2802
-                        case 'email': {
2803
-                            if (strpos($field_icon, 'http') !== false) {
2804
-                                $field_icon_af = '';
2805
-                            } elseif ($field_icon == '') {
2806
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2807
-                            } else {
2808
-                                $field_icon_af = $field_icon;
2809
-                                $field_icon = '';
2810
-                            }
2811
-
2812
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2813
-
2814
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2815
-                            if ($field_set_start == 1 && $site_title != '') {
2816
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2817
-                            }
2818
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2819
-                        }
2820
-                            break;
2821
-                        case 'textarea': {
2822
-                            if (strpos($field_icon, 'http') !== false) {
2823
-                                $field_icon_af = '';
2824
-                            } elseif ($field_icon == '') {
2825
-                                $field_icon_af = '';
2826
-                            } else {
2827
-                                $field_icon_af = $field_icon;
2828
-                                $field_icon = '';
2829
-                            }
2830
-
2831
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2832
-
2833
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2834
-                            if ($field_set_start == 1 && $site_title != '') {
2835
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2836
-                            }
2837
-                            $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2838
-                        }
2839
-                            break;
2840
-                        case 'html': {
2841
-                            if (strpos($field_icon, 'http') !== false) {
2842
-                                $field_icon_af = '';
2843
-                            } elseif ($field_icon == '') {
2844
-                                $field_icon_af = '';
2845
-                            } else {
2846
-                                $field_icon_af = $field_icon;
2847
-                                $field_icon = '';
2848
-                            }
2849
-
2850
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2851
-
2852
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2853
-                            if ($field_set_start == 1 && $site_title != '') {
2854
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2855
-                            }
2856
-                            $html .= ' </span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2857
-                        }
2858
-                        break;
2859
-                        case 'file': {
2860
-                            $html_var = $type['htmlvar_name'];
2861
-
2862
-                            if (!empty($post->{$type['htmlvar_name']})) {
2863
-                                $files = explode(",", $post->{$type['htmlvar_name']});
2864
-
2865
-                                if (!empty($files)) {
2866
-                                    $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2867
-                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2773
+								if (!empty($cf_option_values)) {
2774
+									foreach ($cf_option_values as $cf_option_value) {
2775
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2776
+											$option_values[] = $cf_option_value['label'];
2777
+										}
2778
+									}
2779
+								}
2780
+							}
2781
+
2782
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2783
+
2784
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2785
+							if ($field_set_start == 1 && $site_title != '') {
2786
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2787
+							}
2788
+							$html .= ' </span>';
2789
+
2790
+							if (count($option_values) > 1) {
2791
+								$html .= '<ul>';
2792
+								foreach ($option_values as $val) {
2793
+									$html .= '<li>' . $val . '</li>';
2794
+								}
2795
+								$html .= '</ul>';
2796
+							} else {
2797
+								$html .= $post->{$type['htmlvar_name']};
2798
+							}
2799
+							$html .= '</div>';
2800
+						}
2801
+							break;
2802
+						case 'email': {
2803
+							if (strpos($field_icon, 'http') !== false) {
2804
+								$field_icon_af = '';
2805
+							} elseif ($field_icon == '') {
2806
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2807
+							} else {
2808
+								$field_icon_af = $field_icon;
2809
+								$field_icon = '';
2810
+							}
2811
+
2812
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2813
+
2814
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2815
+							if ($field_set_start == 1 && $site_title != '') {
2816
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2817
+							}
2818
+							$html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2819
+						}
2820
+							break;
2821
+						case 'textarea': {
2822
+							if (strpos($field_icon, 'http') !== false) {
2823
+								$field_icon_af = '';
2824
+							} elseif ($field_icon == '') {
2825
+								$field_icon_af = '';
2826
+							} else {
2827
+								$field_icon_af = $field_icon;
2828
+								$field_icon = '';
2829
+							}
2830
+
2831
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2832
+
2833
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2834
+							if ($field_set_start == 1 && $site_title != '') {
2835
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2836
+							}
2837
+							$html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2838
+						}
2839
+							break;
2840
+						case 'html': {
2841
+							if (strpos($field_icon, 'http') !== false) {
2842
+								$field_icon_af = '';
2843
+							} elseif ($field_icon == '') {
2844
+								$field_icon_af = '';
2845
+							} else {
2846
+								$field_icon_af = $field_icon;
2847
+								$field_icon = '';
2848
+							}
2849
+
2850
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2851
+
2852
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2853
+							if ($field_set_start == 1 && $site_title != '') {
2854
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2855
+							}
2856
+							$html .= ' </span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2857
+						}
2858
+						break;
2859
+						case 'file': {
2860
+							$html_var = $type['htmlvar_name'];
2861
+
2862
+							if (!empty($post->{$type['htmlvar_name']})) {
2863
+								$files = explode(",", $post->{$type['htmlvar_name']});
2864
+
2865
+								if (!empty($files)) {
2866
+									$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2867
+									$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2868 2868
                                
2869
-                                    $file_paths = '';
2870
-                                    foreach ($files as $file) {
2871
-                                        if (!empty($file)) {
2872
-                                            $image_name_arr = explode('/', $file);
2873
-                                            $filename = end($image_name_arr);
2874
-
2875
-                                            $arr_file_type = wp_check_filetype($filename);
2876
-                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2877
-                                                continue;
2878
-                                            }
2879
-                                            $uploaded_file_type = $arr_file_type['type'];
2880
-                                            $uploaded_file_ext = $arr_file_type['ext'];
2869
+									$file_paths = '';
2870
+									foreach ($files as $file) {
2871
+										if (!empty($file)) {
2872
+											$image_name_arr = explode('/', $file);
2873
+											$filename = end($image_name_arr);
2874
+
2875
+											$arr_file_type = wp_check_filetype($filename);
2876
+											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2877
+												continue;
2878
+											}
2879
+											$uploaded_file_type = $arr_file_type['type'];
2880
+											$uploaded_file_ext = $arr_file_type['ext'];
2881 2881
                                             
2882
-                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2883
-                                                continue; // Invalid file type.
2884
-                                            }
2885
-
2886
-                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2887
-
2888
-                                            // If the uploaded file is image
2889
-                                            if (in_array($uploaded_file_type, $image_file_types)) {
2890
-                                                $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2891
-                                                $file_paths .= '<a href="'.$file.'">';
2892
-                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2893
-                                                $file_paths .= '</a>';
2894
-                                                $file_paths .= '</div>';
2895
-                                            } else {
2896
-                                                $ext_path = '_' . $html_var . '_';
2897
-                                                $filename = explode($ext_path, $filename);
2898
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2899
-                                            }
2900
-                                        }
2901
-                                    }
2902
-
2903
-                                    if (strpos($field_icon, 'http') !== false) {
2904
-                                        $field_icon_af = '';
2905
-                                    } else if ($field_icon == '') {
2906
-                                        $field_icon_af = '';
2907
-                                    } else {
2908
-                                        $field_icon_af = $field_icon;
2909
-                                        $field_icon = '';
2910
-                                    }
2911
-
2912
-                                    $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2913
-
2914
-
2915
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2916
-
2917
-                                    if ($field_set_start == 1 && $site_title != '') {
2918
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2919
-                                    }
2920
-
2921
-                                    $html .= ' </span>' . $file_paths . '</div>';
2922
-                                }
2923
-                            }
2924
-                        }
2925
-                            break;
2926
-                    }
2927
-
2928
-
2929
-                    /**
2930
-                     * Filter custom field output in tab.
2931
-                     *
2932
-                     * @since 1.5.6
2933
-                     *
2934
-                     * @param string $html_var The HTML variable name for the field.
2935
-                     * @param string $html Custom field unfiltered HTML.
2936
-                     * @param array $variables_array Custom field variables array.
2937
-                     */
2938
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2939
-
2940
-                    $fieldset_html = '';
2941
-                    if ($field_set_start == 1) {
2942
-                        $add_html = false;
2943
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2944
-                            if ($fieldset != '') {
2945
-                                $add_html = true;
2946
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2947
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2948
-                            }
2949
-                            $fieldset_html = $fieldset;
2950
-                            $fieldset = '';
2951
-                        } else {
2952
-                            $fieldset .= $html;
2953
-                            if ($total_fields == $count_field && $fieldset != '') {
2954
-                                $add_html = true;
2955
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2956
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2957
-                                $fieldset_html = $fieldset;
2958
-                            }
2959
-                        }
2960
-
2961
-                        if ($add_html) {
2962
-                            $tabs_arr[$htmlvar_name] = array(
2963
-                                'heading_text' => __($label, 'geodirectory'),
2964
-                                'is_active_tab' => false,
2965
-                                /**
2966
-                                 * Filter if a custom field should be displayed on the details page tab.
2967
-                                 *
2968
-                                 * @since 1.0.0
2969
-                                 * @param string $htmlvar_name The field HTML var name.
2970
-                                 */
2971
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2972
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2973
-                            );
2974
-                        }
2975
-                    } else {
2976
-                        if ($html != '') {
2977
-                            $tabs_arr[$field['htmlvar_name']] = array(
2978
-                                'heading_text' => __($label, 'geodirectory'),
2979
-                                'is_active_tab' => false,
2980
-                                /** This action is documented in geodirectory_hooks_actions.php */
2981
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2982
-                                'tab_content' => $html
2983
-                            );
2984
-                        }
2985
-                    }
2986
-                }
2987
-            }
2988
-        }
2989
-    }
2990
-    return $tabs_arr;
2882
+											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2883
+												continue; // Invalid file type.
2884
+											}
2885
+
2886
+											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2887
+
2888
+											// If the uploaded file is image
2889
+											if (in_array($uploaded_file_type, $image_file_types)) {
2890
+												$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2891
+												$file_paths .= '<a href="'.$file.'">';
2892
+												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2893
+												$file_paths .= '</a>';
2894
+												$file_paths .= '</div>';
2895
+											} else {
2896
+												$ext_path = '_' . $html_var . '_';
2897
+												$filename = explode($ext_path, $filename);
2898
+												$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2899
+											}
2900
+										}
2901
+									}
2902
+
2903
+									if (strpos($field_icon, 'http') !== false) {
2904
+										$field_icon_af = '';
2905
+									} else if ($field_icon == '') {
2906
+										$field_icon_af = '';
2907
+									} else {
2908
+										$field_icon_af = $field_icon;
2909
+										$field_icon = '';
2910
+									}
2911
+
2912
+									$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2913
+
2914
+
2915
+									$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2916
+
2917
+									if ($field_set_start == 1 && $site_title != '') {
2918
+										$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2919
+									}
2920
+
2921
+									$html .= ' </span>' . $file_paths . '</div>';
2922
+								}
2923
+							}
2924
+						}
2925
+							break;
2926
+					}
2927
+
2928
+
2929
+					/**
2930
+					 * Filter custom field output in tab.
2931
+					 *
2932
+					 * @since 1.5.6
2933
+					 *
2934
+					 * @param string $html_var The HTML variable name for the field.
2935
+					 * @param string $html Custom field unfiltered HTML.
2936
+					 * @param array $variables_array Custom field variables array.
2937
+					 */
2938
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2939
+
2940
+					$fieldset_html = '';
2941
+					if ($field_set_start == 1) {
2942
+						$add_html = false;
2943
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2944
+							if ($fieldset != '') {
2945
+								$add_html = true;
2946
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2947
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2948
+							}
2949
+							$fieldset_html = $fieldset;
2950
+							$fieldset = '';
2951
+						} else {
2952
+							$fieldset .= $html;
2953
+							if ($total_fields == $count_field && $fieldset != '') {
2954
+								$add_html = true;
2955
+								$label = $fieldset_arr[$fieldset_count]['label'];
2956
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2957
+								$fieldset_html = $fieldset;
2958
+							}
2959
+						}
2960
+
2961
+						if ($add_html) {
2962
+							$tabs_arr[$htmlvar_name] = array(
2963
+								'heading_text' => __($label, 'geodirectory'),
2964
+								'is_active_tab' => false,
2965
+								/**
2966
+								 * Filter if a custom field should be displayed on the details page tab.
2967
+								 *
2968
+								 * @since 1.0.0
2969
+								 * @param string $htmlvar_name The field HTML var name.
2970
+								 */
2971
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2972
+								'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2973
+							);
2974
+						}
2975
+					} else {
2976
+						if ($html != '') {
2977
+							$tabs_arr[$field['htmlvar_name']] = array(
2978
+								'heading_text' => __($label, 'geodirectory'),
2979
+								'is_active_tab' => false,
2980
+								/** This action is documented in geodirectory_hooks_actions.php */
2981
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2982
+								'tab_content' => $html
2983
+							);
2984
+						}
2985
+					}
2986
+				}
2987
+			}
2988
+		}
2989
+	}
2990
+	return $tabs_arr;
2991 2991
 }
2992 2992
 
2993 2993
 /* display add listing page for wpml */
@@ -3011,37 +3011,37 @@  discard block
 block discarded – undo
3011 3011
  */
3012 3012
 function geodir_add_post_status_author_page()
3013 3013
 {
3014
-    global $wpdb, $post;
3015
-
3016
-    $html = '';
3017
-    if (get_current_user_id()) {
3018
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3019
-
3020
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3021
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3022
-            $status = "<strong>(";
3023
-            $status_icon = '<i class="fa fa-play"></i>';
3024
-            if ($real_status == 'publish') {
3025
-                $status .= __('Published', 'geodirectory');
3026
-            } else {
3027
-                $status .= __('Not published', 'geodirectory');
3028
-                $status_icon = '<i class="fa fa-pause"></i>';
3029
-            }
3030
-            $status .= ")</strong>";
3014
+	global $wpdb, $post;
3015
+
3016
+	$html = '';
3017
+	if (get_current_user_id()) {
3018
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3019
+
3020
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3021
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3022
+			$status = "<strong>(";
3023
+			$status_icon = '<i class="fa fa-play"></i>';
3024
+			if ($real_status == 'publish') {
3025
+				$status .= __('Published', 'geodirectory');
3026
+			} else {
3027
+				$status .= __('Not published', 'geodirectory');
3028
+				$status_icon = '<i class="fa fa-pause"></i>';
3029
+			}
3030
+			$status .= ")</strong>";
3031 3031
 
3032
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3033
-        }
3034
-    }
3032
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3033
+		}
3034
+	}
3035 3035
 
3036
-    if ($html != '') {
3037
-        /**
3038
-         * Filter the post status text on the author page.
3039
-         *
3040
-         * @since 1.0.0
3041
-         * @param string $html The HTML of the status.
3042
-         */
3043
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3044
-    }
3036
+	if ($html != '') {
3037
+		/**
3038
+		 * Filter the post status text on the author page.
3039
+		 *
3040
+		 * @since 1.0.0
3041
+		 * @param string $html The HTML of the status.
3042
+		 */
3043
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3044
+	}
3045 3045
 
3046 3046
 
3047 3047
 }
@@ -3055,21 +3055,21 @@  discard block
 block discarded – undo
3055 3055
  */
3056 3056
 function geodir_init_no_rating()
3057 3057
 {
3058
-    if (get_option('geodir_disable_rating')) {
3059
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3060
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3061
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3062
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3063
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3064
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3065
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3066
-
3067
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3068
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3069
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3070
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3071
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3072
-    }
3058
+	if (get_option('geodir_disable_rating')) {
3059
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3060
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3061
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3062
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3063
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3064
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3065
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3066
+
3067
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3068
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3069
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3070
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3071
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3072
+	}
3073 3073
 }
3074 3074
 
3075 3075
 /**
@@ -3081,20 +3081,20 @@  discard block
 block discarded – undo
3081 3081
  */
3082 3082
 function geodir_no_rating_rating_fields()
3083 3083
 {
3084
-    global $post;
3084
+	global $post;
3085 3085
 
3086
-    $post_types = geodir_get_posttypes();
3086
+	$post_types = geodir_get_posttypes();
3087 3087
 
3088
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3089
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3090
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3091
-            if (get_option('geodir_reviewrating_enable_images')) {
3092
-                geodir_reviewrating_rating_img_html();
3093
-            }
3094
-        } else {
3095
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3096
-        }
3097
-    }
3088
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3089
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3090
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3091
+			if (get_option('geodir_reviewrating_enable_images')) {
3092
+				geodir_reviewrating_rating_img_html();
3093
+			}
3094
+		} else {
3095
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3096
+		}
3097
+	}
3098 3098
 }
3099 3099
 
3100 3100
 /**
@@ -3108,11 +3108,11 @@  discard block
 block discarded – undo
3108 3108
  */
3109 3109
 function geodir_no_rating_comment_text($content, $comment = '')
3110 3110
 {
3111
-    if (!is_admin()) {
3112
-        return '<div class="description">' . $content . '</div>';
3113
-    } else {
3114
-        return $content;
3115
-    }
3111
+	if (!is_admin()) {
3112
+		return '<div class="description">' . $content . '</div>';
3113
+	} else {
3114
+		return $content;
3115
+	}
3116 3116
 }
3117 3117
 
3118 3118
 /**
@@ -3125,7 +3125,7 @@  discard block
 block discarded – undo
3125 3125
  */
3126 3126
 function geodir_no_rating_review_rating_html($content = '')
3127 3127
 {
3128
-    return NULL;
3128
+	return NULL;
3129 3129
 }
3130 3130
 
3131 3131
 /**
@@ -3139,19 +3139,19 @@  discard block
 block discarded – undo
3139 3139
  */
3140 3140
 function geodir_no_rating_get_sort_options($options, $post_type = '')
3141 3141
 {
3142
-    $new_options = array();
3143
-    if (!empty($options)) {
3144
-        foreach ($options as $option) {
3145
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3146
-                continue;
3147
-            }
3148
-            $new_options[] = $option;
3149
-        }
3142
+	$new_options = array();
3143
+	if (!empty($options)) {
3144
+		foreach ($options as $option) {
3145
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3146
+				continue;
3147
+			}
3148
+			$new_options[] = $option;
3149
+		}
3150 3150
 
3151
-        $options = $new_options;
3152
-    }
3151
+		$options = $new_options;
3152
+	}
3153 3153
 
3154
-    return $options;
3154
+	return $options;
3155 3155
 }
3156 3156
 
3157 3157
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -3165,11 +3165,11 @@  discard block
 block discarded – undo
3165 3165
  */
3166 3166
 function geodir_all_js_msg_no_rating($msg = array())
3167 3167
 {
3168
-    if (get_option('geodir_disable_rating')) {
3169
-        $msg['gd_cmt_no_rating'] = true;
3170
-    }
3168
+	if (get_option('geodir_disable_rating')) {
3169
+		$msg['gd_cmt_no_rating'] = true;
3170
+	}
3171 3171
 
3172
-    return $msg;
3172
+	return $msg;
3173 3173
 }
3174 3174
 
3175 3175
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -3183,13 +3183,13 @@  discard block
 block discarded – undo
3183 3183
  */
3184 3184
 function geodir_body_class_no_rating($classes = array())
3185 3185
 {
3186
-    if (get_option('geodir_disable_rating')) {
3187
-        $classes[] = 'gd-no-rating';
3188
-    }
3186
+	if (get_option('geodir_disable_rating')) {
3187
+		$classes[] = 'gd-no-rating';
3188
+	}
3189 3189
     
3190
-    $classes[] = 'gd-map-' . geodir_map_name();
3190
+	$classes[] = 'gd-map-' . geodir_map_name();
3191 3191
 
3192
-    return $classes;
3192
+	return $classes;
3193 3193
 }
3194 3194
 
3195 3195
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -3203,13 +3203,13 @@  discard block
 block discarded – undo
3203 3203
  */
3204 3204
 function geodir_admin_body_class_no_rating($class = '')
3205 3205
 {
3206
-    if (get_option('geodir_disable_rating')) {
3207
-        $class .= ' gd-no-rating';
3208
-    }
3206
+	if (get_option('geodir_disable_rating')) {
3207
+		$class .= ' gd-no-rating';
3208
+	}
3209 3209
     
3210
-    $class .= ' gd-map-' . geodir_map_name();
3210
+	$class .= ' gd-map-' . geodir_map_name();
3211 3211
 
3212
-    return $class;
3212
+	return $class;
3213 3213
 }
3214 3214
 
3215 3215
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -3222,10 +3222,10 @@  discard block
 block discarded – undo
3222 3222
  */
3223 3223
 function geodir_wp_head_no_rating()
3224 3224
 {
3225
-    if (get_option('geodir_disable_rating')) {
3226
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3227
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3228
-    }
3225
+	if (get_option('geodir_disable_rating')) {
3226
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3227
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3228
+	}
3229 3229
 }
3230 3230
 
3231 3231
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -3242,36 +3242,36 @@  discard block
 block discarded – undo
3242 3242
  * @return array Translation texts.
3243 3243
  */
3244 3244
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3245
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3246
-
3247
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3248
-
3249
-    /**
3250
-     * Filters the geodirectory option names that requires to add for translation.
3251
-     *
3252
-     * @since 1.5.7
3253
-     * @package GeoDirectory
3254
-     *
3255
-     * @param  array $gd_options Array of option names.
3256
-     */
3257
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3258
-    $gd_options = array_unique($gd_options);
3259
-
3260
-    if (!empty($gd_options)) {
3261
-        foreach ($gd_options as $gd_option) {
3262
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3263
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3245
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3246
+
3247
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3248
+
3249
+	/**
3250
+	 * Filters the geodirectory option names that requires to add for translation.
3251
+	 *
3252
+	 * @since 1.5.7
3253
+	 * @package GeoDirectory
3254
+	 *
3255
+	 * @param  array $gd_options Array of option names.
3256
+	 */
3257
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3258
+	$gd_options = array_unique($gd_options);
3259
+
3260
+	if (!empty($gd_options)) {
3261
+		foreach ($gd_options as $gd_option) {
3262
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3263
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3264 3264
                 
3265
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3266
-                    $translation_texts[] = stripslashes_deep($option_value);
3267
-                }
3268
-            }
3269
-        }
3270
-    }
3265
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3266
+					$translation_texts[] = stripslashes_deep($option_value);
3267
+				}
3268
+			}
3269
+		}
3270
+	}
3271 3271
 
3272
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3272
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3273 3273
 
3274
-    return $translation_texts;
3274
+	return $translation_texts;
3275 3275
 }
3276 3276
 
3277 3277
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 1 patch
Indentation   +2824 added lines, -2824 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 function geodir_deactivation()
16 16
 {
17 17
 
18
-    // Update installed variable
19
-    update_option("geodir_installed", 0);
18
+	// Update installed variable
19
+	update_option("geodir_installed", 0);
20 20
 
21
-    // Remove rewrite rules and then recreate rewrite rules.
22
-    flush_rewrite_rules();
21
+	// Remove rewrite rules and then recreate rewrite rules.
22
+	flush_rewrite_rules();
23 23
 }
24 24
 
25 25
 
@@ -32,124 +32,124 @@  discard block
 block discarded – undo
32 32
 function geodir_uninstall()
33 33
 {
34 34
 
35
-    delete_option('geodir_default_data_installed');
35
+	delete_option('geodir_default_data_installed');
36 36
 
37 37
 }
38 38
 
39 39
 if (!function_exists('geodir_admin_styles')) {
40
-    /**
41
-     * Enqueue Admin Styles.
42
-     *
43
-     * @since 1.0.0
44
-     * @package GeoDirectory
45
-     */
46
-    function geodir_admin_styles()
47
-    {
40
+	/**
41
+	 * Enqueue Admin Styles.
42
+	 *
43
+	 * @since 1.0.0
44
+	 * @package GeoDirectory
45
+	 */
46
+	function geodir_admin_styles()
47
+	{
48 48
 
49
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-admin-css');
49
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-admin-css');
51 51
 
52
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodirectory-frontend-style');
52
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodirectory-frontend-style');
54 54
 
55
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-chosen-style');
55
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-chosen-style');
57 57
 
58
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
58
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
60 60
 
61
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
-        wp_enqueue_style('geodirectory-jquery-ui-css');
61
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
+		wp_enqueue_style('geodirectory-jquery-ui-css');
63 63
 
64
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
-        wp_enqueue_style('geodirectory-custom-fields-css');
64
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
+		wp_enqueue_style('geodirectory-custom-fields-css');
66 66
 
67
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
-        wp_enqueue_style('geodirectory-pluplodar-css');
67
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
+		wp_enqueue_style('geodirectory-pluplodar-css');
69 69
 
70
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
-        wp_enqueue_style('geodir-rating-style');
70
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
+		wp_enqueue_style('geodir-rating-style');
72 72
 
73
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
-        wp_enqueue_style('geodir-rtl-style');
73
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
+		wp_enqueue_style('geodir-rtl-style');
75 75
 
76
-    }
76
+	}
77 77
 }
78 78
 
79 79
 if (!function_exists('geodir_admin_styles_req')) {
80
-    /**
81
-     * Loads stylesheets from CDN.
82
-     *
83
-     * @since 1.0.0
84
-     * @package GeoDirectory
85
-     */
86
-    function geodir_admin_styles_req()
87
-    {
80
+	/**
81
+	 * Loads stylesheets from CDN.
82
+	 *
83
+	 * @since 1.0.0
84
+	 * @package GeoDirectory
85
+	 */
86
+	function geodir_admin_styles_req()
87
+	{
88 88
 
89
-        wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
-        wp_enqueue_style('geodirectory-font-awesome');
89
+		wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
+		wp_enqueue_style('geodirectory-font-awesome');
91 91
 
92
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
-        wp_enqueue_script('geodirectory-admin');
92
+		wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
+		wp_enqueue_script('geodirectory-admin');
94 94
 
95
-    }
95
+	}
96 96
 }
97 97
 
98 98
 if (!function_exists('geodir_admin_scripts')) {
99
-    /**
100
-     * Enqueue Admin Scripts.
101
-     *
102
-     * @since 1.0.0
103
-     * @package GeoDirectory
104
-     */
105
-    function geodir_admin_scripts()
106
-    {
107
-        $geodir_map_name = geodir_map_name();
99
+	/**
100
+	 * Enqueue Admin Scripts.
101
+	 *
102
+	 * @since 1.0.0
103
+	 * @package GeoDirectory
104
+	 */
105
+	function geodir_admin_scripts()
106
+	{
107
+		$geodir_map_name = geodir_map_name();
108 108
         
109
-        wp_enqueue_script('jquery');
109
+		wp_enqueue_script('jquery');
110 110
 
111
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
111
+		wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
112 112
 
113
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
114
-        wp_enqueue_script('chosen');
113
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
114
+		wp_enqueue_script('chosen');
115 115
 
116
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
117
-        wp_enqueue_script('geodirectory-choose-ajax');
116
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
117
+		wp_enqueue_script('geodirectory-choose-ajax');
118 118
 
119
-        if (isset($_REQUEST['listing_type'])) {
120
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
121
-        }
119
+		if (isset($_REQUEST['listing_type'])) {
120
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
121
+		}
122 122
 
123
-        wp_enqueue_script('geodirectory-custom-fields-script');
124
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
123
+		wp_enqueue_script('geodirectory-custom-fields-script');
124
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
125 125
 
126
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
127 127
 
128
-        if (in_array($geodir_map_name, array('auto', 'google'))) {
129
-            $map_lang = "&language=" . geodir_get_map_default_language();
130
-            /** This filter is documented in geodirectory_template_tags.php */
131
-            $map_extra = apply_filters('geodir_googlemap_script_extra', '');
132
-            wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
133
-        }
128
+		if (in_array($geodir_map_name, array('auto', 'google'))) {
129
+			$map_lang = "&language=" . geodir_get_map_default_language();
130
+			/** This filter is documented in geodirectory_template_tags.php */
131
+			$map_extra = apply_filters('geodir_googlemap_script_extra', '');
132
+			wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
133
+		}
134 134
         
135
-        if ($geodir_map_name == 'osm') {
136
-            // Leaflet OpenStreetMap
137
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
138
-            wp_enqueue_style('geodirectory-leaflet-style');
135
+		if ($geodir_map_name == 'osm') {
136
+			// Leaflet OpenStreetMap
137
+			wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
138
+			wp_enqueue_style('geodirectory-leaflet-style');
139 139
                 
140
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
141
-            wp_enqueue_script('geodirectory-leaflet-script');
140
+			wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
141
+			wp_enqueue_script('geodirectory-leaflet-script');
142 142
             
143
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
144
-            wp_enqueue_script('geodirectory-leaflet-geo-script');
145
-        }
146
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
143
+			wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
144
+			wp_enqueue_script('geodirectory-leaflet-geo-script');
145
+		}
146
+		wp_enqueue_script( 'jquery-ui-autocomplete' );
147 147
         
148
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
149
-        wp_enqueue_script('geodirectory-goMap-script');
148
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
149
+		wp_enqueue_script('geodirectory-goMap-script');
150 150
 
151
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
152
-        wp_enqueue_script('geodirectory-goMap-script');
151
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
152
+		wp_enqueue_script('geodirectory-goMap-script');
153 153
 
154 154
 		// font awesome rating script
155 155
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -160,167 +160,167 @@  discard block
 block discarded – undo
160 160
 			wp_enqueue_script('geodir-jRating-js');
161 161
 		}
162 162
 
163
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
164
-        wp_enqueue_script('geodir-on-document-load');
165
-
166
-
167
-        // SCRIPT FOR UPLOAD
168
-        wp_enqueue_script('plupload-all');
169
-        wp_enqueue_script('jquery-ui-sortable');
170
-
171
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
172
-        wp_enqueue_script('geodirectory-plupload-script');
173
-
174
-        // SCRIPT FOR UPLOAD END
175
-
176
-
177
-        // place js config array for plupload
178
-        $plupload_init = array(
179
-            'runtimes' => 'html5,silverlight,flash,html4',
180
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
181
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
182
-            'drop_element' => 'dropbox', // will be adjusted per uploader
183
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
184
-            'multiple_queues' => true,
185
-            'max_file_size' => geodir_max_upload_size(),
186
-            'url' => admin_url('admin-ajax.php'),
187
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
188
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
189
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
190
-            'multipart' => true,
191
-            'urlstream_upload' => true,
192
-            'multi_selection' => false, // will be added per uploader
193
-            // additional post data to send to our ajax hook
194
-            'multipart_params' => array(
195
-                '_ajax_nonce' => "", // will be added per uploader
196
-                'action' => 'plupload_action', // the ajax action name
197
-                'imgid' => 0 // will be added per uploader
198
-            )
199
-        );
200
-        $base_plupload_config = json_encode($plupload_init);
201
-
202
-
203
-        $thumb_img_arr = array();
204
-
205
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
206
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
207
-
208
-        $totImg = '';
209
-        $image_limit = '';
210
-        if (!empty($thumb_img_arr)) {
211
-            $totImg = count($thumb_img_arr);
212
-        }
163
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
164
+		wp_enqueue_script('geodir-on-document-load');
165
+
166
+
167
+		// SCRIPT FOR UPLOAD
168
+		wp_enqueue_script('plupload-all');
169
+		wp_enqueue_script('jquery-ui-sortable');
170
+
171
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
172
+		wp_enqueue_script('geodirectory-plupload-script');
173
+
174
+		// SCRIPT FOR UPLOAD END
175
+
176
+
177
+		// place js config array for plupload
178
+		$plupload_init = array(
179
+			'runtimes' => 'html5,silverlight,flash,html4',
180
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
181
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
182
+			'drop_element' => 'dropbox', // will be adjusted per uploader
183
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
184
+			'multiple_queues' => true,
185
+			'max_file_size' => geodir_max_upload_size(),
186
+			'url' => admin_url('admin-ajax.php'),
187
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
188
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
189
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
190
+			'multipart' => true,
191
+			'urlstream_upload' => true,
192
+			'multi_selection' => false, // will be added per uploader
193
+			// additional post data to send to our ajax hook
194
+			'multipart_params' => array(
195
+				'_ajax_nonce' => "", // will be added per uploader
196
+				'action' => 'plupload_action', // the ajax action name
197
+				'imgid' => 0 // will be added per uploader
198
+			)
199
+		);
200
+		$base_plupload_config = json_encode($plupload_init);
201
+
202
+
203
+		$thumb_img_arr = array();
204
+
205
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
206
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
207
+
208
+		$totImg = '';
209
+		$image_limit = '';
210
+		if (!empty($thumb_img_arr)) {
211
+			$totImg = count($thumb_img_arr);
212
+		}
213 213
 
214
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
215
-            'totalImg' => $totImg,
216
-            'image_limit' => $image_limit,
217
-            'upload_img_size' => geodir_max_upload_size());
214
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
215
+			'totalImg' => $totImg,
216
+			'image_limit' => $image_limit,
217
+			'upload_img_size' => geodir_max_upload_size());
218 218
 
219
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
219
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
220 220
 
221
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
222
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
221
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
222
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
223 223
 
224 224
 
225
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
226
-        wp_enqueue_script('geodirectory-admin-script');
225
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
226
+		wp_enqueue_script('geodirectory-admin-script');
227 227
 
228
-        wp_enqueue_style('farbtastic');
229
-        wp_enqueue_script('farbtastic');
228
+		wp_enqueue_style('farbtastic');
229
+		wp_enqueue_script('farbtastic');
230 230
 
231
-        $screen = get_current_screen();
232
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
233
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
234
-        }
231
+		$screen = get_current_screen();
232
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
233
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
234
+		}
235 235
 
236
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
237
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
236
+		$ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
237
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
238 238
 
239
-    }
239
+	}
240 240
 }
241 241
 
242 242
 if (!function_exists('geodir_admin_menu')) {
243
-    /**
244
-     * Admin Menus
245
-     *
246
-     * Sets up the admin menus in wordpress.
247
-     *
248
-     * @since 1.0.0
249
-     * @package GeoDirectory
250
-     * @global array $menu Menu array.
251
-     * @global object $geodirectory GeoDirectory plugin object.
252
-     */
253
-    function geodir_admin_menu()
254
-    {
255
-        global $menu, $geodirectory;
243
+	/**
244
+	 * Admin Menus
245
+	 *
246
+	 * Sets up the admin menus in wordpress.
247
+	 *
248
+	 * @since 1.0.0
249
+	 * @package GeoDirectory
250
+	 * @global array $menu Menu array.
251
+	 * @global object $geodirectory GeoDirectory plugin object.
252
+	 */
253
+	function geodir_admin_menu()
254
+	{
255
+		global $menu, $geodirectory;
256 256
 
257
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
257
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
258 258
 
259
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
259
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
260 260
 
261 261
 
262
-    }
262
+	}
263 263
 }
264 264
 
265 265
 if (!function_exists('geodir_admin_menu_order')) {
266
-    /**
267
-     * Order admin menus.
268
-     *
269
-     * @since 1.0.0
270
-     * @package GeoDirectory
271
-     * @param array $menu_order Menu order array.
272
-     * @return array Modified menu order array.
273
-     */
274
-    function geodir_admin_menu_order($menu_order)
275
-    {
276
-
277
-        // Initialize our custom order array
278
-        $geodir_menu_order = array();
279
-
280
-        // Get the index of our custom separator
281
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
282
-
283
-        // Get index of posttype menu
284
-        $post_types = geodir_get_posttypes();
285
-
286
-        // Loop through menu order and do some rearranging
287
-        foreach ($menu_order as $index => $item) :
288
-
289
-            if ((('geodirectory') == $item)) :
290
-                $geodir_menu_order[] = 'separator-geodirectory';
291
-                if (!empty($post_types)) {
292
-                    foreach ($post_types as $post_type) {
293
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
294
-                    }
295
-                }
296
-                $geodir_menu_order[] = $item;
266
+	/**
267
+	 * Order admin menus.
268
+	 *
269
+	 * @since 1.0.0
270
+	 * @package GeoDirectory
271
+	 * @param array $menu_order Menu order array.
272
+	 * @return array Modified menu order array.
273
+	 */
274
+	function geodir_admin_menu_order($menu_order)
275
+	{
297 276
 
298
-                unset($menu_order[$geodir_separator]);
299
-            //unset( $menu_order[$geodir_places] );
300
-            elseif (!in_array($item, array('separator-geodirectory'))) :
301
-                $geodir_menu_order[] = $item;
302
-            endif;
277
+		// Initialize our custom order array
278
+		$geodir_menu_order = array();
303 279
 
304
-        endforeach;
280
+		// Get the index of our custom separator
281
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
305 282
 
306
-        // Return order
307
-        return $geodir_menu_order;
308
-    }
283
+		// Get index of posttype menu
284
+		$post_types = geodir_get_posttypes();
285
+
286
+		// Loop through menu order and do some rearranging
287
+		foreach ($menu_order as $index => $item) :
288
+
289
+			if ((('geodirectory') == $item)) :
290
+				$geodir_menu_order[] = 'separator-geodirectory';
291
+				if (!empty($post_types)) {
292
+					foreach ($post_types as $post_type) {
293
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
294
+					}
295
+				}
296
+				$geodir_menu_order[] = $item;
297
+
298
+				unset($menu_order[$geodir_separator]);
299
+			//unset( $menu_order[$geodir_places] );
300
+			elseif (!in_array($item, array('separator-geodirectory'))) :
301
+				$geodir_menu_order[] = $item;
302
+			endif;
303
+
304
+		endforeach;
305
+
306
+		// Return order
307
+		return $geodir_menu_order;
308
+	}
309 309
 }
310 310
 
311 311
 if (!function_exists('geodir_admin_custom_menu_order')) {
312
-    /**
313
-     * Enables custom menu order.
314
-     *
315
-     * @since 1.0.0
316
-     * @package GeoDirectory
317
-     * @return bool
318
-     */
319
-    function geodir_admin_custom_menu_order()
320
-    {
321
-        if (!current_user_can('manage_options')) return false;
322
-        return true;
323
-    }
312
+	/**
313
+	 * Enables custom menu order.
314
+	 *
315
+	 * @since 1.0.0
316
+	 * @package GeoDirectory
317
+	 * @return bool
318
+	 */
319
+	function geodir_admin_custom_menu_order()
320
+	{
321
+		if (!current_user_can('manage_options')) return false;
322
+		return true;
323
+	}
324 324
 }
325 325
 
326 326
 /**
@@ -331,41 +331,41 @@  discard block
 block discarded – undo
331 331
  */
332 332
 function geodir_before_admin_panel()
333 333
 {
334
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
335
-        echo '<div id="message" class="updated fade">
334
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
335
+		echo '<div id="message" class="updated fade">
336 336
                         <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
337 337
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
338 338
                 </div>';
339 339
 
340
-    }
340
+	}
341 341
 
342
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
343
-        switch ($_REQUEST['msg']) {
344
-            case 'success':
345
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
346
-                flush_rewrite_rules(false);
342
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
343
+		switch ($_REQUEST['msg']) {
344
+			case 'success':
345
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
346
+				flush_rewrite_rules(false);
347 347
 
348
-                break;
348
+				break;
349 349
 			case 'fail':
350 350
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
351 351
 				
352 352
 				if ($gderr == 21)
353
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
353
+					echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
354 354
 				else
355 355
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
356
-                break;
357
-        }
358
-    }
356
+				break;
357
+		}
358
+	}
359 359
 
360
-    if (!geodir_is_default_location_set()) {
361
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
360
+	if (!geodir_is_default_location_set()) {
361
+		echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
362 362
 
363
-    }
363
+	}
364 364
 
365
-    if (!function_exists('curl_init')) {
366
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
365
+	if (!function_exists('curl_init')) {
366
+		echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
367 367
 
368
-    }
368
+	}
369 369
 }
370 370
 
371 371
 /**
@@ -378,19 +378,19 @@  discard block
 block discarded – undo
378 378
  */
379 379
 function geodir_handle_option_form_submit($current_tab)
380 380
 {
381
-    global $geodir_settings;
382
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
383
-        /**
384
-         * Contains settings array for current tab.
385
-         *
386
-         * @since 1.0.0
387
-         * @package GeoDirectory
388
-         */
389
-        include_once('option-pages/' . $current_tab . '_array.php');
390
-    }
391
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
392
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
381
+	global $geodir_settings;
382
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
383
+		/**
384
+		 * Contains settings array for current tab.
385
+		 *
386
+		 * @since 1.0.0
387
+		 * @package GeoDirectory
388
+		 */
389
+		include_once('option-pages/' . $current_tab . '_array.php');
390
+	}
391
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
392
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
394 394
 		
395 395
 		/**
396 396
 		 * Fires before updating geodirectory admin settings.
@@ -402,98 +402,98 @@  discard block
 block discarded – undo
402 402
 		 */
403 403
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
404 404
 		
405
-        if (!empty($geodir_settings[$current_tab]))
406
-            geodir_update_options($geodir_settings[$current_tab]);
405
+		if (!empty($geodir_settings[$current_tab]))
406
+			geodir_update_options($geodir_settings[$current_tab]);
407 407
 
408
-        /**
409
-         * Called after GeoDirectory options settings are updated.
410
-         *
411
-         * @since 1.0.0
412
-         * @param array $geodir_settings The array of GeoDirectory settings.
413
-         * @see 'geodir_before_update_options'
414
-         */
415
-        do_action('geodir_update_options', $geodir_settings);
408
+		/**
409
+		 * Called after GeoDirectory options settings are updated.
410
+		 *
411
+		 * @since 1.0.0
412
+		 * @param array $geodir_settings The array of GeoDirectory settings.
413
+		 * @see 'geodir_before_update_options'
414
+		 */
415
+		do_action('geodir_update_options', $geodir_settings);
416 416
 
417
-        /**
418
-         * Called after GeoDirectory options settings are updated.
419
-         *
420
-         * Provides tab specific settings.
421
-         *
422
-         * @since 1.0.0
423
-         * @param string $current_tab The current settings tab name.
424
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
425
-         */
426
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
417
+		/**
418
+		 * Called after GeoDirectory options settings are updated.
419
+		 *
420
+		 * Provides tab specific settings.
421
+		 *
422
+		 * @since 1.0.0
423
+		 * @param string $current_tab The current settings tab name.
424
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
425
+		 */
426
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
427 427
 
428
-        flush_rewrite_rules(false);
428
+		flush_rewrite_rules(false);
429 429
 
430
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
430
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
431 431
 
432
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
432
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
433 433
 
434
-        wp_redirect($redirect_url);
435
-        exit();
436
-    endif;
434
+		wp_redirect($redirect_url);
435
+		exit();
436
+	endif;
437 437
 
438 438
 
439 439
 }
440 440
 
441 441
 
442 442
 if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
443
-    /**
444
-     * GeoDirectory dummy data installation.
445
-     *
446
-     * @since 1.0.0
447
-     * @package GeoDirectory
448
-     * @global object $wpdb WordPress Database object.
449
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
450
-     * @param string $post_type The post type.
451
-     */
452
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
453
-    {
443
+	/**
444
+	 * GeoDirectory dummy data installation.
445
+	 *
446
+	 * @since 1.0.0
447
+	 * @package GeoDirectory
448
+	 * @global object $wpdb WordPress Database object.
449
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
450
+	 * @param string $post_type The post type.
451
+	 */
452
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
453
+	{
454 454
 
455
-        global $wpdb, $plugin_prefix;
455
+		global $wpdb, $plugin_prefix;
456 456
 
457
-        if (!geodir_is_default_location_set()) {
458
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
459
-        } else {
457
+		if (!geodir_is_default_location_set()) {
458
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
459
+		} else {
460 460
 
461
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
461
+			$geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
462 462
 
463
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
463
+			$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
464 464
 
465
-            if ($post_counts > 0) {
466
-                $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
465
+			if ($post_counts > 0) {
466
+				$nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
467 467
 
468
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
469
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
470
-            } else {
471
-                $options_list = '';
472
-                for ($option = 1; $option <= 30; $option++) {
473
-                    $selected = '';
474
-                    if ($option == 10)
475
-                        $selected = 'selected="selected"';
468
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
469
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
470
+			} else {
471
+				$options_list = '';
472
+				for ($option = 1; $option <= 30; $option++) {
473
+					$selected = '';
474
+					if ($option == 10)
475
+						$selected = 'selected="selected"';
476 476
 
477
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
478
-                }
477
+					$options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
478
+				}
479 479
 
480
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
480
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
481 481
 
482
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
483
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
482
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
483
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
484 484
 
485
-            }
486
-            echo $dummy_msg;
487
-            ?>
485
+			}
486
+			echo $dummy_msg;
487
+			?>
488 488
             <script>
489 489
                 <?php
490
-                  $default_location = geodir_get_default_location();
491
-                  $city =  isset($default_location->city) ? $default_location->city : '';
492
-                  $region =isset($default_location->region) ? $default_location->region : '';
493
-                  $country =isset($default_location->country) ? $default_location->country : '';
494
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
496
-                ?>
490
+				  $default_location = geodir_get_default_location();
491
+				  $city =  isset($default_location->city) ? $default_location->city : '';
492
+				  $region =isset($default_location->region) ? $default_location->region : '';
493
+				  $country =isset($default_location->country) ? $default_location->country : '';
494
+				  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
+				  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
496
+				?>
497 497
                 var geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
498 498
                 var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
499 499
                 var bound_lat_lng;
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
                 }
585 585
             </script>
586 586
         <?php
587
-        }
588
-    }
587
+		}
588
+	}
589 589
 }
590 590
 
591 591
 /**
@@ -598,19 +598,19 @@  discard block
 block discarded – undo
598 598
  */
599 599
 function geodir_insert_dummy_posts()
600 600
 {
601
-    geodir_default_taxonomies();
601
+	geodir_default_taxonomies();
602 602
 
603
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
603
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
604 604
 
605
-    global $wpdb, $current_user;
605
+	global $wpdb, $current_user;
606 606
 
607
-    /**
608
-     * Contains dummy post content.
609
-     *
610
-     * @since 1.0.0
611
-     * @package GeoDirectory
612
-     */
613
-    include_once('place_dummy_post.php');
607
+	/**
608
+	 * Contains dummy post content.
609
+	 *
610
+	 * @since 1.0.0
611
+	 * @package GeoDirectory
612
+	 */
613
+	include_once('place_dummy_post.php');
614 614
 
615 615
 }
616 616
 
@@ -624,18 +624,18 @@  discard block
 block discarded – undo
624 624
  */
625 625
 function geodir_delete_dummy_posts()
626 626
 {
627
-    global $wpdb, $plugin_prefix;
627
+	global $wpdb, $plugin_prefix;
628 628
 
629 629
 
630
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
630
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
631 631
 
632 632
 
633
-    foreach ($post_ids as $post_ids_obj) {
634
-        wp_delete_post($post_ids_obj->post_id);
635
-    }
633
+	foreach ($post_ids as $post_ids_obj) {
634
+		wp_delete_post($post_ids_obj->post_id);
635
+	}
636 636
 
637
-    //double check posts are deleted
638
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
637
+	//double check posts are deleted
638
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
639 639
 }
640 640
 
641 641
 /**
@@ -649,114 +649,114 @@  discard block
 block discarded – undo
649 649
  * @global string $dummy_image_path The dummy image path.
650 650
  */
651 651
 function geodir_default_taxonomies() {
652
-    global $wpdb, $dummy_image_path;
652
+	global $wpdb, $dummy_image_path;
653 653
 
654
-    $category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
654
+	$category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
655 655
 
656
-    $last_catid = '';
656
+	$last_catid = '';
657 657
 
658
-    $uploads = wp_upload_dir(); // Array of key => value pairs
658
+	$uploads = wp_upload_dir(); // Array of key => value pairs
659 659
 
660
-    for ($i = 0; $i < count($category_array); $i++) {
661
-        $parent_catid = 0;
662
-        if (is_array($category_array[$i])) {
663
-            $cat_name_arr = $category_array[$i];
664
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
665
-                $catname = $cat_name_arr[$j];
660
+	for ($i = 0; $i < count($category_array); $i++) {
661
+		$parent_catid = 0;
662
+		if (is_array($category_array[$i])) {
663
+			$cat_name_arr = $category_array[$i];
664
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
665
+				$catname = $cat_name_arr[$j];
666 666
 
667
-                if (!term_exists($catname, 'gd_placecategory')) {
668
-                    $last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
667
+				if (!term_exists($catname, 'gd_placecategory')) {
668
+					$last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
669 669
 
670
-                    if ($j == 0) {
671
-                        $parent_catid = $last_catid;
672
-                    }
670
+					if ($j == 0) {
671
+						$parent_catid = $last_catid;
672
+					}
673 673
 
674 674
 
675
-                    if (geodir_dummy_folder_exists())
676
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
677
-                    else
678
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
675
+					if (geodir_dummy_folder_exists())
676
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
677
+					else
678
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
679 679
 
680
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
680
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
681 681
 
682
-                    $catname = str_replace(' ', '_', $catname);
683
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
682
+					$catname = str_replace(' ', '_', $catname);
683
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
684 684
 
685
-                    if (empty($uploaded['error'])) {
686
-                        $new_path = $uploaded['file'];
687
-                        $new_url = $uploaded['url'];
688
-                    }
685
+					if (empty($uploaded['error'])) {
686
+						$new_path = $uploaded['file'];
687
+						$new_url = $uploaded['url'];
688
+					}
689 689
 
690
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
691
-
692
-                    $attachment = array(
693
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
694
-                        'post_mime_type' => $wp_filetype['type'],
695
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
696
-                        'post_content' => '',
697
-                        'post_status' => 'inherit'
698
-                    );
699
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
700
-
701
-                    // you must first include the image.php file
702
-                    // for the function wp_generate_attachment_metadata() to work
703
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
704
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
705
-                    wp_update_attachment_metadata($attach_id, $attach_data);
706
-
707
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
708
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
709
-                    }
710
-                }
711
-            }
690
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
691
+
692
+					$attachment = array(
693
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
694
+						'post_mime_type' => $wp_filetype['type'],
695
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
696
+						'post_content' => '',
697
+						'post_status' => 'inherit'
698
+					);
699
+					$attach_id = wp_insert_attachment($attachment, $new_path);
700
+
701
+					// you must first include the image.php file
702
+					// for the function wp_generate_attachment_metadata() to work
703
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
704
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
705
+					wp_update_attachment_metadata($attach_id, $attach_data);
706
+
707
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
708
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
709
+					}
710
+				}
711
+			}
712 712
 
713
-        } else {
714
-            $catname = $category_array[$i];
713
+		} else {
714
+			$catname = $category_array[$i];
715 715
 
716
-            if (!term_exists($catname, 'gd_placecategory')) {
717
-                $last_catid = wp_insert_term($catname, 'gd_placecategory');
716
+			if (!term_exists($catname, 'gd_placecategory')) {
717
+				$last_catid = wp_insert_term($catname, 'gd_placecategory');
718 718
 
719
-                if (geodir_dummy_folder_exists())
720
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
721
-                else
722
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
719
+				if (geodir_dummy_folder_exists())
720
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
721
+				else
722
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
723 723
 
724
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
724
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
725 725
 
726
-                $catname = str_replace(' ', '_', $catname);
727
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
726
+				$catname = str_replace(' ', '_', $catname);
727
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
728 728
 
729
-                if (empty($uploaded['error'])) {
730
-                    $new_path = $uploaded['file'];
731
-                    $new_url = $uploaded['url'];
732
-                }
729
+				if (empty($uploaded['error'])) {
730
+					$new_path = $uploaded['file'];
731
+					$new_url = $uploaded['url'];
732
+				}
733 733
 
734
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
734
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
735 735
 
736
-                $attachment = array(
737
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
738
-                    'post_mime_type' => $wp_filetype['type'],
739
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
740
-                    'post_content' => '',
741
-                    'post_status' => 'inherit'
742
-                );
736
+				$attachment = array(
737
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
738
+					'post_mime_type' => $wp_filetype['type'],
739
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
740
+					'post_content' => '',
741
+					'post_status' => 'inherit'
742
+				);
743 743
 
744
-                $attach_id = wp_insert_attachment($attachment, $new_path);
744
+				$attach_id = wp_insert_attachment($attachment, $new_path);
745 745
 
746 746
 
747
-                // you must first include the image.php file
748
-                // for the function wp_generate_attachment_metadata() to work
749
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
750
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
751
-                wp_update_attachment_metadata($attach_id, $attach_data);
747
+				// you must first include the image.php file
748
+				// for the function wp_generate_attachment_metadata() to work
749
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
750
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
751
+				wp_update_attachment_metadata($attach_id, $attach_data);
752 752
 
753
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
754
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
755
-                }
756
-            }
757
-        }
753
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
754
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
755
+				}
756
+			}
757
+		}
758 758
 
759
-    }
759
+	}
760 760
 }
761 761
 
762 762
 /**
@@ -771,144 +771,144 @@  discard block
 block discarded – undo
771 771
  * @return bool Returns true if saved.
772 772
  */
773 773
 function geodir_update_options($options, $dummy = false) {
774
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
774
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
775 775
 
776
-    foreach ($options as $value) {
777
-        if ($dummy && isset($value['std']))
778
-            $_POST[$value['id']] = $value['std'];
776
+	foreach ($options as $value) {
777
+		if ($dummy && isset($value['std']))
778
+			$_POST[$value['id']] = $value['std'];
779 779
 
780 780
 
781
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
781
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
782 782
 
783
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
784
-                update_option($value['id'], $_POST[$value['id']]);
785
-            } else {
786
-                update_option($value['id'], 0);
787
-            }
783
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
784
+				update_option($value['id'], $_POST[$value['id']]);
785
+			} else {
786
+				update_option($value['id'], 0);
787
+			}
788 788
 
789
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
789
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
790 790
 
791
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
792
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
793
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
794
-                if (isset($_POST[$value['id'] . '_crop'])) :
795
-                    update_option($value['id'] . '_crop', 1);
796
-                else :
797
-                    update_option($value['id'] . '_crop', 0);
798
-                endif;
799
-            } else {
800
-                update_option($value['id'] . '_width', $value['std']);
801
-                update_option($value['id'] . '_height', $value['std']);
802
-                update_option($value['id'] . '_crop', 1);
803
-            }
791
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
792
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
793
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
794
+				if (isset($_POST[$value['id'] . '_crop'])) :
795
+					update_option($value['id'] . '_crop', 1);
796
+				else :
797
+					update_option($value['id'] . '_crop', 0);
798
+				endif;
799
+			} else {
800
+				update_option($value['id'] . '_width', $value['std']);
801
+				update_option($value['id'] . '_height', $value['std']);
802
+				update_option($value['id'] . '_crop', 1);
803
+			}
804 804
 
805
-        elseif (isset($value['type']) && $value['type'] == 'map') :
806
-            $post_types = array();
807
-            $categories = array();
805
+		elseif (isset($value['type']) && $value['type'] == 'map') :
806
+			$post_types = array();
807
+			$categories = array();
808 808
 
809
-            if (!empty($_POST['home_map_post_types'])) :
810
-                foreach ($_POST['home_map_post_types'] as $post_type) :
811
-                    $post_types[] = $post_type;
812
-                endforeach;
813
-            endif;
809
+			if (!empty($_POST['home_map_post_types'])) :
810
+				foreach ($_POST['home_map_post_types'] as $post_type) :
811
+					$post_types[] = $post_type;
812
+				endforeach;
813
+			endif;
814 814
 
815
-            update_option('geodir_exclude_post_type_on_map', $post_types);
815
+			update_option('geodir_exclude_post_type_on_map', $post_types);
816 816
 
817
-            if (!empty($_POST['post_category'])) :
818
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
819
-                    $categories[$texonomy] = array();
820
-                    foreach ($cat_arr as $category) :
821
-                        $categories[$texonomy][] = $category;
822
-                    endforeach;
823
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
824
-                endforeach;
825
-            endif;
826
-            update_option('geodir_exclude_cat_on_map', $categories);
827
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
828
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
817
+			if (!empty($_POST['post_category'])) :
818
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
819
+					$categories[$texonomy] = array();
820
+					foreach ($cat_arr as $category) :
821
+						$categories[$texonomy][] = $category;
822
+					endforeach;
823
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
824
+				endforeach;
825
+			endif;
826
+			update_option('geodir_exclude_cat_on_map', $categories);
827
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
828
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
829 829
 
830 830
 
831
-            if (!empty($_POST['geodir_default_map_language'])):
832
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
833
-            endif;
831
+			if (!empty($_POST['geodir_default_map_language'])):
832
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
833
+			endif;
834 834
 
835 835
 
836
-            if (!empty($_POST['geodir_default_map_search_pt'])):
837
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
838
-            endif;
836
+			if (!empty($_POST['geodir_default_map_search_pt'])):
837
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
838
+			endif;
839 839
 
840 840
 
841
-        elseif (isset($value['type']) && $value['type'] == 'file') :
841
+		elseif (isset($value['type']) && $value['type'] == 'file') :
842 842
 
843 843
 
844
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
844
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
845 845
 
846
-                if (get_option($value['id'])) {
847
-                    $image_name_arr = explode('/', get_option($value['id']));
848
-                    $noimg_name = end($image_name_arr);
849
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
850
-                    if (file_exists($img_path))
851
-                        unlink($img_path);
852
-                }
846
+				if (get_option($value['id'])) {
847
+					$image_name_arr = explode('/', get_option($value['id']));
848
+					$noimg_name = end($image_name_arr);
849
+					$img_path = $uploads['path'] . '/' . $noimg_name;
850
+					if (file_exists($img_path))
851
+						unlink($img_path);
852
+				}
853 853
 
854
-                update_option($value['id'], '');
855
-            }
854
+				update_option($value['id'], '');
855
+			}
856 856
 
857
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
858
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
859
-
860
-            if (!empty($filename)):
861
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
862
-                $uplaods = array();
863
-
864
-                foreach ($uploadedfile as $key => $uplaod):
865
-                    if ($key == 'name'):
866
-                        $uplaods[$key] = $filename;
867
-                    else :
868
-                        $uplaods[$key] = $uplaod;
869
-                    endif;
870
-                endforeach;
871
-
872
-                $uploads = wp_upload_dir();
873
-
874
-                if (get_option($value['id'])) {
875
-                    $image_name_arr = explode('/', get_option($value['id']));
876
-                    $noimg_name = end($image_name_arr);
877
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
878
-                    if (file_exists($img_path))
879
-                        unlink($img_path);
880
-                }
857
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
858
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
859
+
860
+			if (!empty($filename)):
861
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
862
+				$uplaods = array();
863
+
864
+				foreach ($uploadedfile as $key => $uplaod):
865
+					if ($key == 'name'):
866
+						$uplaods[$key] = $filename;
867
+					else :
868
+						$uplaods[$key] = $uplaod;
869
+					endif;
870
+				endforeach;
871
+
872
+				$uploads = wp_upload_dir();
873
+
874
+				if (get_option($value['id'])) {
875
+					$image_name_arr = explode('/', get_option($value['id']));
876
+					$noimg_name = end($image_name_arr);
877
+					$img_path = $uploads['path'] . '/' . $noimg_name;
878
+					if (file_exists($img_path))
879
+						unlink($img_path);
880
+				}
881 881
 
882
-                $upload_overrides = array('test_form' => false);
883
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
882
+				$upload_overrides = array('test_form' => false);
883
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
884 884
 
885
-                update_option($value['id'], $movefile['url']);
885
+				update_option($value['id'], $movefile['url']);
886 886
 
887
-            endif;
887
+			endif;
888 888
 
889
-            if (!get_option($value['id']) && isset($value['value'])):
890
-                update_option($value['id'], $value['value']);
891
-            endif;
889
+			if (!get_option($value['id']) && isset($value['value'])):
890
+				update_option($value['id'], $value['value']);
891
+			endif;
892 892
 
893 893
 
894
-        else :
895
-            // same menu setting per theme.
896
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
897
-                $theme = wp_get_theme();
898
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
899
-            }
894
+		else :
895
+			// same menu setting per theme.
896
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
897
+				$theme = wp_get_theme();
898
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
899
+			}
900 900
 
901
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
902
-                update_option($value['id'], $_POST[$value['id']]);
903
-            } else {
904
-                delete_option($value['id']);
905
-            }
901
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
902
+				update_option($value['id'], $_POST[$value['id']]);
903
+			} else {
904
+				delete_option($value['id']);
905
+			}
906 906
 
907
-        endif;
908
-    }
909
-    if ($dummy)
910
-        $_POST = array();
911
-    return true;
907
+		endif;
908
+	}
909
+	if ($dummy)
910
+		$_POST = array();
911
+	return true;
912 912
 
913 913
 }
914 914
 
@@ -957,33 +957,33 @@  discard block
 block discarded – undo
957 957
 function places_custom_fields_tab($tabs)
958 958
 {
959 959
 
960
-    $geodir_post_types = get_option('geodir_post_types');
960
+	$geodir_post_types = get_option('geodir_post_types');
961 961
 
962
-    if (!empty($geodir_post_types)) {
962
+	if (!empty($geodir_post_types)) {
963 963
 
964
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
964
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
965 965
 
966
-            $listing_slug = $geodir_posttype_info['labels']['singular_name'];
966
+			$listing_slug = $geodir_posttype_info['labels']['singular_name'];
967 967
 
968
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
969
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
970
-                'subtabs' => array(
971
-                    array('subtab' => 'custom_fields',
972
-                        'label' => __('Custom Fields', 'geodirectory'),
973
-                        'request' => array('listing_type' => $geodir_post_type)),
974
-                    array('subtab' => 'sorting_options',
975
-                        'label' => __('Sorting Options', 'geodirectory'),
976
-                        'request' => array('listing_type' => $geodir_post_type)),
977
-                ),
978
-                'tab_index' => 9,
979
-                'request' => array('listing_type' => $geodir_post_type)
980
-            );
968
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
969
+				'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
970
+				'subtabs' => array(
971
+					array('subtab' => 'custom_fields',
972
+						'label' => __('Custom Fields', 'geodirectory'),
973
+						'request' => array('listing_type' => $geodir_post_type)),
974
+					array('subtab' => 'sorting_options',
975
+						'label' => __('Sorting Options', 'geodirectory'),
976
+						'request' => array('listing_type' => $geodir_post_type)),
977
+				),
978
+				'tab_index' => 9,
979
+				'request' => array('listing_type' => $geodir_post_type)
980
+			);
981 981
 
982
-        endforeach;
982
+		endforeach;
983 983
 
984
-    }
984
+	}
985 985
 
986
-    return $tabs;
986
+	return $tabs;
987 987
 }
988 988
 
989 989
 
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
  */
1000 1000
 function geodir_tools_setting_tab($tabs)
1001 1001
 {
1002
-    wp_enqueue_script( 'jquery-ui-progressbar' );
1003
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
1004
-    return $tabs;
1002
+	wp_enqueue_script( 'jquery-ui-progressbar' );
1003
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
1004
+	return $tabs;
1005 1005
 }
1006 1006
 
1007 1007
 /**
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
  */
1017 1017
 function geodir_compatibility_setting_tab($tabs)
1018 1018
 {
1019
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1020
-    return $tabs;
1019
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1020
+	return $tabs;
1021 1021
 }
1022 1022
 
1023 1023
 
@@ -1033,144 +1033,144 @@  discard block
 block discarded – undo
1033 1033
  */
1034 1034
 function geodir_extend_geodirectory_setting_tab($tabs)
1035 1035
 {
1036
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1037
-    return $tabs;
1036
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1037
+	return $tabs;
1038 1038
 }
1039 1039
 
1040 1040
 
1041 1041
 if (!function_exists('geodir_edit_post_columns')) {
1042
-    /**
1043
-     * Modify admin post listing page columns.
1044
-     *
1045
-     * @since 1.0.0
1046
-     * @package GeoDirectory
1047
-     * @param array $columns The column array.
1048
-     * @return array Altered column array.
1049
-     */
1050
-    function geodir_edit_post_columns($columns)
1051
-    {
1052
-
1053
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1054
-            'categorys' => __('Categories', 'geodirectory'));
1055
-
1056
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1057
-        {
1058
-            $offset = 0; // should we prepend $array with $data?
1059
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
1060
-        }
1042
+	/**
1043
+	 * Modify admin post listing page columns.
1044
+	 *
1045
+	 * @since 1.0.0
1046
+	 * @package GeoDirectory
1047
+	 * @param array $columns The column array.
1048
+	 * @return array Altered column array.
1049
+	 */
1050
+	function geodir_edit_post_columns($columns)
1051
+	{
1061 1052
 
1062
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1053
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1054
+			'categorys' => __('Categories', 'geodirectory'));
1063 1055
 
1064
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1056
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1057
+		{
1058
+			$offset = 0; // should we prepend $array with $data?
1059
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
1060
+		}
1065 1061
 
1066
-        return $columns;
1067
-    }
1062
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1063
+
1064
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1065
+
1066
+		return $columns;
1067
+	}
1068 1068
 }
1069 1069
 
1070 1070
 
1071 1071
 if (!function_exists('geodir_manage_post_columns')) {
1072
-    /**
1073
-     * Adds content to our custom post listing page columns.
1074
-     *
1075
-     * @since 1.0.0
1076
-     * @package GeoDirectory
1077
-     * @global object $wpdb WordPress Database object.
1078
-     * @global object $post WordPress Post object.
1079
-     * @param string $column The column name.
1080
-     * @param int $post_id The post ID.
1081
-     */
1082
-    function geodir_manage_post_columns($column, $post_id)
1083
-    {
1084
-        global $post, $wpdb;
1085
-
1086
-        switch ($column):
1087
-            /* If displaying the 'city' column. */
1088
-            case 'location' :
1089
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1090
-                $location = geodir_get_location($location_id);
1091
-                /* If no city is found, output a default message. */
1092
-                if (empty($location)) {
1093
-                    _e('Unknown', 'geodirectory');
1094
-                } else {
1095
-                    /* If there is a city id, append 'city name' to the text string. */
1096
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1097
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1098
-                }
1099
-                break;
1100
-
1101
-            /* If displaying the 'expire' column. */
1102
-            case 'expire' :
1103
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1104
-                $d1 = $expire_date; // get expire_date
1105
-                $d2 = date('Y-m-d'); // get current date
1106
-                $state = __('days left', 'geodirectory');
1107
-                $date_diff_text = '';
1108
-                $expire_class = 'expire_left';
1109
-                if ($expire_date != 'Never') {
1110
-                    if (strtotime($d1) < strtotime($d2)) {
1111
-                        $state = __('days overdue', 'geodirectory');
1112
-                        $expire_class = 'expire_over';
1113
-                    }
1114
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
1115
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1116
-                }
1117
-                /* If no expire_date is found, output a default message. */
1118
-                if (empty($expire_date))
1119
-                    echo __('Unknown', 'geodirectory');
1120
-                /* If there is a expire_date, append 'days left' to the text string. */
1121
-                else
1122
-                    echo $expire_date . $date_diff_text;
1123
-                break;
1124
-
1125
-            /* If displaying the 'categorys' column. */
1126
-            case 'categorys' :
1127
-
1128
-                /* Get the categorys for the post. */
1129
-
1130
-
1131
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1132
-
1133
-                /* If terms were found. */
1134
-                if (!empty($terms)) {
1135
-                    $out = array();
1136
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
1137
-                    foreach ($terms as $term) {
1138
-                        if (!strstr($term->taxonomy, 'tag')) {
1139
-                            $out[] = sprintf('<a href="%s">%s</a>',
1140
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1141
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1142
-                            );
1143
-                        }
1144
-                    }
1145
-                    /* Join the terms, separating them with a comma. */
1146
-                    echo(join(', ', $out));
1147
-                } /* If no terms were found, output a default message. */
1148
-                else {
1149
-                    _e('No Categories', 'geodirectory');
1150
-                }
1151
-                break;
1072
+	/**
1073
+	 * Adds content to our custom post listing page columns.
1074
+	 *
1075
+	 * @since 1.0.0
1076
+	 * @package GeoDirectory
1077
+	 * @global object $wpdb WordPress Database object.
1078
+	 * @global object $post WordPress Post object.
1079
+	 * @param string $column The column name.
1080
+	 * @param int $post_id The post ID.
1081
+	 */
1082
+	function geodir_manage_post_columns($column, $post_id)
1083
+	{
1084
+		global $post, $wpdb;
1085
+
1086
+		switch ($column):
1087
+			/* If displaying the 'city' column. */
1088
+			case 'location' :
1089
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1090
+				$location = geodir_get_location($location_id);
1091
+				/* If no city is found, output a default message. */
1092
+				if (empty($location)) {
1093
+					_e('Unknown', 'geodirectory');
1094
+				} else {
1095
+					/* If there is a city id, append 'city name' to the text string. */
1096
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1097
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1098
+				}
1099
+				break;
1100
+
1101
+			/* If displaying the 'expire' column. */
1102
+			case 'expire' :
1103
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1104
+				$d1 = $expire_date; // get expire_date
1105
+				$d2 = date('Y-m-d'); // get current date
1106
+				$state = __('days left', 'geodirectory');
1107
+				$date_diff_text = '';
1108
+				$expire_class = 'expire_left';
1109
+				if ($expire_date != 'Never') {
1110
+					if (strtotime($d1) < strtotime($d2)) {
1111
+						$state = __('days overdue', 'geodirectory');
1112
+						$expire_class = 'expire_over';
1113
+					}
1114
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
1115
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1116
+				}
1117
+				/* If no expire_date is found, output a default message. */
1118
+				if (empty($expire_date))
1119
+					echo __('Unknown', 'geodirectory');
1120
+				/* If there is a expire_date, append 'days left' to the text string. */
1121
+				else
1122
+					echo $expire_date . $date_diff_text;
1123
+				break;
1152 1124
 
1153
-        endswitch;
1154
-    }
1125
+			/* If displaying the 'categorys' column. */
1126
+			case 'categorys' :
1127
+
1128
+				/* Get the categorys for the post. */
1129
+
1130
+
1131
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1132
+
1133
+				/* If terms were found. */
1134
+				if (!empty($terms)) {
1135
+					$out = array();
1136
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
1137
+					foreach ($terms as $term) {
1138
+						if (!strstr($term->taxonomy, 'tag')) {
1139
+							$out[] = sprintf('<a href="%s">%s</a>',
1140
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1141
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1142
+							);
1143
+						}
1144
+					}
1145
+					/* Join the terms, separating them with a comma. */
1146
+					echo(join(', ', $out));
1147
+				} /* If no terms were found, output a default message. */
1148
+				else {
1149
+					_e('No Categories', 'geodirectory');
1150
+				}
1151
+				break;
1152
+
1153
+		endswitch;
1154
+	}
1155 1155
 }
1156 1156
 
1157 1157
 
1158 1158
 if (!function_exists('geodir_post_sortable_columns')) {
1159
-    /**
1160
-     * Makes admin post listing page columns sortable.
1161
-     *
1162
-     * @since 1.0.0
1163
-     * @package GeoDirectory
1164
-     * @param array $columns The column array.
1165
-     * @return array Altered column array.
1166
-     */
1167
-    function geodir_post_sortable_columns($columns)
1168
-    {
1169
-
1170
-        $columns['expire'] = 'expire';
1171
-
1172
-        return $columns;
1173
-    }
1159
+	/**
1160
+	 * Makes admin post listing page columns sortable.
1161
+	 *
1162
+	 * @since 1.0.0
1163
+	 * @package GeoDirectory
1164
+	 * @param array $columns The column array.
1165
+	 * @return array Altered column array.
1166
+	 */
1167
+	function geodir_post_sortable_columns($columns)
1168
+	{
1169
+
1170
+		$columns['expire'] = 'expire';
1171
+
1172
+		return $columns;
1173
+	}
1174 1174
 }
1175 1175
 
1176 1176
 /**
@@ -1184,32 +1184,32 @@  discard block
 block discarded – undo
1184 1184
  * @param int $post_id The post ID.
1185 1185
  */
1186 1186
 function geodir_post_information_save($post_id, $post) {
1187
-    global $wpdb, $current_user;
1187
+	global $wpdb, $current_user;
1188 1188
 
1189
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1190
-        return;
1191
-    }
1189
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1190
+		return;
1191
+	}
1192 1192
 
1193
-    $geodir_posttypes = geodir_get_posttypes();
1193
+	$geodir_posttypes = geodir_get_posttypes();
1194 1194
 
1195
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1196
-        return;
1195
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1196
+		return;
1197 1197
 
1198
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1199
-        if (isset($_REQUEST['_status']))
1200
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1198
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1199
+		if (isset($_REQUEST['_status']))
1200
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
1201 1201
 
1202
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1203
-            return;
1202
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1203
+			return;
1204 1204
 
1205
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1206
-            return;
1205
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1206
+			return;
1207 1207
 
1208
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1209
-            return;
1208
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1209
+			return;
1210 1210
 
1211
-        geodir_save_listing($_REQUEST);
1212
-    }
1211
+		geodir_save_listing($_REQUEST);
1212
+	}
1213 1213
 }
1214 1214
 
1215 1215
 /**
@@ -1225,102 +1225,102 @@  discard block
 block discarded – undo
1225 1225
  */
1226 1226
 function geodir_admin_fields($options)
1227 1227
 {
1228
-    global $geodirectory;
1229
-
1230
-    $first_title = true;
1231
-    $tab_id = '';
1232
-    $i = 0;
1233
-    foreach ($options as $value) :
1234
-        if (!isset($value['name'])) $value['name'] = '';
1235
-        if (!isset($value['class'])) $value['class'] = '';
1236
-        if (!isset($value['css'])) $value['css'] = '';
1237
-        if (!isset($value['std'])) $value['std'] = '';
1238
-        $desc = '';
1239
-        switch ($value['type']) :
1240
-            case 'dummy_installer':
1241
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1242
-                geodir_autoinstall_admin_header($post_type);
1243
-                break;
1244
-            case 'title':
1245
-
1246
-                if ($i == 0) {
1247
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1248
-                    echo '<div class="inner_content_tab_main">';
1249
-                }
1228
+	global $geodirectory;
1229
+
1230
+	$first_title = true;
1231
+	$tab_id = '';
1232
+	$i = 0;
1233
+	foreach ($options as $value) :
1234
+		if (!isset($value['name'])) $value['name'] = '';
1235
+		if (!isset($value['class'])) $value['class'] = '';
1236
+		if (!isset($value['css'])) $value['css'] = '';
1237
+		if (!isset($value['std'])) $value['std'] = '';
1238
+		$desc = '';
1239
+		switch ($value['type']) :
1240
+			case 'dummy_installer':
1241
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1242
+				geodir_autoinstall_admin_header($post_type);
1243
+				break;
1244
+			case 'title':
1245
+
1246
+				if ($i == 0) {
1247
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1248
+					echo '<div class="inner_content_tab_main">';
1249
+				}
1250 1250
 
1251
-                $i++;
1251
+				$i++;
1252 1252
 
1253
-                if (isset($value['id']) && $value['id'])
1254
-                    $tab_id = $value['id'];
1253
+				if (isset($value['id']) && $value['id'])
1254
+					$tab_id = $value['id'];
1255 1255
 
1256
-                if (isset($value['desc']) && $value['desc'])
1257
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1256
+				if (isset($value['desc']) && $value['desc'])
1257
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1258 1258
 
1259
-                if (isset($value['name']) && $value['name']) {
1260
-                    if ($first_title === true) {
1261
-                        $first_title = false;
1262
-                    } else {
1263
-                        echo '</div>';
1264
-                    }
1265
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1259
+				if (isset($value['name']) && $value['name']) {
1260
+					if ($first_title === true) {
1261
+						$first_title = false;
1262
+					} else {
1263
+						echo '</div>';
1264
+					}
1265
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1266 1266
 
1267
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1268
-                }
1267
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1268
+				}
1269 1269
 
1270
-                /**
1271
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
1272
-                 *
1273
-                 * The action is called dynamically geodir_settings_$value['id'].
1274
-                 *
1275
-                 * @since 1.0.0
1276
-                 */
1277
-                do_action('geodir_settings_' . sanitize_title($value['id']));
1278
-                break;
1279
-
1280
-            case 'no_tabs':
1281
-
1282
-                echo '<div class="inner_content_tab_main">';
1283
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1284
-
1285
-                break;
1286
-
1287
-            case 'sectionstart':
1288
-                if (isset($value['desc']) && $value['desc'])
1289
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1290
-                if (isset($value['name']) && $value['name'])
1291
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1292
-                /**
1293
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1294
-                 *
1295
-                 * The action is called dynamically geodir_settings_$value['id']_start.
1296
-                 *
1297
-                 * @since 1.0.0
1298
-                 */
1299
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1300
-                echo '<table class="form-table">' . "\n\n";
1301
-
1302
-                break;
1303
-            case 'sectionend':
1304
-                /**
1305
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1306
-                 *
1307
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1308
-                 *
1309
-                 * @since 1.0.0
1310
-                 */
1311
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1312
-                echo '</table>';
1313
-                /**
1314
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1315
-                 *
1316
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1317
-                 *
1318
-                 * @since 1.0.0
1319
-                 */
1320
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1321
-                break;
1322
-            case 'text':
1323
-                ?>
1270
+				/**
1271
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
1272
+				 *
1273
+				 * The action is called dynamically geodir_settings_$value['id'].
1274
+				 *
1275
+				 * @since 1.0.0
1276
+				 */
1277
+				do_action('geodir_settings_' . sanitize_title($value['id']));
1278
+				break;
1279
+
1280
+			case 'no_tabs':
1281
+
1282
+				echo '<div class="inner_content_tab_main">';
1283
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1284
+
1285
+				break;
1286
+
1287
+			case 'sectionstart':
1288
+				if (isset($value['desc']) && $value['desc'])
1289
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1290
+				if (isset($value['name']) && $value['name'])
1291
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
1292
+				/**
1293
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1294
+				 *
1295
+				 * The action is called dynamically geodir_settings_$value['id']_start.
1296
+				 *
1297
+				 * @since 1.0.0
1298
+				 */
1299
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1300
+				echo '<table class="form-table">' . "\n\n";
1301
+
1302
+				break;
1303
+			case 'sectionend':
1304
+				/**
1305
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1306
+				 *
1307
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1308
+				 *
1309
+				 * @since 1.0.0
1310
+				 */
1311
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1312
+				echo '</table>';
1313
+				/**
1314
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1315
+				 *
1316
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1317
+				 *
1318
+				 * @since 1.0.0
1319
+				 */
1320
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1321
+				break;
1322
+			case 'text':
1323
+				?>
1324 1324
                 <tr valign="top">
1325 1325
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1326 1326
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1329,15 +1329,15 @@  discard block
 block discarded – undo
1329 1329
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1330 1330
                                            style=" <?php echo esc_attr($value['css']); ?>"
1331 1331
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1332
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1333
-                                           } else {
1334
-                                               echo esc_attr($value['std']);
1335
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1332
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1333
+										   } else {
1334
+											   echo esc_attr($value['std']);
1335
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1336 1336
                 </tr><?php
1337
-                break;
1337
+				break;
1338 1338
 
1339
-            case 'password':
1340
-                ?>
1339
+			case 'password':
1340
+				?>
1341 1341
                 <tr valign="top">
1342 1342
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1343 1343
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1346,42 +1346,42 @@  discard block
 block discarded – undo
1346 1346
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1347 1347
                                            style="<?php echo esc_attr($value['css']); ?>"
1348 1348
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1349
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1350
-                                           } else {
1351
-                                               echo esc_attr($value['std']);
1352
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1349
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1350
+										   } else {
1351
+											   echo esc_attr($value['std']);
1352
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1353 1353
                 </tr><?php
1354
-                break;
1354
+				break;
1355 1355
 
1356
-            case 'html_content':
1357
-                ?>
1356
+			case 'html_content':
1357
+				?>
1358 1358
                 <tr valign="top">
1359 1359
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1360 1360
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1361 1361
                 </tr><?php
1362
-                break;
1362
+				break;
1363 1363
 
1364
-            case 'color' :
1365
-                ?>
1364
+			case 'color' :
1365
+				?>
1366 1366
                 <tr valign="top">
1367 1367
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1368 1368
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1369 1369
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1370 1370
                                            style="<?php echo esc_attr($value['css']); ?>"
1371 1371
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1372
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1373
-                                           } else {
1374
-                                               echo esc_attr($value['std']);
1375
-                                           } ?>" class="colorpick"/> <span
1372
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1373
+										   } else {
1374
+											   echo esc_attr($value['std']);
1375
+										   } ?>" class="colorpick"/> <span
1376 1376
                         class="description"><?php echo $value['desc']; ?></span>
1377 1377
 
1378 1378
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1379 1379
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1380 1380
                 </td>
1381 1381
                 </tr><?php
1382
-                break;
1383
-            case 'image_width' :
1384
-                ?>
1382
+				break;
1383
+			case 'image_width' :
1384
+				?>
1385 1385
                 <tr valign="top">
1386 1386
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1387 1387
                 <td class="forminp">
@@ -1403,11 +1403,11 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1405 1405
                 </tr><?php
1406
-                break;
1407
-            case 'select':
1408
-                $option_value = get_option($value['id']);
1409
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1410
-                ?>
1406
+				break;
1407
+			case 'select':
1408
+				$option_value = get_option($value['id']);
1409
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1410
+				?>
1411 1411
                 <tr valign="top">
1412 1412
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1413 1413
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1416,33 +1416,33 @@  discard block
 block discarded – undo
1416 1416
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1417 1417
                                             option-ajaxchosen="false">
1418 1418
                         <?php
1419
-                        foreach ($value['options'] as $key => $val) {
1420
-                            $geodir_select_value = '';
1421
-                            if ($option_value != '') {
1422
-                                if ($option_value != '' && $option_value == $key)
1423
-                                    $geodir_select_value = ' selected="selected" ';
1424
-                            } else {
1425
-                                if ($value['std'] == $key)
1426
-                                    $geodir_select_value = ' selected="selected" ';
1427
-                            }
1428
-                            ?>
1419
+						foreach ($value['options'] as $key => $val) {
1420
+							$geodir_select_value = '';
1421
+							if ($option_value != '') {
1422
+								if ($option_value != '' && $option_value == $key)
1423
+									$geodir_select_value = ' selected="selected" ';
1424
+							} else {
1425
+								if ($value['std'] == $key)
1426
+									$geodir_select_value = ' selected="selected" ';
1427
+							}
1428
+							?>
1429 1429
                             <option
1430 1430
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo ucfirst($val) ?></option>
1431 1431
                         <?php
1432
-                        }
1433
-                        ?>
1432
+						}
1433
+						?>
1434 1434
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1435 1435
                 </td>
1436 1436
                 </tr><?php
1437
-                break;
1437
+				break;
1438 1438
 
1439
-            case 'multiselect':
1440
-                $option_values = get_option($value['id']);
1441
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1442
-                   $option_values = $value['std'];
1443
-                }
1444
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1445
-                ?>
1439
+			case 'multiselect':
1440
+				$option_values = get_option($value['id']);
1441
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1442
+				   $option_values = $value['std'];
1443
+				}
1444
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1445
+				?>
1446 1446
                 <tr valign="top">
1447 1447
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1448 1448
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1452,25 +1452,25 @@  discard block
 block discarded – undo
1452 1452
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1453 1453
                                             option-ajaxchosen="false">
1454 1454
                         <?php
1455
-                        foreach ($value['options'] as $key => $val) {
1456
-                            if (strpos($key, 'optgroup_start-') === 0) {
1457
-                                ?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1458
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1459
-                                ?></optgroup><?php
1460
-                            } else {
1461
-                                ?>
1455
+						foreach ($value['options'] as $key => $val) {
1456
+							if (strpos($key, 'optgroup_start-') === 0) {
1457
+								?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1458
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1459
+								?></optgroup><?php
1460
+							} else {
1461
+								?>
1462 1462
                                 <option
1463 1463
                                     value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1464 1464
                             <?php
1465
-                            }
1466
-                        }
1467
-                        ?>
1465
+							}
1466
+						}
1467
+						?>
1468 1468
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1469 1469
                 </td>
1470 1470
                 </tr><?php
1471
-                break;
1472
-            case 'file':
1473
-                ?>
1471
+				break;
1472
+			case 'file':
1473
+				?>
1474 1474
                 <tr valign="top">
1475 1475
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1476 1476
                 <td class="forminp">
@@ -1490,87 +1490,87 @@  discard block
 block discarded – undo
1490 1490
                     <?php } ?>
1491 1491
                 </td>
1492 1492
                 </tr><?php
1493
-                break;
1494
-            case 'map_default_settings' :
1495
-                ?>
1493
+				break;
1494
+			case 'map_default_settings' :
1495
+				?>
1496 1496
 
1497 1497
                 <tr valign="top">
1498 1498
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1499 1499
                     <td width="60%">
1500 1500
                         <select name="geodir_default_map_language" style="width:60%">
1501 1501
                             <?php
1502
-                            $arr_map_langages = array(
1503
-                                'ar' => __('ARABIC', 'geodirectory'),
1504
-                                'eu' => __('BASQUE', 'geodirectory'),
1505
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1506
-                                'bn' => __('BENGALI', 'geodirectory'),
1507
-                                'ca' => __('CATALAN', 'geodirectory'),
1508
-                                'cs' => __('CZECH', 'geodirectory'),
1509
-                                'da' => __('DANISH', 'geodirectory'),
1510
-                                'de' => __('GERMAN', 'geodirectory'),
1511
-                                'el' => __('GREEK', 'geodirectory'),
1512
-                                'en' => __('ENGLISH', 'geodirectory'),
1513
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1514
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1515
-                                'es' => __('SPANISH', 'geodirectory'),
1516
-                                'eu' => __('BASQUE', 'geodirectory'),
1517
-                                'fa' => __('FARSI', 'geodirectory'),
1518
-                                'fi' => __('FINNISH', 'geodirectory'),
1519
-                                'fil' => __('FILIPINO', 'geodirectory'),
1520
-                                'fr' => __('FRENCH', 'geodirectory'),
1521
-                                'gl' => __('GALICIAN', 'geodirectory'),
1522
-                                'gu' => __('GUJARATI', 'geodirectory'),
1523
-                                'hi' => __('HINDI', 'geodirectory'),
1524
-                                'hr' => __('CROATIAN', 'geodirectory'),
1525
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1526
-                                'id' => __('INDONESIAN', 'geodirectory'),
1527
-                                'it' => __('ITALIAN', 'geodirectory'),
1528
-                                'iw' => __('HEBREW', 'geodirectory'),
1529
-                                'ja' => __('JAPANESE', 'geodirectory'),
1530
-                                'kn' => __('KANNADA', 'geodirectory'),
1531
-                                'ko' => __('KOREAN', 'geodirectory'),
1532
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1533
-                                'lv' => __('LATVIAN', 'geodirectory'),
1534
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1535
-                                'mr' => __('MARATHI', 'geodirectory'),
1536
-                                'nl' => __('DUTCH', 'geodirectory'),
1537
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1538
-                                'pl' => __('POLISH', 'geodirectory'),
1539
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1540
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1541
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1542
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1543
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1544
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1545
-                                'sk' => __('SLOVAK', 'geodirectory'),
1546
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1547
-                                'sr' => __('SERBIAN', 'geodirectory'),
1548
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1549
-                                'tl' => __('TAGALOG', 'geodirectory'),
1550
-                                'ta' => __('TAMIL', 'geodirectory'),
1551
-                                'te' => __('TELUGU', 'geodirectory'),
1552
-                                'th' => __('THAI', 'geodirectory'),
1553
-                                'tr' => __('TURKISH', 'geodirectory'),
1554
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1555
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1556
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1557
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1558
-                            );
1559
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1560
-                            if (empty($geodir_default_map_language))
1561
-                                $geodir_default_map_language = 'en';
1562
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1563
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1564
-                                    $geodir_default_language_selected = "selected='selected'";
1565
-                                else
1566
-                                    $geodir_default_language_selected = '';
1567
-
1568
-                                ?>
1502
+							$arr_map_langages = array(
1503
+								'ar' => __('ARABIC', 'geodirectory'),
1504
+								'eu' => __('BASQUE', 'geodirectory'),
1505
+								'bg' => __('BULGARIAN', 'geodirectory'),
1506
+								'bn' => __('BENGALI', 'geodirectory'),
1507
+								'ca' => __('CATALAN', 'geodirectory'),
1508
+								'cs' => __('CZECH', 'geodirectory'),
1509
+								'da' => __('DANISH', 'geodirectory'),
1510
+								'de' => __('GERMAN', 'geodirectory'),
1511
+								'el' => __('GREEK', 'geodirectory'),
1512
+								'en' => __('ENGLISH', 'geodirectory'),
1513
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1514
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1515
+								'es' => __('SPANISH', 'geodirectory'),
1516
+								'eu' => __('BASQUE', 'geodirectory'),
1517
+								'fa' => __('FARSI', 'geodirectory'),
1518
+								'fi' => __('FINNISH', 'geodirectory'),
1519
+								'fil' => __('FILIPINO', 'geodirectory'),
1520
+								'fr' => __('FRENCH', 'geodirectory'),
1521
+								'gl' => __('GALICIAN', 'geodirectory'),
1522
+								'gu' => __('GUJARATI', 'geodirectory'),
1523
+								'hi' => __('HINDI', 'geodirectory'),
1524
+								'hr' => __('CROATIAN', 'geodirectory'),
1525
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1526
+								'id' => __('INDONESIAN', 'geodirectory'),
1527
+								'it' => __('ITALIAN', 'geodirectory'),
1528
+								'iw' => __('HEBREW', 'geodirectory'),
1529
+								'ja' => __('JAPANESE', 'geodirectory'),
1530
+								'kn' => __('KANNADA', 'geodirectory'),
1531
+								'ko' => __('KOREAN', 'geodirectory'),
1532
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1533
+								'lv' => __('LATVIAN', 'geodirectory'),
1534
+								'ml' => __('MALAYALAM', 'geodirectory'),
1535
+								'mr' => __('MARATHI', 'geodirectory'),
1536
+								'nl' => __('DUTCH', 'geodirectory'),
1537
+								'no' => __('NORWEGIAN', 'geodirectory'),
1538
+								'pl' => __('POLISH', 'geodirectory'),
1539
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1540
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1541
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1542
+								'ro' => __('ROMANIAN', 'geodirectory'),
1543
+								'ru' => __('RUSSIAN', 'geodirectory'),
1544
+								'ru' => __('RUSSIAN', 'geodirectory'),
1545
+								'sk' => __('SLOVAK', 'geodirectory'),
1546
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1547
+								'sr' => __('SERBIAN', 'geodirectory'),
1548
+								'sv' => __('	SWEDISH', 'geodirectory'),
1549
+								'tl' => __('TAGALOG', 'geodirectory'),
1550
+								'ta' => __('TAMIL', 'geodirectory'),
1551
+								'te' => __('TELUGU', 'geodirectory'),
1552
+								'th' => __('THAI', 'geodirectory'),
1553
+								'tr' => __('TURKISH', 'geodirectory'),
1554
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1555
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1556
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1557
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1558
+							);
1559
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1560
+							if (empty($geodir_default_map_language))
1561
+								$geodir_default_map_language = 'en';
1562
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1563
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1564
+									$geodir_default_language_selected = "selected='selected'";
1565
+								else
1566
+									$geodir_default_language_selected = '';
1567
+
1568
+								?>
1569 1569
                                 <option
1570 1570
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1571 1571
 
1572 1572
                             <?php }
1573
-                            ?>
1573
+							?>
1574 1574
                         </select>
1575 1575
                     </td>
1576 1576
                 </tr>
@@ -1581,46 +1581,46 @@  discard block
 block discarded – undo
1581 1581
                     <td width="60%">
1582 1582
                         <select name="geodir_default_map_search_pt" style="width:60%">
1583 1583
                             <?php
1584
-                            $post_types = geodir_get_posttypes('array');
1585
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1586
-                            if (empty($geodir_default_map_search_pt))
1587
-                                $geodir_default_map_search_pt = 'gd_place';
1588
-                            if (is_array($post_types)) {
1589
-                                foreach ($post_types as $key => $post_types_obj) {
1590
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1591
-                                        $geodir_search_pt_selected = "selected='selected'";
1592
-                                    else
1593
-                                        $geodir_search_pt_selected = '';
1594
-
1595
-                                    ?>
1584
+							$post_types = geodir_get_posttypes('array');
1585
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1586
+							if (empty($geodir_default_map_search_pt))
1587
+								$geodir_default_map_search_pt = 'gd_place';
1588
+							if (is_array($post_types)) {
1589
+								foreach ($post_types as $key => $post_types_obj) {
1590
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1591
+										$geodir_search_pt_selected = "selected='selected'";
1592
+									else
1593
+										$geodir_search_pt_selected = '';
1594
+
1595
+									?>
1596 1596
                                     <option
1597 1597
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo $post_types_obj['labels']['singular_name']; ?></option>
1598 1598
 
1599 1599
                                 <?php }
1600 1600
 
1601
-                            }
1601
+							}
1602 1602
 
1603
-                            ?>
1603
+							?>
1604 1604
                         </select>
1605 1605
                     </td>
1606 1606
                 </tr>
1607 1607
 
1608 1608
                 <?php
1609
-                break;
1609
+				break;
1610 1610
 
1611
-            case 'map':
1612
-                ?>
1611
+			case 'map':
1612
+				?>
1613 1613
                 <tr valign="top">
1614 1614
                     <td class="forminp">
1615 1615
                         <?php
1616
-                        global $post_cat, $cat_display;
1617
-                        $post_types = geodir_get_posttypes('object');
1618
-                        $cat_display = 'checkbox';
1619
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1620
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1621
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1622
-                        $count = 1;
1623
-                        ?>
1616
+						global $post_cat, $cat_display;
1617
+						$post_types = geodir_get_posttypes('object');
1618
+						$cat_display = 'checkbox';
1619
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1620
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1621
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1622
+						$count = 1;
1623
+						?>
1624 1624
                         <table width="70%" class="widefat">
1625 1625
                             <thead>
1626 1626
                             <tr>
@@ -1629,18 +1629,18 @@  discard block
 block discarded – undo
1629 1629
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1630 1630
                             </tr>
1631 1631
                             <?php
1632
-                            $gd_categs = $gd_cats;
1633
-                            foreach ($post_types as $key => $post_types_obj) :
1634
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1635
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1636
-                                if ($gd_cats_upgrade) {
1637
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1638
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1639
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1640
-                                }
1641
-                                $post_cat = implode(',', $gd_cats);
1642
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1643
-                                ?>
1632
+							$gd_categs = $gd_cats;
1633
+							foreach ($post_types as $key => $post_types_obj) :
1634
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1635
+								$gd_taxonomy = geodir_get_taxonomies($key);
1636
+								if ($gd_cats_upgrade) {
1637
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1638
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1639
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1640
+								}
1641
+								$post_cat = implode(',', $gd_cats);
1642
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1643
+								?>
1644 1644
                                 <tr>
1645 1645
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1646 1646
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1661,19 +1661,19 @@  discard block
 block discarded – undo
1661 1661
                     </td>
1662 1662
                 </tr>
1663 1663
                 <?php
1664
-                break;
1664
+				break;
1665 1665
 
1666
-            case 'checkbox' :
1666
+			case 'checkbox' :
1667 1667
 
1668
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1669
-                    ?>
1668
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1669
+					?>
1670 1670
                     <tr valign="top">
1671 1671
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1672 1672
                     <td class="forminp">
1673 1673
                 <?php
1674
-                endif;
1674
+				endif;
1675 1675
 
1676
-                ?>
1676
+				?>
1677 1677
                 <fieldset>
1678 1678
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1679 1679
                     <label for="<?php echo $value['id'] ?>">
@@ -1683,49 +1683,49 @@  discard block
 block discarded – undo
1683 1683
                 </fieldset>
1684 1684
                 <?php
1685 1685
 
1686
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1687
-                    ?>
1686
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1687
+					?>
1688 1688
                     </td>
1689 1689
                     </tr>
1690 1690
                 <?php
1691
-                endif;
1691
+				endif;
1692 1692
 
1693
-                break;
1693
+				break;
1694 1694
 
1695
-            case 'radio' :
1695
+			case 'radio' :
1696 1696
 
1697
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1698
-                    ?>
1697
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1698
+					?>
1699 1699
                     <tr valign="top">
1700 1700
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1701 1701
                     <td class="forminp">
1702 1702
                 <?php
1703
-                endif;
1703
+				endif;
1704 1704
 
1705
-                ?>
1705
+				?>
1706 1706
                 <fieldset>
1707 1707
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1708 1708
                     <label for="<?php echo $value['id'];?>">
1709 1709
                         <input name="<?php echo esc_attr($value['id']); ?>"
1710 1710
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1711 1711
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1712
-                            echo 'checked="checked"';
1713
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1712
+							echo 'checked="checked"';
1713
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1714 1714
                         <?php echo $value['desc']; ?></label><br>
1715 1715
                 </fieldset>
1716 1716
                 <?php
1717 1717
 
1718
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1719
-                    ?>
1718
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1719
+					?>
1720 1720
                     </td>
1721 1721
                     </tr>
1722 1722
                 <?php
1723
-                endif;
1723
+				endif;
1724 1724
 
1725
-                break;
1725
+				break;
1726 1726
 
1727
-            case 'textarea':
1728
-                ?>
1727
+			case 'textarea':
1728
+				?>
1729 1729
                 <tr valign="top">
1730 1730
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1731 1731
                 <td class="forminp">
@@ -1738,30 +1738,30 @@  discard block
 block discarded – undo
1738 1738
 
1739 1739
                 </td>
1740 1740
                 </tr><?php
1741
-                break;
1741
+				break;
1742 1742
 
1743
-            case 'editor':
1744
-                ?>
1743
+			case 'editor':
1744
+				?>
1745 1745
                 <tr valign="top">
1746 1746
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1747 1747
                 <td class="forminp"><?php
1748
-                    if (get_option($value['id']))
1749
-                        $content = stripslashes(get_option($value['id']));
1750
-                    else
1751
-                        $content = $value['std'];
1748
+					if (get_option($value['id']))
1749
+						$content = stripslashes(get_option($value['id']));
1750
+					else
1751
+						$content = $value['std'];
1752 1752
 
1753
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1753
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1754 1754
 
1755
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1755
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1756 1756
 
1757
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1757
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1758 1758
 
1759 1759
                 </td>
1760 1760
                 </tr><?php
1761
-                break;
1761
+				break;
1762 1762
 
1763
-            case 'single_select_page' :
1764
-                // WPML
1763
+			case 'single_select_page' :
1764
+				// WPML
1765 1765
 				$switch_lang = false;
1766 1766
 				$disabled = '';
1767 1767
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1779,18 +1779,18 @@  discard block
 block discarded – undo
1779 1779
 				//
1780 1780
 				$page_setting = (int)get_option($value['id']);
1781 1781
 
1782
-                $args = array('name' => $value['id'],
1783
-                    'id' => $value['id'],
1784
-                    'sort_column' => 'menu_order',
1785
-                    'sort_order' => 'ASC',
1786
-                    'show_option_none' => ' ',
1787
-                    'class' => $value['class'],
1788
-                    'echo' => false,
1789
-                    'selected' => $page_setting);
1782
+				$args = array('name' => $value['id'],
1783
+					'id' => $value['id'],
1784
+					'sort_column' => 'menu_order',
1785
+					'sort_order' => 'ASC',
1786
+					'show_option_none' => ' ',
1787
+					'class' => $value['class'],
1788
+					'echo' => false,
1789
+					'selected' => $page_setting);
1790 1790
 
1791
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1791
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1792 1792
 
1793
-                ?>
1793
+				?>
1794 1794
                 <tr valign="top" class="single_select_page">
1795 1795
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1796 1796
                 <td class="forminp">
@@ -1801,17 +1801,17 @@  discard block
 block discarded – undo
1801 1801
 				if ($switch_lang) {
1802 1802
 					$sitepress->switch_lang($switch_lang, true);
1803 1803
 				}
1804
-                break;
1805
-            case 'single_select_country' :
1806
-                $country_setting = (string)get_option($value['id']);
1807
-                if (strstr($country_setting, ':')) :
1808
-                    $country = current(explode(':', $country_setting));
1809
-                    $state = end(explode(':', $country_setting));
1810
-                else :
1811
-                    $country = $country_setting;
1812
-                    $state = '*';
1813
-                endif;
1814
-                ?>
1804
+				break;
1805
+			case 'single_select_country' :
1806
+				$country_setting = (string)get_option($value['id']);
1807
+				if (strstr($country_setting, ':')) :
1808
+					$country = current(explode(':', $country_setting));
1809
+					$state = end(explode(':', $country_setting));
1810
+				else :
1811
+					$country = $country_setting;
1812
+					$state = '*';
1813
+				endif;
1814
+				?>
1815 1815
                 <tr valign="top">
1816 1816
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1817 1817
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1822,12 +1822,12 @@  discard block
 block discarded – undo
1822 1822
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1823 1823
                 </td>
1824 1824
                 </tr><?php
1825
-                break;
1826
-            case 'multi_select_countries' :
1827
-                $countries = $geodirectory->countries->countries;
1828
-                asort($countries);
1829
-                $selections = (array)get_option($value['id']);
1830
-                ?>
1825
+				break;
1826
+			case 'multi_select_countries' :
1827
+				$countries = $geodirectory->countries->countries;
1828
+				asort($countries);
1829
+				$selections = (array)get_option($value['id']);
1830
+				?>
1831 1831
                 <tr valign="top">
1832 1832
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1833 1833
                 <td class="forminp">
@@ -1835,22 +1835,22 @@  discard block
 block discarded – undo
1835 1835
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1836 1836
                             title="Country" class="chosen_select">
1837 1837
                         <?php
1838
-                        if ($countries) foreach ($countries as $key => $val) :
1839
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1840
-                        endforeach;
1841
-                        ?>
1838
+						if ($countries) foreach ($countries as $key => $val) :
1839
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1840
+						endforeach;
1841
+						?>
1842 1842
                     </select>
1843 1843
                 </td>
1844 1844
                 </tr>
1845 1845
 
1846 1846
                 <?php
1847 1847
 
1848
-                break;
1848
+				break;
1849 1849
 
1850
-            case 'google_analytics' :
1851
-                $selections = (array)get_option($value['id']);
1852
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1853
-                    ?>
1850
+			case 'google_analytics' :
1851
+				$selections = (array)get_option($value['id']);
1852
+				if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1853
+					?>
1854 1854
                     <tr valign="top">
1855 1855
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1856 1856
                         <td class="forminp">
@@ -1858,19 +1858,19 @@  discard block
 block discarded – undo
1858 1858
 
1859 1859
                             <?php
1860 1860
 
1861
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1862
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1863
-                            $state = "&state=123";//any string
1864
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1865
-                            $response_type = "&response_type=code";
1866
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1867
-                            $access_type = "&access_type=offline";
1868
-                            $approval_prompt = "&approval_prompt=force";
1861
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1862
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1863
+							$state = "&state=123";//any string
1864
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1865
+							$response_type = "&response_type=code";
1866
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1867
+							$access_type = "&access_type=offline";
1868
+							$approval_prompt = "&approval_prompt=force";
1869 1869
 
1870
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1870
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1871 1871
 
1872 1872
 
1873
-                            ?>
1873
+							?>
1874 1874
                             <script>
1875 1875
                                 function gd_ga_popup() {
1876 1876
                                     var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
@@ -1885,47 +1885,47 @@  discard block
 block discarded – undo
1885 1885
                             </script>
1886 1886
 
1887 1887
                             <?php
1888
-                            if (get_option('gd_ga_refresh_token')) {
1889
-                                ?>
1888
+							if (get_option('gd_ga_refresh_token')) {
1889
+								?>
1890 1890
                                 <span class="button-primary"
1891 1891
                                       onclick="gd_ga_popup();"><?php _e('Re-authorize', 'geodirectory'); ?></span>
1892 1892
                                 <span
1893 1893
                                     style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1894 1894
                             <?php
1895
-                            } else {
1896
-                                ?>
1895
+							} else {
1896
+								?>
1897 1897
                                 <span class="button-primary"
1898 1898
                                       onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1899 1899
                             <?php
1900
-                            }
1901
-                            ?>
1900
+							}
1901
+							?>
1902 1902
                         </td>
1903 1903
                     </tr>
1904 1904
 
1905 1905
                 <?php
1906
-                }
1906
+				}
1907 1907
 
1908
-                break;
1908
+				break;
1909 1909
 
1910
-            case 'field_seperator' :
1910
+			case 'field_seperator' :
1911 1911
 
1912
-                ?>
1912
+				?>
1913 1913
                 <tr valign="top">
1914 1914
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1915 1915
                 </tr>
1916 1916
                 <?php
1917 1917
 
1918
-                break;
1918
+				break;
1919 1919
 
1920
-        endswitch;
1920
+		endswitch;
1921 1921
 
1922
-    endforeach;
1922
+	endforeach;
1923 1923
 
1924
-    if ($first_title === false) {
1925
-        echo "</div>";
1926
-    }
1924
+	if ($first_title === false) {
1925
+		echo "</div>";
1926
+	}
1927 1927
 
1928
-    ?>
1928
+	?>
1929 1929
 
1930 1930
     <script type="text/javascript">
1931 1931
 
@@ -1985,33 +1985,33 @@  discard block
 block discarded – undo
1985 1985
  */
1986 1986
 function geodir_post_info_setting()
1987 1987
 {
1988
-    global $post, $post_id;
1989
-
1990
-    $post_type = get_post_type();
1991
-
1992
-    $package_info = array();
1993
-
1994
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1995
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1996
-    echo '<div id="geodir_wrapper">';
1997
-    /**
1998
-     * Called before the GD custom fields are output in the wp-admin area.
1999
-     *
2000
-     * @since 1.0.0
2001
-     * @see 'geodir_after_default_field_in_meta_box'
2002
-     */
2003
-    do_action('geodir_before_default_field_in_meta_box');
2004
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
2005
-    // to display all fields in one information box
2006
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
2007
-    /**
2008
-     * Called after the GD custom fields are output in the wp-admin area.
2009
-     *
2010
-     * @since 1.0.0
2011
-     * @see 'geodir_before_default_field_in_meta_box'
2012
-     */
2013
-    do_action('geodir_after_default_field_in_meta_box');
2014
-    echo '</div>';
1988
+	global $post, $post_id;
1989
+
1990
+	$post_type = get_post_type();
1991
+
1992
+	$package_info = array();
1993
+
1994
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1995
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1996
+	echo '<div id="geodir_wrapper">';
1997
+	/**
1998
+	 * Called before the GD custom fields are output in the wp-admin area.
1999
+	 *
2000
+	 * @since 1.0.0
2001
+	 * @see 'geodir_after_default_field_in_meta_box'
2002
+	 */
2003
+	do_action('geodir_before_default_field_in_meta_box');
2004
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
2005
+	// to display all fields in one information box
2006
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
2007
+	/**
2008
+	 * Called after the GD custom fields are output in the wp-admin area.
2009
+	 *
2010
+	 * @since 1.0.0
2011
+	 * @see 'geodir_before_default_field_in_meta_box'
2012
+	 */
2013
+	do_action('geodir_after_default_field_in_meta_box');
2014
+	echo '</div>';
2015 2015
 }
2016 2016
 
2017 2017
 /**
@@ -2024,18 +2024,18 @@  discard block
 block discarded – undo
2024 2024
  */
2025 2025
 function geodir_post_addinfo_setting()
2026 2026
 {
2027
-    global $post, $post_id;
2027
+	global $post, $post_id;
2028 2028
 
2029
-    $post_type = get_post_type();
2029
+	$post_type = get_post_type();
2030 2030
 
2031
-    $package_info = array();
2031
+	$package_info = array();
2032 2032
 
2033
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
2033
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
2034 2034
 
2035
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2036
-    echo '<div id="geodir_wrapper">';
2037
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2038
-    echo '</div>';
2035
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2036
+	echo '<div id="geodir_wrapper">';
2037
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2038
+	echo '</div>';
2039 2039
 
2040 2040
 }
2041 2041
 
@@ -2049,60 +2049,60 @@  discard block
 block discarded – undo
2049 2049
  */
2050 2050
 function geodir_post_attachments()
2051 2051
 {
2052
-    global $post, $post_id;
2052
+	global $post, $post_id;
2053 2053
 
2054
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2054
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2055 2055
 
2056
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
2057
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2058
-        geodir_show_featured_image($post_id, 'thumbnail');
2059
-    }
2056
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
2057
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2058
+		geodir_show_featured_image($post_id, 'thumbnail');
2059
+	}
2060 2060
 
2061
-    $image_limit = 0;
2061
+	$image_limit = 0;
2062 2062
 
2063
-    ?>
2063
+	?>
2064 2064
 
2065 2065
 
2066 2066
     <h5 class="form_title">
2067 2067
         <?php if ($image_limit != 0 && $image_limit == 1) {
2068
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2069
-        } ?>
2068
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2069
+		} ?>
2070 2070
         <?php if ($image_limit != 0 && $image_limit > 1) {
2071
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2072
-        } ?>
2071
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2072
+		} ?>
2073 2073
         <?php if ($image_limit == 0) {
2074
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2075
-        } ?>
2074
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2075
+		} ?>
2076 2076
     </h5>
2077 2077
 
2078 2078
 
2079 2079
     <?php
2080 2080
 
2081
-    $curImages = geodir_get_images($post_id);
2082
-    $place_img_array = array();
2081
+	$curImages = geodir_get_images($post_id);
2082
+	$place_img_array = array();
2083 2083
 
2084
-    if (!empty($curImages)):
2085
-        foreach ($curImages as $p_img):
2086
-            $place_img_array[] = $p_img->src;
2087
-        endforeach;
2088
-    endif;
2084
+	if (!empty($curImages)):
2085
+		foreach ($curImages as $p_img):
2086
+			$place_img_array[] = $p_img->src;
2087
+		endforeach;
2088
+	endif;
2089 2089
 
2090
-    if (!empty($place_img_array))
2091
-        $curImages = implode(',', $place_img_array);
2090
+	if (!empty($place_img_array))
2091
+		$curImages = implode(',', $place_img_array);
2092 2092
 
2093 2093
 
2094
-    // adjust values here
2095
-    $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
2094
+	// adjust values here
2095
+	$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
2096 2096
 
2097
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2097
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2098 2098
 
2099
-    $multiple = true; // allow multiple files upload
2099
+	$multiple = true; // allow multiple files upload
2100 2100
 
2101
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2101
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2102 2102
 
2103
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2103
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2104 2104
 
2105
-    ?>
2105
+	?>
2106 2106
 
2107 2107
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
2108 2108
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -2144,13 +2144,13 @@  discard block
 block discarded – undo
2144 2144
  */
2145 2145
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
2146 2146
 {
2147
-    $post_type = get_post_type($post_ID);
2147
+	$post_type = get_post_type($post_ID);
2148 2148
 
2149
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2150
-        if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2151
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2152
-        }
2153
-    }
2149
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2150
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2151
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2152
+		}
2153
+	}
2154 2154
 }
2155 2155
 
2156 2156
 /**
@@ -2165,39 +2165,39 @@  discard block
 block discarded – undo
2165 2165
  */
2166 2166
 function geodir_notification_add_bcc_option($settings)
2167 2167
 {
2168
-    if (!empty($settings)) {
2169
-        $new_settings = array();
2170
-        foreach ($settings as $setting) {
2171
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2172
-                $geodir_bcc_listing_published_yes = array(
2173
-                    'name' => __('Listing published', 'geodirectory'),
2174
-                    'desc' => __('Yes', 'geodirectory'),
2175
-                    'id' => 'geodir_bcc_listing_published',
2176
-                    'std' => 'yes',
2177
-                    'type' => 'radio',
2178
-                    'value' => '1',
2179
-                    'radiogroup' => 'start'
2180
-                );
2181
-
2182
-                $geodir_bcc_listing_published_no = array(
2183
-                    'name' => __('Listing published', 'geodirectory'),
2184
-                    'desc' => __('No', 'geodirectory'),
2185
-                    'id' => 'geodir_bcc_listing_published',
2186
-                    'std' => 'yes',
2187
-                    'type' => 'radio',
2188
-                    'value' => '0',
2189
-                    'radiogroup' => 'end'
2190
-                );
2191
-
2192
-                $new_settings[] = $geodir_bcc_listing_published_yes;
2193
-                $new_settings[] = $geodir_bcc_listing_published_no;
2194
-            }
2195
-            $new_settings[] = $setting;
2196
-        }
2197
-        $settings = $new_settings;
2198
-    }
2168
+	if (!empty($settings)) {
2169
+		$new_settings = array();
2170
+		foreach ($settings as $setting) {
2171
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2172
+				$geodir_bcc_listing_published_yes = array(
2173
+					'name' => __('Listing published', 'geodirectory'),
2174
+					'desc' => __('Yes', 'geodirectory'),
2175
+					'id' => 'geodir_bcc_listing_published',
2176
+					'std' => 'yes',
2177
+					'type' => 'radio',
2178
+					'value' => '1',
2179
+					'radiogroup' => 'start'
2180
+				);
2181
+
2182
+				$geodir_bcc_listing_published_no = array(
2183
+					'name' => __('Listing published', 'geodirectory'),
2184
+					'desc' => __('No', 'geodirectory'),
2185
+					'id' => 'geodir_bcc_listing_published',
2186
+					'std' => 'yes',
2187
+					'type' => 'radio',
2188
+					'value' => '0',
2189
+					'radiogroup' => 'end'
2190
+				);
2191
+
2192
+				$new_settings[] = $geodir_bcc_listing_published_yes;
2193
+				$new_settings[] = $geodir_bcc_listing_published_no;
2194
+			}
2195
+			$new_settings[] = $setting;
2196
+		}
2197
+		$settings = $new_settings;
2198
+	}
2199 2199
 
2200
-    return $settings;
2200
+	return $settings;
2201 2201
 }
2202 2202
 
2203 2203
 
@@ -2212,19 +2212,19 @@  discard block
 block discarded – undo
2212 2212
  */
2213 2213
 function get_gd_theme_compat_callback()
2214 2214
 {
2215
-    global $wpdb;
2216
-    $themes = get_option('gd_theme_compats');
2217
-
2218
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2219
-        if (isset($_POST['export'])) {
2220
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2221
-        } else {
2222
-            echo json_encode($themes[$_POST['theme']]);
2223
-        }
2215
+	global $wpdb;
2216
+	$themes = get_option('gd_theme_compats');
2224 2217
 
2225
-    }
2218
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2219
+		if (isset($_POST['export'])) {
2220
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2221
+		} else {
2222
+			echo json_encode($themes[$_POST['theme']]);
2223
+		}
2224
+
2225
+	}
2226 2226
 
2227
-    die();
2227
+	die();
2228 2228
 }
2229 2229
 
2230 2230
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -2238,20 +2238,20 @@  discard block
 block discarded – undo
2238 2238
  */
2239 2239
 function get_gd_theme_compat_import_callback()
2240 2240
 {
2241
-    global $wpdb;
2242
-    $themes = get_option('gd_theme_compats');
2243
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2244
-        $json = json_decode(stripslashes($_POST['theme']), true);
2245
-        if (!empty($json) && is_array($json)) {
2246
-            $key = sanitize_text_field(key($json));
2247
-            $themes[$key] = $json[$key];
2248
-            update_option('gd_theme_compats', $themes);
2249
-            echo $key;
2250
-            die();
2251
-        }
2252
-    }
2253
-    echo '0';
2254
-    die();
2241
+	global $wpdb;
2242
+	$themes = get_option('gd_theme_compats');
2243
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2244
+		$json = json_decode(stripslashes($_POST['theme']), true);
2245
+		if (!empty($json) && is_array($json)) {
2246
+			$key = sanitize_text_field(key($json));
2247
+			$themes[$key] = $json[$key];
2248
+			update_option('gd_theme_compats', $themes);
2249
+			echo $key;
2250
+			die();
2251
+		}
2252
+	}
2253
+	echo '0';
2254
+	die();
2255 2255
 }
2256 2256
 
2257 2257
 
@@ -2264,39 +2264,39 @@  discard block
 block discarded – undo
2264 2264
  */
2265 2265
 function gd_set_theme_compat()
2266 2266
 {
2267
-    global $wpdb;
2268
-    $theme = wp_get_theme();
2267
+	global $wpdb;
2268
+	$theme = wp_get_theme();
2269 2269
 
2270
-    if ($theme->parent()) {
2271
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2272
-    } else {
2273
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
2274
-    }
2270
+	if ($theme->parent()) {
2271
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2272
+	} else {
2273
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
2274
+	}
2275 2275
 
2276
-    $theme_compats = get_option('gd_theme_compats');
2277
-    $current_compat = get_option('gd_theme_compat');
2278
-    $current_compat = str_replace("_custom", "", $current_compat);
2276
+	$theme_compats = get_option('gd_theme_compats');
2277
+	$current_compat = get_option('gd_theme_compat');
2278
+	$current_compat = str_replace("_custom", "", $current_compat);
2279 2279
 
2280
-    if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2281
-        return;
2282
-    }// if already running correct compat then bail
2280
+	if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2281
+		return;
2282
+	}// if already running correct compat then bail
2283 2283
 
2284
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2285
-        update_option('gd_theme_compat', $theme_name);
2286
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2284
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2285
+		update_option('gd_theme_compat', $theme_name);
2286
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2287 2287
 
2288
-        // if there are default options to set then set them
2289
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2288
+		// if there are default options to set then set them
2289
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2290 2290
 
2291
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2292
-                update_option($key, $val);
2293
-            }
2294
-        }
2291
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2292
+				update_option($key, $val);
2293
+			}
2294
+		}
2295 2295
 
2296
-    } else {
2297
-        update_option('gd_theme_compat', '');
2298
-        update_option('theme_compatibility_setting', '');
2299
-    }
2296
+	} else {
2297
+		update_option('gd_theme_compat', '');
2298
+		update_option('theme_compatibility_setting', '');
2299
+	}
2300 2300
 
2301 2301
 
2302 2302
 }
@@ -2311,9 +2311,9 @@  discard block
 block discarded – undo
2311 2311
  */
2312 2312
 function gd_check_avada_compat()
2313 2313
 {
2314
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2315
-        add_action('admin_notices', 'gd_avada_compat_warning');
2316
-    }
2314
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2315
+		add_action('admin_notices', 'gd_avada_compat_warning');
2316
+	}
2317 2317
 }
2318 2318
 
2319 2319
 
@@ -2326,22 +2326,22 @@  discard block
 block discarded – undo
2326 2326
 function gd_avada_compat_warning()
2327 2327
 {
2328 2328
 
2329
-    /*
2329
+	/*
2330 2330
     $msg_type = error
2331 2331
     $msg_type = updated fade
2332 2332
     $msg_type = update-nag
2333 2333
     */
2334 2334
 
2335
-    $plugin = 'avada-nag';
2336
-    $timestamp = 'avada-nag1234';
2337
-    $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2338
-    echo '<div id="' . $timestamp . '"  class="error">';
2339
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2340
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2341
-    echo "<p>$message</p>";
2342
-    echo "</div>";
2335
+	$plugin = 'avada-nag';
2336
+	$timestamp = 'avada-nag1234';
2337
+	$message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2338
+	echo '<div id="' . $timestamp . '"  class="error">';
2339
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2340
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2341
+	echo "<p>$message</p>";
2342
+	echo "</div>";
2343 2343
 
2344
-    ?>
2344
+	?>
2345 2345
     <script>
2346 2346
         function gdRemoveANotification($plugin, $timestamp) {
2347 2347
 
@@ -2409,10 +2409,10 @@  discard block
 block discarded – undo
2409 2409
  */
2410 2410
 function geodir_avada_remove_notification()
2411 2411
 {
2412
-    update_option('avada_nag', TRUE);
2412
+	update_option('avada_nag', TRUE);
2413 2413
 
2414
-    // Always die in functions echoing ajax content
2415
-    die();
2414
+	// Always die in functions echoing ajax content
2415
+	die();
2416 2416
 }
2417 2417
 
2418 2418
 
@@ -2434,9 +2434,9 @@  discard block
 block discarded – undo
2434 2434
 	global $post, $typenow, $current_screen;
2435 2435
 	
2436 2436
 	$post_type = NULL;
2437
-    if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2437
+	if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2438 2438
 		$post_type = get_post_type($_REQUEST['post']);
2439
-    elseif ($post && isset($post->post_type))
2439
+	elseif ($post && isset($post->post_type))
2440 2440
 		$post_type = $post->post_type;
2441 2441
 	elseif ($typenow)
2442 2442
 		$post_type = $typenow;
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 		// Don't allow same slug url for listing and location
2472 2472
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2473 2473
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2474
-        	wp_redirect($redirect_url);
2474
+			wp_redirect($redirect_url);
2475 2475
 			exit;
2476 2476
 		}
2477 2477
 		
@@ -2501,10 +2501,10 @@  discard block
 block discarded – undo
2501 2501
  * @package GeoDirectory
2502 2502
  */
2503 2503
 function geodir_hide_admin_preview_button() {
2504
-    global $post_type;
2505
-    $post_types = geodir_get_posttypes();
2506
-    if(in_array($post_type, $post_types))
2507
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2504
+	global $post_type;
2505
+	$post_types = geodir_get_posttypes();
2506
+	if(in_array($post_type, $post_types))
2507
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2508 2508
 }
2509 2509
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2510 2510
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2519,7 +2519,7 @@  discard block
 block discarded – undo
2519 2519
  */
2520 2520
 function geodir_import_export_tab( $tabs ) {
2521 2521
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2522
-    return $tabs;
2522
+	return $tabs;
2523 2523
 }
2524 2524
 
2525 2525
 /**
@@ -2534,26 +2534,26 @@  discard block
 block discarded – undo
2534 2534
 function geodir_import_export_page() {
2535 2535
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2536 2536
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2537
-    /**
2538
-     * Filter sample category data csv file url.
2539
-     *
2540
-     * @since 1.0.0
2541
-     * @package GeoDirectory
2542
-     *
2543
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2544
-     */
2537
+	/**
2538
+	 * Filter sample category data csv file url.
2539
+	 *
2540
+	 * @since 1.0.0
2541
+	 * @package GeoDirectory
2542
+	 *
2543
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2544
+	 */
2545 2545
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2546 2546
 	
2547 2547
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2548
-    /**
2549
-     * Filter sample post data csv file url.
2550
-     *
2551
-     * @since 1.0.0
2552
-     * @package GeoDirectory
2553
-     *
2554
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2555
-     */
2556
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2548
+	/**
2549
+	 * Filter sample post data csv file url.
2550
+	 *
2551
+	 * @since 1.0.0
2552
+	 * @package GeoDirectory
2553
+	 *
2554
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2555
+	 */
2556
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2557 2557
 	
2558 2558
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2559 2559
 	
@@ -2576,14 +2576,14 @@  discard block
 block discarded – undo
2576 2576
 	$gd_chunksize_options[100000] = 100000;
2577 2577
 	 
2578 2578
 	 /**
2579
-     * Filter max entries per export csv file.
2580
-     *
2581
-     * @since 1.5.6
2582
-     * @package GeoDirectory
2583
-     *
2584
-     * @param string $gd_chunksize_options Entries options.
2585
-     */
2586
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2579
+	  * Filter max entries per export csv file.
2580
+	  *
2581
+	  * @since 1.5.6
2582
+	  * @package GeoDirectory
2583
+	  *
2584
+	  * @param string $gd_chunksize_options Entries options.
2585
+	  */
2586
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2587 2587
 	
2588 2588
 	$gd_chunksize_option = '';
2589 2589
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2599,12 +2599,12 @@  discard block
 block discarded – undo
2599 2599
   <div class="gd-content-heading">
2600 2600
 
2601 2601
   <?php
2602
-    ini_set('max_execution_time', 999999);
2603
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2604
-    ini_restore('max_execution_time');
2602
+	ini_set('max_execution_time', 999999);
2603
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2604
+	ini_restore('max_execution_time');
2605 2605
 
2606
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2607
-        ?>
2606
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2607
+		?>
2608 2608
 	<div id="gd_ie_reqs" class="metabox-holder">
2609 2609
       <div class="meta-box-sortables ui-sortable">
2610 2610
         <div class="postbox">
@@ -2773,7 +2773,7 @@  discard block
 block discarded – undo
2773 2773
 						 * Called just after the sample CSV download link.
2774 2774
 						 *
2775 2775
 						 * @since 1.0.0
2776
-                         * @package GeoDirectory
2776
+						 * @package GeoDirectory
2777 2777
 						 */
2778 2778
 						do_action('geodir_sample_cats_csv_download_link');
2779 2779
 						?>
@@ -2858,11 +2858,11 @@  discard block
 block discarded – undo
2858 2858
 	 *
2859 2859
 	 * Called after the last setting on the GD > Import & Export page.
2860 2860
 	 * @since 1.4.6
2861
-     * @package GeoDirectory
2861
+	 * @package GeoDirectory
2862 2862
 	 *
2863 2863
 	 * @param array $gd_posttypes GD post types.
2864
-     * @param array $gd_chunksize_options File chunk size options.
2865
-     * @param string $nonce Wordpress security token for GD import & export.
2864
+	 * @param array $gd_chunksize_options File chunk size options.
2865
+	 * @param string $nonce Wordpress security token for GD import & export.
2866 2866
 	 */
2867 2867
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2868 2868
 	?>
@@ -3519,44 +3519,44 @@  discard block
 block discarded – undo
3519 3519
 function geodir_init_filesystem()
3520 3520
 {
3521 3521
 
3522
-    if(!function_exists('get_filesystem_method')){
3523
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3524
-    }
3525
-    $access_type = get_filesystem_method();
3526
-    if ($access_type === 'direct') {
3527
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3528
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3529
-
3530
-        /* initialize the API */
3531
-        if (!WP_Filesystem($creds)) {
3532
-            /* any problems and we exit */
3533
-            //return '@@@3';
3534
-            return false;
3535
-        }
3536
-
3537
-        global $wp_filesystem;
3538
-        return $wp_filesystem;
3539
-        /* do our file manipulations below */
3540
-    } elseif (defined('FTP_USER')) {
3541
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3522
+	if(!function_exists('get_filesystem_method')){
3523
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3524
+	}
3525
+	$access_type = get_filesystem_method();
3526
+	if ($access_type === 'direct') {
3527
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3528
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3529
+
3530
+		/* initialize the API */
3531
+		if (!WP_Filesystem($creds)) {
3532
+			/* any problems and we exit */
3533
+			//return '@@@3';
3534
+			return false;
3535
+		}
3542 3536
 
3543
-        /* initialize the API */
3544
-        if (!WP_Filesystem($creds)) {
3545
-            /* any problems and we exit */
3546
-            //return '@@@33';
3547
-            return false;
3548
-        }
3537
+		global $wp_filesystem;
3538
+		return $wp_filesystem;
3539
+		/* do our file manipulations below */
3540
+	} elseif (defined('FTP_USER')) {
3541
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3542
+
3543
+		/* initialize the API */
3544
+		if (!WP_Filesystem($creds)) {
3545
+			/* any problems and we exit */
3546
+			//return '@@@33';
3547
+			return false;
3548
+		}
3549 3549
 
3550
-        global $wp_filesystem;
3551
-        //return '@@@1';
3552
-        return $wp_filesystem;
3550
+		global $wp_filesystem;
3551
+		//return '@@@1';
3552
+		return $wp_filesystem;
3553 3553
 
3554
-    } else {
3555
-        //return '@@@2';
3556
-        /* don't have direct write access. Prompt user with our notice */
3557
-        add_action('admin_notice', 'geodir_filesystem_notice');
3558
-        return false;
3559
-    }
3554
+	} else {
3555
+		//return '@@@2';
3556
+		/* don't have direct write access. Prompt user with our notice */
3557
+		add_action('admin_notice', 'geodir_filesystem_notice');
3558
+		return false;
3559
+	}
3560 3560
 
3561 3561
 }
3562 3562
 
@@ -3574,10 +3574,10 @@  discard block
 block discarded – undo
3574 3574
  */
3575 3575
 function geodir_filesystem_notice()
3576 3576
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3577
-    $access_type = get_filesystem_method();
3578
-    if ($access_type === 'direct') {
3579
-    } elseif (!defined('FTP_USER')) {
3580
-        ?>
3577
+	$access_type = get_filesystem_method();
3578
+	if ($access_type === 'direct') {
3579
+	} elseif (!defined('FTP_USER')) {
3580
+		?>
3581 3581
         <div class="error">
3582 3582
             <p><?php _e('GeoDirectory does not have access to your filesystem, thing like import/export will not work. Please define your details in wp-config.php as explained here', 'geodirectory'); ?>
3583 3583
                 <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants</a>
@@ -3603,1514 +3603,1514 @@  discard block
 block discarded – undo
3603 3603
  * @return string Json data.
3604 3604
  */
3605 3605
 function geodir_ajax_import_export() {
3606
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3606
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3607 3607
     
3608
-    error_reporting(0);
3608
+	error_reporting(0);
3609 3609
 
3610
-    // try to set higher limits for import
3611
-    $max_input_time = ini_get('max_input_time');
3612
-    $max_execution_time = ini_get('max_execution_time');
3613
-    $memory_limit= ini_get('memory_limit');
3610
+	// try to set higher limits for import
3611
+	$max_input_time = ini_get('max_input_time');
3612
+	$max_execution_time = ini_get('max_execution_time');
3613
+	$memory_limit= ini_get('memory_limit');
3614 3614
 
3615
-    if(!$max_input_time || $max_input_time<3000){
3616
-        ini_set('max_input_time', 3000);
3617
-    }
3615
+	if(!$max_input_time || $max_input_time<3000){
3616
+		ini_set('max_input_time', 3000);
3617
+	}
3618 3618
 
3619
-    if(!$max_execution_time || $max_execution_time<3000){
3620
-        ini_set('max_execution_time', 3000);
3621
-    }
3619
+	if(!$max_execution_time || $max_execution_time<3000){
3620
+		ini_set('max_execution_time', 3000);
3621
+	}
3622 3622
 
3623
-    if($memory_limit && str_replace('M','',$memory_limit)){
3624
-        if(str_replace('M','',$memory_limit)<256){
3625
-            ini_set('memory_limit', '256M');
3626
-        }
3627
-    }
3623
+	if($memory_limit && str_replace('M','',$memory_limit)){
3624
+		if(str_replace('M','',$memory_limit)<256){
3625
+			ini_set('memory_limit', '256M');
3626
+		}
3627
+	}
3628 3628
 
3629
-    $json = array();
3629
+	$json = array();
3630 3630
 
3631
-    if ( !current_user_can( 'manage_options' ) ) {
3632
-        wp_send_json( $json );
3633
-    }
3631
+	if ( !current_user_can( 'manage_options' ) ) {
3632
+		wp_send_json( $json );
3633
+	}
3634 3634
 
3635
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3636
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3637
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3635
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3636
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3637
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3638 3638
 
3639
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3640
-        wp_send_json( $json );
3641
-    }
3639
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3640
+		wp_send_json( $json );
3641
+	}
3642 3642
 
3643
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3644
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3645
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3646
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3643
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3644
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3645
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3646
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3647 3647
 
3648
-    $wp_filesystem = geodir_init_filesystem();
3649
-    if (!$wp_filesystem) {
3650
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3651
-        wp_send_json( $json );
3652
-    }
3648
+	$wp_filesystem = geodir_init_filesystem();
3649
+	if (!$wp_filesystem) {
3650
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3651
+		wp_send_json( $json );
3652
+	}
3653 3653
 
3654
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3655
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3656
-        wp_send_json( $json );
3657
-    }
3654
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3655
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3656
+		wp_send_json( $json );
3657
+	}
3658 3658
 
3659
-    $csv_file_dir = geodir_path_import_export( false );
3660
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3661
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3662
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3663
-            wp_send_json( $json );
3664
-        }
3665
-    }
3659
+	$csv_file_dir = geodir_path_import_export( false );
3660
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3661
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3662
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3663
+			wp_send_json( $json );
3664
+		}
3665
+	}
3666 3666
     
3667
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3668
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3669
-
3670
-    switch ( $task ) {
3671
-        case 'export_posts': {
3672
-            // WPML
3673
-            $is_wpml = geodir_is_wpml();
3674
-            if ($is_wpml) {
3675
-                global $sitepress;
3676
-                $active_lang = ICL_LANGUAGE_CODE;
3667
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3668
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3669
+
3670
+	switch ( $task ) {
3671
+		case 'export_posts': {
3672
+			// WPML
3673
+			$is_wpml = geodir_is_wpml();
3674
+			if ($is_wpml) {
3675
+				global $sitepress;
3676
+				$active_lang = ICL_LANGUAGE_CODE;
3677 3677
                 
3678
-                $sitepress->switch_lang('all', true);
3679
-            }
3680
-            // WPML
3681
-            if ( $post_type == 'gd_event' ) {
3682
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3683
-            }
3684
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3685
-            $posts_count = geodir_get_posts_count( $post_type );
3686
-            $file_url_base = geodir_path_import_export() . '/';
3687
-            $file_url = $file_url_base . $file_name . '.csv';
3688
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3689
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3678
+				$sitepress->switch_lang('all', true);
3679
+			}
3680
+			// WPML
3681
+			if ( $post_type == 'gd_event' ) {
3682
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3683
+			}
3684
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3685
+			$posts_count = geodir_get_posts_count( $post_type );
3686
+			$file_url_base = geodir_path_import_export() . '/';
3687
+			$file_url = $file_url_base . $file_name . '.csv';
3688
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3689
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3690 3690
             
3691
-            $chunk_file_paths = array();
3691
+			$chunk_file_paths = array();
3692 3692
 
3693
-            if ( isset( $_REQUEST['_st'] ) ) {
3694
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3695
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3696
-                $percentage = min( $percentage, 100 );
3693
+			if ( isset( $_REQUEST['_st'] ) ) {
3694
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3695
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3696
+				$percentage = min( $percentage, 100 );
3697 3697
                 
3698
-                $json['percentage'] = $percentage;
3699
-                // WPML
3700
-                if ($is_wpml) {
3701
-                    $sitepress->switch_lang($active_lang, true);
3702
-                }
3703
-                // WPML
3704
-                wp_send_json( $json );
3705
-                gd_die();
3706
-            } else {
3707
-                if ( !$posts_count > 0 ) {
3708
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3709
-                } else {
3710
-                    $total_posts = $posts_count;
3711
-                    if ($chunk_per_page > $total_posts) {
3712
-                        $chunk_per_page = $total_posts;
3713
-                    }
3714
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3698
+				$json['percentage'] = $percentage;
3699
+				// WPML
3700
+				if ($is_wpml) {
3701
+					$sitepress->switch_lang($active_lang, true);
3702
+				}
3703
+				// WPML
3704
+				wp_send_json( $json );
3705
+				gd_die();
3706
+			} else {
3707
+				if ( !$posts_count > 0 ) {
3708
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3709
+				} else {
3710
+					$total_posts = $posts_count;
3711
+					if ($chunk_per_page > $total_posts) {
3712
+						$chunk_per_page = $total_posts;
3713
+					}
3714
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3715 3715
                     
3716
-                    $j = $chunk_page_no;
3717
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3716
+					$j = $chunk_page_no;
3717
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3718 3718
                     
3719
-                    $per_page = 500;
3720
-                    if ($per_page > $chunk_per_page) {
3721
-                        $per_page = $chunk_per_page;
3722
-                    }
3723
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3719
+					$per_page = 500;
3720
+					if ($per_page > $chunk_per_page) {
3721
+						$per_page = $chunk_per_page;
3722
+					}
3723
+					$total_pages = ceil( $chunk_per_page / $per_page );
3724 3724
                     
3725
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3726
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3725
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3726
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3727 3727
                         
3728
-                        $clear = $i == 0 ? true : false;
3729
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3730
-                    }
3728
+						$clear = $i == 0 ? true : false;
3729
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3730
+					}
3731 3731
                         
3732
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3733
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3734
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3735
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3736
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3732
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3733
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3734
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3735
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3736
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3737 3737
                         
3738
-                        $file_url = $file_url_base . $chunk_file_name;
3739
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3740
-                    }
3738
+						$file_url = $file_url_base . $chunk_file_name;
3739
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3740
+					}
3741 3741
                     
3742
-                    if ( !empty($chunk_file_paths) ) {
3743
-                        $json['total'] = $posts_count;
3744
-                        $json['files'] = $chunk_file_paths;
3745
-                    } else {
3746
-                        if ($j > 1) {
3747
-                            $json['total'] = $posts_count;
3748
-                            $json['files'] = array();
3749
-                        } else {
3750
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3751
-                        }
3752
-                    }
3753
-                }
3754
-                // WPML
3755
-                if ($is_wpml) {
3756
-                    $sitepress->switch_lang($active_lang, true);
3757
-                }
3758
-                // WPML
3759
-                wp_send_json( $json );
3760
-            }
3761
-        }
3762
-        break;
3763
-        case 'export_cats': {
3764
-            // WPML
3765
-            $is_wpml = geodir_is_wpml();
3766
-            if ($is_wpml) {
3767
-                global $sitepress;
3768
-                $active_lang = ICL_LANGUAGE_CODE;
3742
+					if ( !empty($chunk_file_paths) ) {
3743
+						$json['total'] = $posts_count;
3744
+						$json['files'] = $chunk_file_paths;
3745
+					} else {
3746
+						if ($j > 1) {
3747
+							$json['total'] = $posts_count;
3748
+							$json['files'] = array();
3749
+						} else {
3750
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3751
+						}
3752
+					}
3753
+				}
3754
+				// WPML
3755
+				if ($is_wpml) {
3756
+					$sitepress->switch_lang($active_lang, true);
3757
+				}
3758
+				// WPML
3759
+				wp_send_json( $json );
3760
+			}
3761
+		}
3762
+		break;
3763
+		case 'export_cats': {
3764
+			// WPML
3765
+			$is_wpml = geodir_is_wpml();
3766
+			if ($is_wpml) {
3767
+				global $sitepress;
3768
+				$active_lang = ICL_LANGUAGE_CODE;
3769 3769
                 
3770
-                $sitepress->switch_lang('all', true);
3771
-            }
3772
-            // WPML
3773
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3770
+				$sitepress->switch_lang('all', true);
3771
+			}
3772
+			// WPML
3773
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3774 3774
             
3775
-            $terms_count = geodir_get_terms_count( $post_type );
3776
-            $file_url_base = geodir_path_import_export() . '/';
3777
-            $file_url = $file_url_base . $file_name . '.csv';
3778
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3779
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3775
+			$terms_count = geodir_get_terms_count( $post_type );
3776
+			$file_url_base = geodir_path_import_export() . '/';
3777
+			$file_url = $file_url_base . $file_name . '.csv';
3778
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3779
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3780 3780
             
3781
-            $chunk_file_paths = array();
3781
+			$chunk_file_paths = array();
3782 3782
             
3783
-            if ( isset( $_REQUEST['_st'] ) ) {
3784
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3785
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3786
-                $percentage = min( $percentage, 100 );
3783
+			if ( isset( $_REQUEST['_st'] ) ) {
3784
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3785
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3786
+				$percentage = min( $percentage, 100 );
3787 3787
                 
3788
-                $json['percentage'] = $percentage;
3789
-                // WPML
3790
-                if ($is_wpml) {
3791
-                    $sitepress->switch_lang($active_lang, true);
3792
-                }
3793
-                // WPML
3794
-                wp_send_json( $json );
3795
-            } else {
3796
-                if ( !$terms_count > 0 ) {
3797
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3798
-                } else {
3799
-                    $total_terms = $terms_count;
3800
-                    if ($chunk_per_page > $terms_count) {
3801
-                        $chunk_per_page = $terms_count;
3802
-                    }
3803
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3788
+				$json['percentage'] = $percentage;
3789
+				// WPML
3790
+				if ($is_wpml) {
3791
+					$sitepress->switch_lang($active_lang, true);
3792
+				}
3793
+				// WPML
3794
+				wp_send_json( $json );
3795
+			} else {
3796
+				if ( !$terms_count > 0 ) {
3797
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3798
+				} else {
3799
+					$total_terms = $terms_count;
3800
+					if ($chunk_per_page > $terms_count) {
3801
+						$chunk_per_page = $terms_count;
3802
+					}
3803
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3804 3804
                     
3805
-                    $j = $chunk_page_no;
3806
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3805
+					$j = $chunk_page_no;
3806
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3807 3807
                     
3808
-                    $per_page = 500;
3809
-                    if ($per_page > $chunk_per_page) {
3810
-                        $per_page = $chunk_per_page;
3811
-                    }
3812
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3808
+					$per_page = 500;
3809
+					if ($per_page > $chunk_per_page) {
3810
+						$per_page = $chunk_per_page;
3811
+					}
3812
+					$total_pages = ceil( $chunk_per_page / $per_page );
3813 3813
                     
3814
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3815
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3814
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3815
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3816 3816
                         
3817
-                        $clear = $i == 0 ? true : false;
3818
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3819
-                    }
3817
+						$clear = $i == 0 ? true : false;
3818
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3819
+					}
3820 3820
                     
3821
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3822
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3823
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3824
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3825
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3821
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3822
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3823
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3824
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3825
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3826 3826
                         
3827
-                        $file_url = $file_url_base . $chunk_file_name;
3828
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3829
-                    }
3827
+						$file_url = $file_url_base . $chunk_file_name;
3828
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3829
+					}
3830 3830
                     
3831
-                    if ( !empty($chunk_file_paths) ) {
3832
-                        $json['total'] = $terms_count;
3833
-                        $json['files'] = $chunk_file_paths;
3834
-                    } else {
3835
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3836
-                    }
3837
-                }
3838
-                // WPML
3839
-                if ($is_wpml) {
3840
-                    $sitepress->switch_lang($active_lang, true);
3841
-                }
3842
-                // WPML
3843
-                wp_send_json( $json );
3844
-            }
3845
-        }
3846
-        break;
3847
-        case 'export_locations': {
3848
-            $file_url_base = geodir_path_import_export() . '/';
3849
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3850
-            $file_url = $file_url_base . $file_name . '.csv';
3851
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3852
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3831
+					if ( !empty($chunk_file_paths) ) {
3832
+						$json['total'] = $terms_count;
3833
+						$json['files'] = $chunk_file_paths;
3834
+					} else {
3835
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3836
+					}
3837
+				}
3838
+				// WPML
3839
+				if ($is_wpml) {
3840
+					$sitepress->switch_lang($active_lang, true);
3841
+				}
3842
+				// WPML
3843
+				wp_send_json( $json );
3844
+			}
3845
+		}
3846
+		break;
3847
+		case 'export_locations': {
3848
+			$file_url_base = geodir_path_import_export() . '/';
3849
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3850
+			$file_url = $file_url_base . $file_name . '.csv';
3851
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3852
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3853 3853
             
3854
-            $items_count = (int)geodir_location_imex_count_locations();
3854
+			$items_count = (int)geodir_location_imex_count_locations();
3855 3855
             
3856
-            if ( isset( $_REQUEST['_st'] ) ) {
3857
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3858
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3859
-                $percentage = min( $percentage, 100 );
3856
+			if ( isset( $_REQUEST['_st'] ) ) {
3857
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3858
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3859
+				$percentage = min( $percentage, 100 );
3860 3860
                 
3861
-                $json['percentage'] = $percentage;
3862
-                wp_send_json( $json );
3863
-            } else {
3864
-                $chunk_file_paths = array();
3861
+				$json['percentage'] = $percentage;
3862
+				wp_send_json( $json );
3863
+			} else {
3864
+				$chunk_file_paths = array();
3865 3865
                 
3866
-                if ( !$items_count > 0 ) {
3867
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3868
-                } else {
3869
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3870
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3866
+				if ( !$items_count > 0 ) {
3867
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3868
+				} else {
3869
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3870
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3871 3871
                     
3872
-                    $j = $chunk_page_no;
3873
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3872
+					$j = $chunk_page_no;
3873
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3874 3874
                     
3875
-                    $per_page = 500;
3876
-                    $per_page = min( $per_page, $chunk_per_page );
3877
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3875
+					$per_page = 500;
3876
+					$per_page = min( $per_page, $chunk_per_page );
3877
+					$total_pages = ceil( $chunk_per_page / $per_page );
3878 3878
                     
3879
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3880
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3879
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3880
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3881 3881
                         
3882
-                        $clear = $i == 0 ? true : false;
3883
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3884
-                    }
3882
+						$clear = $i == 0 ? true : false;
3883
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3884
+					}
3885 3885
                     
3886
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3887
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3888
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3889
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3890
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3886
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3887
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3888
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3889
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3890
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3891 3891
                         
3892
-                        $file_url = $file_url_base . $chunk_file_name;
3893
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3894
-                    }
3892
+						$file_url = $file_url_base . $chunk_file_name;
3893
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3894
+					}
3895 3895
                     
3896
-                    if ( !empty($chunk_file_paths) ) {
3897
-                        $json['total'] = $items_count;
3898
-                        $json['files'] = $chunk_file_paths;
3899
-                    } else {
3900
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3901
-                    }
3902
-                }
3903
-                wp_send_json( $json );
3904
-            }
3905
-        }
3906
-        break;
3907
-        case 'export_hoods': {
3908
-            $file_url_base = geodir_path_import_export() . '/';
3909
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3910
-            $file_url = $file_url_base . $file_name . '.csv';
3911
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3912
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3896
+					if ( !empty($chunk_file_paths) ) {
3897
+						$json['total'] = $items_count;
3898
+						$json['files'] = $chunk_file_paths;
3899
+					} else {
3900
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3901
+					}
3902
+				}
3903
+				wp_send_json( $json );
3904
+			}
3905
+		}
3906
+		break;
3907
+		case 'export_hoods': {
3908
+			$file_url_base = geodir_path_import_export() . '/';
3909
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3910
+			$file_url = $file_url_base . $file_name . '.csv';
3911
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3912
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3913 3913
             
3914
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3914
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3915 3915
             
3916
-            if ( isset( $_REQUEST['_st'] ) ) {
3917
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3918
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3919
-                $percentage = min( $percentage, 100 );
3916
+			if ( isset( $_REQUEST['_st'] ) ) {
3917
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3918
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3919
+				$percentage = min( $percentage, 100 );
3920 3920
                 
3921
-                $json['percentage'] = $percentage;
3922
-                wp_send_json( $json );
3923
-            } else {
3924
-                $chunk_file_paths = array();
3921
+				$json['percentage'] = $percentage;
3922
+				wp_send_json( $json );
3923
+			} else {
3924
+				$chunk_file_paths = array();
3925 3925
                 
3926
-                if ( !$items_count > 0 ) {
3927
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3928
-                } else {
3929
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3930
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3926
+				if ( !$items_count > 0 ) {
3927
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3928
+				} else {
3929
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3930
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3931 3931
                     
3932
-                    $j = $chunk_page_no;
3933
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3932
+					$j = $chunk_page_no;
3933
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3934 3934
                     
3935
-                    $per_page = 500;
3936
-                    $per_page = min( $per_page, $chunk_per_page );
3937
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3935
+					$per_page = 500;
3936
+					$per_page = min( $per_page, $chunk_per_page );
3937
+					$total_pages = ceil( $chunk_per_page / $per_page );
3938 3938
                     
3939
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3940
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3939
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3940
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3941 3941
                         
3942
-                        $clear = $i == 0 ? true : false;
3943
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3944
-                    }
3942
+						$clear = $i == 0 ? true : false;
3943
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3944
+					}
3945 3945
                     
3946
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3947
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3948
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3949
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3950
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3946
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3947
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3948
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3949
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3950
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3951 3951
                         
3952
-                        $file_url = $file_url_base . $chunk_file_name;
3953
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3954
-                    }
3952
+						$file_url = $file_url_base . $chunk_file_name;
3953
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3954
+					}
3955 3955
                     
3956
-                    if ( !empty($chunk_file_paths) ) {
3957
-                        $json['total'] = $items_count;
3958
-                        $json['files'] = $chunk_file_paths;
3959
-                    } else {
3960
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3961
-                    }
3962
-                }
3963
-                wp_send_json( $json );
3964
-            }
3965
-        }
3966
-        break;
3967
-        case 'prepare_import':
3968
-        case 'import_cat':
3969
-        case 'import_post':
3970
-        case 'import_loc':
3971
-        case 'import_hood': {
3972
-            // WPML
3973
-            $is_wpml = geodir_is_wpml();
3974
-            if ($is_wpml) {
3975
-                global $sitepress;
3976
-                $active_lang = ICL_LANGUAGE_CODE;
3977
-            }
3978
-            // WPML
3956
+					if ( !empty($chunk_file_paths) ) {
3957
+						$json['total'] = $items_count;
3958
+						$json['files'] = $chunk_file_paths;
3959
+					} else {
3960
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3961
+					}
3962
+				}
3963
+				wp_send_json( $json );
3964
+			}
3965
+		}
3966
+		break;
3967
+		case 'prepare_import':
3968
+		case 'import_cat':
3969
+		case 'import_post':
3970
+		case 'import_loc':
3971
+		case 'import_hood': {
3972
+			// WPML
3973
+			$is_wpml = geodir_is_wpml();
3974
+			if ($is_wpml) {
3975
+				global $sitepress;
3976
+				$active_lang = ICL_LANGUAGE_CODE;
3977
+			}
3978
+			// WPML
3979 3979
             
3980
-            ini_set( 'auto_detect_line_endings', true );
3980
+			ini_set( 'auto_detect_line_endings', true );
3981 3981
             
3982
-            $uploads = wp_upload_dir();
3983
-            $uploads_dir = $uploads['path'];
3984
-            $uploads_subdir = $uploads['subdir'];
3982
+			$uploads = wp_upload_dir();
3983
+			$uploads_dir = $uploads['path'];
3984
+			$uploads_subdir = $uploads['subdir'];
3985 3985
             
3986
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3987
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3986
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3987
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3988 3988
             
3989
-            $csv_file_arr = explode( '/', $csv_file );
3990
-            $csv_filename = end( $csv_file_arr );
3991
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3989
+			$csv_file_arr = explode( '/', $csv_file );
3990
+			$csv_filename = end( $csv_file_arr );
3991
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3992 3992
             
3993
-            $json['file'] = $csv_file;
3994
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3995
-            $file = array();
3993
+			$json['file'] = $csv_file;
3994
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3995
+			$file = array();
3996 3996
 
3997
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3998
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3997
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3998
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3999 3999
                 
4000
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4001
-                    $json['error'] = NULL;
4002
-                    $json['rows'] = 0;
4000
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4001
+					$json['error'] = NULL;
4002
+					$json['rows'] = 0;
4003 4003
                     
4004
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4005
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4006
-                            if ( !empty( $data ) ) {
4007
-                                $file[] = $data;
4008
-                            }
4009
-                        }
4010
-                        fclose($handle);
4011
-                    }
4004
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4005
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4006
+							if ( !empty( $data ) ) {
4007
+								$file[] = $data;
4008
+							}
4009
+						}
4010
+						fclose($handle);
4011
+					}
4012 4012
 
4013
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4013
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4014 4014
                     
4015
-                    if (!$json['rows'] > 0) {
4016
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
4017
-                    }
4018
-                } else {
4019
-                    wp_send_json( $json );
4020
-                }
4021
-            } else {
4022
-                wp_send_json( $json );
4023
-            }
4015
+					if (!$json['rows'] > 0) {
4016
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
4017
+					}
4018
+				} else {
4019
+					wp_send_json( $json );
4020
+				}
4021
+			} else {
4022
+				wp_send_json( $json );
4023
+			}
4024 4024
             
4025
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4026
-                wp_send_json( $json );
4027
-            }
4025
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4026
+				wp_send_json( $json );
4027
+			}
4028 4028
             
4029
-            $total = $json['rows'];
4030
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4031
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4029
+			$total = $json['rows'];
4030
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4031
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4032 4032
             
4033
-            $count = $limit;
4033
+			$count = $limit;
4034 4034
             
4035
-            if ($count < $total) {
4036
-                $count = $processed + $count;
4037
-                if ($count > $total) {
4038
-                    $count = $total;
4039
-                }
4040
-            } else {
4041
-                $count = $total;
4042
-            }
4035
+			if ($count < $total) {
4036
+				$count = $processed + $count;
4037
+				if ($count > $total) {
4038
+					$count = $total;
4039
+				}
4040
+			} else {
4041
+				$count = $total;
4042
+			}
4043 4043
             
4044
-            $created = 0;
4045
-            $updated = 0;
4046
-            $skipped = 0;
4047
-            $invalid = 0;
4048
-            $invalid_addr = 0;
4049
-            $images = 0;
4044
+			$created = 0;
4045
+			$updated = 0;
4046
+			$skipped = 0;
4047
+			$invalid = 0;
4048
+			$invalid_addr = 0;
4049
+			$images = 0;
4050 4050
             
4051
-            $gd_post_info = array();
4052
-            $countpost = 0;
4051
+			$gd_post_info = array();
4052
+			$countpost = 0;
4053 4053
             
4054
-            $post_types = geodir_get_posttypes();
4054
+			$post_types = geodir_get_posttypes();
4055 4055
 
4056
-            if ( $task == 'import_cat' ) {
4057
-                if (!empty($file)) {
4058
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4056
+			if ( $task == 'import_cat' ) {
4057
+				if (!empty($file)) {
4058
+					$columns = isset($file[0]) ? $file[0] : NULL;
4059 4059
                     
4060
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4061
-                        $json['error'] = CSV_INVAILD_FILE;
4062
-                        wp_send_json( $json );
4063
-                        exit;
4064
-                    }
4060
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4061
+						$json['error'] = CSV_INVAILD_FILE;
4062
+						wp_send_json( $json );
4063
+						exit;
4064
+					}
4065 4065
                     
4066
-                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4066
+					$gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4067 4067
                     
4068
-                    for ($i = 1; $i <= $limit; $i++) {
4069
-                        $index = $processed + $i;
4068
+					for ($i = 1; $i <= $limit; $i++) {
4069
+						$index = $processed + $i;
4070 4070
                         
4071
-                        if (isset($file[$index])) {
4072
-                            $row = $file[$index];
4073
-                            $row = array_map( 'trim', $row );
4074
-                            //$row = array_map( 'utf8_encode', $row );
4071
+						if (isset($file[$index])) {
4072
+							$row = $file[$index];
4073
+							$row = array_map( 'trim', $row );
4074
+							//$row = array_map( 'utf8_encode', $row );
4075 4075
                             
4076
-                            $cat_id = '';
4077
-                            $cat_name = '';
4078
-                            $cat_slug = '';
4079
-                            $cat_posttype = '';
4080
-                            $cat_parent = '';
4081
-                            $cat_description = '';
4082
-                            $cat_schema = '';
4083
-                            $cat_top_description = '';
4084
-                            $cat_image = '';
4085
-                            $cat_icon = '';
4086
-                            $cat_language = '';
4087
-                            $cat_id_original = '';
4076
+							$cat_id = '';
4077
+							$cat_name = '';
4078
+							$cat_slug = '';
4079
+							$cat_posttype = '';
4080
+							$cat_parent = '';
4081
+							$cat_description = '';
4082
+							$cat_schema = '';
4083
+							$cat_top_description = '';
4084
+							$cat_image = '';
4085
+							$cat_icon = '';
4086
+							$cat_language = '';
4087
+							$cat_id_original = '';
4088 4088
                             
4089
-                            $c = 0;
4090
-                            foreach ($columns as $column ) {
4091
-                                if ( $column == 'cat_id' ) {
4092
-                                    $cat_id = (int)$row[$c];
4093
-                                } else if ( $column == 'cat_name' ) {
4094
-                                    $cat_name = $row[$c];
4095
-                                } else if ( $column == 'cat_slug' ) {
4096
-                                    $cat_slug = $row[$c];
4097
-                                } else if ( $column == 'cat_posttype' ) {
4098
-                                    $cat_posttype = $row[$c];
4099
-                                } else if ( $column == 'cat_parent' ) {
4100
-                                    $cat_parent = trim($row[$c]);
4101
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4102
-                                    $cat_schema = $row[$c];
4103
-                                } else if ( $column == 'cat_description' ) {
4104
-                                    $cat_description = $row[$c];
4105
-                                } else if ( $column == 'cat_top_description' ) {
4106
-                                    $cat_top_description = $row[$c];
4107
-                                } else if ( $column == 'cat_image' ) {
4108
-                                    $cat_image = $row[$c];
4109
-                                } else if ( $column == 'cat_icon' ) {
4110
-                                    $cat_icon = $row[$c];
4111
-                                }
4112
-                                // WPML
4113
-                                if ( $is_wpml ) {
4114
-                                    if ( $column == 'cat_language' ) {
4115
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
4116
-                                    } else if ( $column == 'cat_id_original' ) {
4117
-                                        $cat_id_original = (int)$row[$c];
4118
-                                    }
4119
-                                }
4120
-                                // WPML
4121
-                                $c++;
4122
-                            }
4089
+							$c = 0;
4090
+							foreach ($columns as $column ) {
4091
+								if ( $column == 'cat_id' ) {
4092
+									$cat_id = (int)$row[$c];
4093
+								} else if ( $column == 'cat_name' ) {
4094
+									$cat_name = $row[$c];
4095
+								} else if ( $column == 'cat_slug' ) {
4096
+									$cat_slug = $row[$c];
4097
+								} else if ( $column == 'cat_posttype' ) {
4098
+									$cat_posttype = $row[$c];
4099
+								} else if ( $column == 'cat_parent' ) {
4100
+									$cat_parent = trim($row[$c]);
4101
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4102
+									$cat_schema = $row[$c];
4103
+								} else if ( $column == 'cat_description' ) {
4104
+									$cat_description = $row[$c];
4105
+								} else if ( $column == 'cat_top_description' ) {
4106
+									$cat_top_description = $row[$c];
4107
+								} else if ( $column == 'cat_image' ) {
4108
+									$cat_image = $row[$c];
4109
+								} else if ( $column == 'cat_icon' ) {
4110
+									$cat_icon = $row[$c];
4111
+								}
4112
+								// WPML
4113
+								if ( $is_wpml ) {
4114
+									if ( $column == 'cat_language' ) {
4115
+										$cat_language = geodir_strtolower( trim( $row[$c] ) );
4116
+									} else if ( $column == 'cat_id_original' ) {
4117
+										$cat_id_original = (int)$row[$c];
4118
+									}
4119
+								}
4120
+								// WPML
4121
+								$c++;
4122
+							}
4123 4123
                             
4124
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4125
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4124
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4125
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4126 4126
                                 
4127
-                                $invalid++;
4128
-                                continue;
4129
-                            }
4127
+								$invalid++;
4128
+								continue;
4129
+							}
4130 4130
                             
4131
-                            // WPML
4132
-                            if ($is_wpml && $cat_language != '') {
4133
-                                $sitepress->switch_lang($cat_language, true);
4134
-                            }
4135
-                            // WPML
4131
+							// WPML
4132
+							if ($is_wpml && $cat_language != '') {
4133
+								$sitepress->switch_lang($cat_language, true);
4134
+							}
4135
+							// WPML
4136 4136
                                                         
4137
-                            $term_data = array();
4138
-                            $term_data['name'] = $cat_name;
4139
-                            $term_data['slug'] = $cat_slug;
4140
-                            $term_data['description'] = $cat_description;
4141
-                            $term_data['cat_schema'] = $cat_schema;
4142
-                            $term_data['top_description'] = $cat_top_description;
4143
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4144
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4137
+							$term_data = array();
4138
+							$term_data['name'] = $cat_name;
4139
+							$term_data['slug'] = $cat_slug;
4140
+							$term_data['description'] = $cat_description;
4141
+							$term_data['cat_schema'] = $cat_schema;
4142
+							$term_data['top_description'] = $cat_top_description;
4143
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4144
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4145 4145
                             
4146
-                            //$term_data = array_map( 'utf8_encode', $term_data );
4146
+							//$term_data = array_map( 'utf8_encode', $term_data );
4147 4147
                             
4148
-                            $taxonomy = $cat_posttype . 'category';
4148
+							$taxonomy = $cat_posttype . 'category';
4149 4149
                             
4150
-                            $term_data['taxonomy'] = $taxonomy;
4150
+							$term_data['taxonomy'] = $taxonomy;
4151 4151
 
4152
-                            $term_parent_id = 0;
4153
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4154
-                                $term_parent = '';
4152
+							$term_parent_id = 0;
4153
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
4154
+								$term_parent = '';
4155 4155
                                 
4156
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4157
-                                    //
4158
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4159
-                                    //
4160
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4161
-                                    //
4162
-                                } else {
4163
-                                    $term_parent_data = array();
4164
-                                    $term_parent_data['name'] = $cat_parent;
4165
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4166
-                                    $term_parent_data['taxonomy'] = $taxonomy;
4156
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4157
+									//
4158
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4159
+									//
4160
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4161
+									//
4162
+								} else {
4163
+									$term_parent_data = array();
4164
+									$term_parent_data['name'] = $cat_parent;
4165
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4166
+									$term_parent_data['taxonomy'] = $taxonomy;
4167 4167
                                     
4168
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4169
-                                }
4168
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4169
+								}
4170 4170
                                 
4171
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4172
-                                    $term_parent_id = (int)$term_parent->term_id;
4173
-                                }
4174
-                            }
4175
-                            $term_data['parent'] = (int)$term_parent_id;
4171
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4172
+									$term_parent_id = (int)$term_parent->term_id;
4173
+								}
4174
+							}
4175
+							$term_data['parent'] = (int)$term_parent_id;
4176 4176
 
4177
-                            $term_id = NULL;
4178
-                            if ( $import_choice == 'update' ) {
4179
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4180
-                                    $term_data['term_id'] = $term['term_id'];
4177
+							$term_id = NULL;
4178
+							if ( $import_choice == 'update' ) {
4179
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4180
+									$term_data['term_id'] = $term['term_id'];
4181 4181
                                     
4182
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4183
-                                        $updated++;
4184
-                                    } else {
4185
-                                        $invalid++;
4186
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4187
-                                    }
4188
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4189
-                                    $term_data['term_id'] = $term['term_id'];
4182
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4183
+										$updated++;
4184
+									} else {
4185
+										$invalid++;
4186
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4187
+									}
4188
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4189
+									$term_data['term_id'] = $term['term_id'];
4190 4190
                                     
4191
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4192
-                                        $updated++;
4193
-                                    } else {
4194
-                                        $invalid++;
4195
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4196
-                                    }
4197
-                                } else {
4198
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4199
-                                        $created++;
4200
-                                    } else {
4201
-                                        $invalid++;
4202
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4203
-                                    }
4204
-                                }
4205
-                            } else if ( $import_choice == 'skip' ) {
4206
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4207
-                                    $skipped++;
4208
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4209
-                                    $skipped++;
4210
-                                } else {
4211
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4212
-                                        $created++;
4213
-                                    } else {
4214
-                                        $invalid++;
4215
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4216
-                                    }
4217
-                                }
4218
-                            } else {
4219
-                                $invalid++;
4220
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4221
-                            }
4191
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4192
+										$updated++;
4193
+									} else {
4194
+										$invalid++;
4195
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4196
+									}
4197
+								} else {
4198
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4199
+										$created++;
4200
+									} else {
4201
+										$invalid++;
4202
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4203
+									}
4204
+								}
4205
+							} else if ( $import_choice == 'skip' ) {
4206
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4207
+									$skipped++;
4208
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4209
+									$skipped++;
4210
+								} else {
4211
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4212
+										$created++;
4213
+									} else {
4214
+										$invalid++;
4215
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4216
+									}
4217
+								}
4218
+							} else {
4219
+								$invalid++;
4220
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4221
+							}
4222 4222
                             
4223
-                            if ( $term_id ) {
4224
-                                // WPML
4225
-                                if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4226
-                                    $wpml_element_type = 'tax_' . $taxonomy;
4227
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4228
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4229
-
4230
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4223
+							if ( $term_id ) {
4224
+								// WPML
4225
+								if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4226
+									$wpml_element_type = 'tax_' . $taxonomy;
4227
+									$source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4228
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4229
+
4230
+									$trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4231 4231
                                     
4232
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4233
-                                }
4234
-                                // WPML
4232
+									$sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4233
+								}
4234
+								// WPML
4235 4235
                                 
4236
-                                if ( isset( $term_data['top_description'] ) ) {
4237
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4238
-                                }
4236
+								if ( isset( $term_data['top_description'] ) ) {
4237
+									update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4238
+								}
4239 4239
                                 
4240
-                                if ( isset( $term_data['cat_schema'] ) ) {
4241
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4242
-                                }
4240
+								if ( isset( $term_data['cat_schema'] ) ) {
4241
+									update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4242
+								}
4243 4243
             
4244
-                                $attachment = false;
4245
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4246
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4247
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4244
+								$attachment = false;
4245
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4246
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4247
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4248 4248
                                     
4249
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4250
-                                        $attachment = true;
4251
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4252
-                                    }
4253
-                                }
4249
+									if ( basename($cat_image) != $term_data['image'] ) {
4250
+										$attachment = true;
4251
+										update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4252
+									}
4253
+								}
4254 4254
                                 
4255
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4256
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4257
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4255
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4256
+									$cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4257
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4258 4258
                                         
4259
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4260
-                                        $attachment = true;
4261
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4262
-                                    }
4263
-                                }
4259
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4260
+										$attachment = true;
4261
+										update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4262
+									}
4263
+								}
4264 4264
                                 
4265
-                                if ( $attachment ) {
4266
-                                    $images++;
4267
-                                }
4268
-                            }
4265
+								if ( $attachment ) {
4266
+									$images++;
4267
+								}
4268
+							}
4269 4269
                             
4270
-                            // WPML
4271
-                            if ($is_wpml && $cat_language != '') {
4272
-                                $sitepress->switch_lang($active_lang, true);
4273
-                            }
4274
-                            // WPML
4275
-                        }
4276
-                    }
4277
-                }
4270
+							// WPML
4271
+							if ($is_wpml && $cat_language != '') {
4272
+								$sitepress->switch_lang($active_lang, true);
4273
+							}
4274
+							// WPML
4275
+						}
4276
+					}
4277
+				}
4278 4278
                 
4279
-                $json = array();
4280
-                $json['processed'] = $limit;
4281
-                $json['created'] = $created;
4282
-                $json['updated'] = $updated;
4283
-                $json['skipped'] = $skipped;
4284
-                $json['invalid'] = $invalid;
4285
-                $json['images'] = $images;
4279
+				$json = array();
4280
+				$json['processed'] = $limit;
4281
+				$json['created'] = $created;
4282
+				$json['updated'] = $updated;
4283
+				$json['skipped'] = $skipped;
4284
+				$json['invalid'] = $invalid;
4285
+				$json['images'] = $images;
4286 4286
                 
4287
-                wp_send_json( $json );
4288
-                exit;
4289
-            } else if ( $task == 'import_post' ) {
4290
-                //run some stuff to make the import quicker
4291
-                wp_defer_term_counting( true );
4292
-                wp_defer_comment_counting( true );
4293
-                $wpdb->query( 'SET autocommit = 0;' );
4294
-
4295
-                //remove_all_actions('publish_post');
4296
-                //remove_all_actions('transition_post_status');
4297
-                //remove_all_actions('publish_future_post');
4298
-
4299
-                if (!empty($file)) {
4300
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4301
-                    $default_status = 'publish';
4302
-                    $current_date = date_i18n( 'Y-m-d', time() );
4287
+				wp_send_json( $json );
4288
+				exit;
4289
+			} else if ( $task == 'import_post' ) {
4290
+				//run some stuff to make the import quicker
4291
+				wp_defer_term_counting( true );
4292
+				wp_defer_comment_counting( true );
4293
+				$wpdb->query( 'SET autocommit = 0;' );
4294
+
4295
+				//remove_all_actions('publish_post');
4296
+				//remove_all_actions('transition_post_status');
4297
+				//remove_all_actions('publish_future_post');
4298
+
4299
+				if (!empty($file)) {
4300
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4301
+					$default_status = 'publish';
4302
+					$current_date = date_i18n( 'Y-m-d', time() );
4303 4303
                     
4304
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4304
+					$columns = isset($file[0]) ? $file[0] : NULL;
4305 4305
                     
4306
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4307
-                        $json['error'] = CSV_INVAILD_FILE;
4308
-                        wp_send_json( $json );
4309
-                        exit;
4310
-                    }
4306
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4307
+						$json['error'] = CSV_INVAILD_FILE;
4308
+						wp_send_json( $json );
4309
+						exit;
4310
+					}
4311 4311
 
4312
-                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4313
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4314
-                    $processed_actual = 0;
4315
-                    for ($i = 1; $i <= $limit; $i++) {
4316
-                        $index = $processed + $i;
4317
-                        $gd_post = array();
4312
+					$gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4313
+					$wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4314
+					$processed_actual = 0;
4315
+					for ($i = 1; $i <= $limit; $i++) {
4316
+						$index = $processed + $i;
4317
+						$gd_post = array();
4318 4318
                         
4319
-                        if (isset($file[$index])) {
4320
-                            $processed_actual++;
4321
-                            $row = $file[$index];
4322
-                            $row = array_map( 'trim', $row );
4323
-                            //$row = array_map( 'utf8_encode', $row );
4324
-                            $row = array_map( 'addslashes_gpc', $row );
4319
+						if (isset($file[$index])) {
4320
+							$processed_actual++;
4321
+							$row = $file[$index];
4322
+							$row = array_map( 'trim', $row );
4323
+							//$row = array_map( 'utf8_encode', $row );
4324
+							$row = array_map( 'addslashes_gpc', $row );
4325 4325
                             
4326
-                            $post_id = '';
4327
-                            $post_title = '';
4328
-                            $post_author = '';
4329
-                            $post_content = '';
4330
-                            $post_category_arr = array();
4331
-                            $default_category = '';
4332
-                            $post_tags = array();
4333
-                            $post_type = '';
4334
-                            $post_status = '';
4335
-                            $geodir_video = '';
4336
-                            $post_address = '';
4337
-                            $post_city = '';
4338
-                            $post_region = '';
4339
-                            $post_country = '';
4340
-                            $post_zip = '';
4341
-                            $post_latitude = '';
4342
-                            $post_longitude = '';
4343
-                            $post_neighbourhood = '';
4344
-                            $neighbourhood_latitude = '';
4345
-                            $neighbourhood_longitude = '';
4346
-                            $geodir_timing = '';
4347
-                            $geodir_contact = '';
4348
-                            $geodir_email = '';
4349
-                            $geodir_website = '';
4350
-                            $geodir_twitter = '';
4351
-                            $geodir_facebook = '';
4352
-                            $geodir_twitter = '';
4353
-                            $post_images = array();
4326
+							$post_id = '';
4327
+							$post_title = '';
4328
+							$post_author = '';
4329
+							$post_content = '';
4330
+							$post_category_arr = array();
4331
+							$default_category = '';
4332
+							$post_tags = array();
4333
+							$post_type = '';
4334
+							$post_status = '';
4335
+							$geodir_video = '';
4336
+							$post_address = '';
4337
+							$post_city = '';
4338
+							$post_region = '';
4339
+							$post_country = '';
4340
+							$post_zip = '';
4341
+							$post_latitude = '';
4342
+							$post_longitude = '';
4343
+							$post_neighbourhood = '';
4344
+							$neighbourhood_latitude = '';
4345
+							$neighbourhood_longitude = '';
4346
+							$geodir_timing = '';
4347
+							$geodir_contact = '';
4348
+							$geodir_email = '';
4349
+							$geodir_website = '';
4350
+							$geodir_twitter = '';
4351
+							$geodir_facebook = '';
4352
+							$geodir_twitter = '';
4353
+							$post_images = array();
4354 4354
                             
4355
-                            $expire_date = 'Never';
4355
+							$expire_date = 'Never';
4356 4356
                             
4357
-                            $language = '';
4358
-                            $original_post_id = '';
4357
+							$language = '';
4358
+							$original_post_id = '';
4359 4359
                                                         
4360
-                            $c = 0;
4361
-                            foreach ($columns as $column ) {
4362
-                                $gd_post[$column] = $row[$c];
4360
+							$c = 0;
4361
+							foreach ($columns as $column ) {
4362
+								$gd_post[$column] = $row[$c];
4363 4363
                                 
4364
-                                if ( $column == 'post_id' ) {
4365
-                                    $post_id = $row[$c];
4366
-                                } else if ( $column == 'post_title' ) {
4367
-                                    $post_title = sanitize_text_field($row[$c]);
4368
-                                } else if ( $column == 'post_author' ) {
4369
-                                    $post_author = $row[$c];
4370
-                                } else if ( $column == 'post_content' ) {
4371
-                                    $post_content = $row[$c];
4372
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4373
-                                    $post_category_arr = explode( ',', $row[$c] );
4374
-                                } else if ( $column == 'default_category' ) {
4375
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4376
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4377
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4378
-                                } else if ( $column == 'post_type' ) {
4379
-                                    $post_type = $row[$c];
4380
-                                } else if ( $column == 'post_status' ) {
4381
-                                    $post_status = sanitize_key( $row[$c] );
4382
-                                } else if ( $column == 'is_featured' ) {
4383
-                                    $is_featured = (int)$row[$c];
4384
-                                } else if ( $column == 'geodir_video' ) {
4385
-                                    $geodir_video = $row[$c];
4386
-                                } else if ( $column == 'post_address' ) {
4387
-                                    $post_address = sanitize_text_field($row[$c]);
4388
-                                } else if ( $column == 'post_city' ) {
4389
-                                    $post_city = sanitize_text_field($row[$c]);
4390
-                                } else if ( $column == 'post_region' ) {
4391
-                                    $post_region = sanitize_text_field($row[$c]);
4392
-                                } else if ( $column == 'post_country' ) {
4393
-                                    $post_country = sanitize_text_field($row[$c]);
4394
-                                } else if ( $column == 'post_zip' ) {
4395
-                                    $post_zip = sanitize_text_field($row[$c]);
4396
-                                } else if ( $column == 'post_latitude' ) {
4397
-                                    $post_latitude = sanitize_text_field($row[$c]);
4398
-                                } else if ( $column == 'post_longitude' ) {
4399
-                                    $post_longitude = sanitize_text_field($row[$c]);
4400
-                                } else if ( $column == 'post_neighbourhood' ) {
4401
-                                    $post_neighbourhood = sanitize_text_field($row[$c]);
4402
-                                    unset($gd_post[$column]);
4403
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4404
-                                    $neighbourhood_latitude = sanitize_text_field($row[$c]);
4405
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4406
-                                    $neighbourhood_longitude = sanitize_text_field($row[$c]);
4407
-                                } else if ( $column == 'geodir_timing' ) {
4408
-                                    $geodir_timing = sanitize_text_field($row[$c]);
4409
-                                } else if ( $column == 'geodir_contact' ) {
4410
-                                    $geodir_contact = sanitize_text_field($row[$c]);
4411
-                                } else if ( $column == 'geodir_email' ) {
4412
-                                    $geodir_email = sanitize_email($row[$c]);
4413
-                                } else if ( $column == 'geodir_website' ) {
4414
-                                    $geodir_website = sanitize_text_field($row[$c]);
4415
-                                } else if ( $column == 'geodir_twitter' ) {
4416
-                                    $geodir_twitter = sanitize_text_field($row[$c]);
4417
-                                } else if ( $column == 'geodir_facebook' ) {
4418
-                                    $geodir_facebook = sanitize_text_field($row[$c]);
4419
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4420
-                                    $post_images[] = $row[$c];
4421
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4422
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4423
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4424
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4425
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4426
-                                }
4427
-                                // WPML
4428
-                                if ($is_wpml) {
4429
-                                    if ($column == 'language') {
4430
-                                        $language = geodir_strtolower(trim($row[$c]));
4431
-                                    } else if ($column == 'original_post_id') {
4432
-                                        $original_post_id = (int)$row[$c];
4433
-                                    }
4434
-                                }
4435
-                                // WPML
4436
-                                $c++;
4437
-                            }
4364
+								if ( $column == 'post_id' ) {
4365
+									$post_id = $row[$c];
4366
+								} else if ( $column == 'post_title' ) {
4367
+									$post_title = sanitize_text_field($row[$c]);
4368
+								} else if ( $column == 'post_author' ) {
4369
+									$post_author = $row[$c];
4370
+								} else if ( $column == 'post_content' ) {
4371
+									$post_content = $row[$c];
4372
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4373
+									$post_category_arr = explode( ',', $row[$c] );
4374
+								} else if ( $column == 'default_category' ) {
4375
+									$default_category = wp_kses_normalize_entities($row[$c]);
4376
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4377
+									$post_tags = explode( ',', sanitize_text_field($row[$c]) );
4378
+								} else if ( $column == 'post_type' ) {
4379
+									$post_type = $row[$c];
4380
+								} else if ( $column == 'post_status' ) {
4381
+									$post_status = sanitize_key( $row[$c] );
4382
+								} else if ( $column == 'is_featured' ) {
4383
+									$is_featured = (int)$row[$c];
4384
+								} else if ( $column == 'geodir_video' ) {
4385
+									$geodir_video = $row[$c];
4386
+								} else if ( $column == 'post_address' ) {
4387
+									$post_address = sanitize_text_field($row[$c]);
4388
+								} else if ( $column == 'post_city' ) {
4389
+									$post_city = sanitize_text_field($row[$c]);
4390
+								} else if ( $column == 'post_region' ) {
4391
+									$post_region = sanitize_text_field($row[$c]);
4392
+								} else if ( $column == 'post_country' ) {
4393
+									$post_country = sanitize_text_field($row[$c]);
4394
+								} else if ( $column == 'post_zip' ) {
4395
+									$post_zip = sanitize_text_field($row[$c]);
4396
+								} else if ( $column == 'post_latitude' ) {
4397
+									$post_latitude = sanitize_text_field($row[$c]);
4398
+								} else if ( $column == 'post_longitude' ) {
4399
+									$post_longitude = sanitize_text_field($row[$c]);
4400
+								} else if ( $column == 'post_neighbourhood' ) {
4401
+									$post_neighbourhood = sanitize_text_field($row[$c]);
4402
+									unset($gd_post[$column]);
4403
+								} else if ( $column == 'neighbourhood_latitude' ) {
4404
+									$neighbourhood_latitude = sanitize_text_field($row[$c]);
4405
+								} else if ( $column == 'neighbourhood_longitude' ) {
4406
+									$neighbourhood_longitude = sanitize_text_field($row[$c]);
4407
+								} else if ( $column == 'geodir_timing' ) {
4408
+									$geodir_timing = sanitize_text_field($row[$c]);
4409
+								} else if ( $column == 'geodir_contact' ) {
4410
+									$geodir_contact = sanitize_text_field($row[$c]);
4411
+								} else if ( $column == 'geodir_email' ) {
4412
+									$geodir_email = sanitize_email($row[$c]);
4413
+								} else if ( $column == 'geodir_website' ) {
4414
+									$geodir_website = sanitize_text_field($row[$c]);
4415
+								} else if ( $column == 'geodir_twitter' ) {
4416
+									$geodir_twitter = sanitize_text_field($row[$c]);
4417
+								} else if ( $column == 'geodir_facebook' ) {
4418
+									$geodir_facebook = sanitize_text_field($row[$c]);
4419
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4420
+									$post_images[] = $row[$c];
4421
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4422
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4423
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4424
+									$row[$c] = str_replace('/', '-', $row[$c]);
4425
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4426
+								}
4427
+								// WPML
4428
+								if ($is_wpml) {
4429
+									if ($column == 'language') {
4430
+										$language = geodir_strtolower(trim($row[$c]));
4431
+									} else if ($column == 'original_post_id') {
4432
+										$original_post_id = (int)$row[$c];
4433
+									}
4434
+								}
4435
+								// WPML
4436
+								$c++;
4437
+							}
4438 4438
                             
4439
-                            // WPML
4440
-                            if ($is_wpml && $language != '') {
4441
-                                $sitepress->switch_lang($language, true);
4442
-                            }
4443
-                            // WPML
4439
+							// WPML
4440
+							if ($is_wpml && $language != '') {
4441
+								$sitepress->switch_lang($language, true);
4442
+							}
4443
+							// WPML
4444 4444
 
4445
-                            $gd_post['IMAGE'] = $post_images;
4445
+							$gd_post['IMAGE'] = $post_images;
4446 4446
                             
4447
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4448
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4447
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4448
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4449 4449
                                                                                                                 
4450
-                            $valid = true;
4450
+							$valid = true;
4451 4451
                             
4452
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4453
-                                $invalid++;
4454
-                                $valid = false;
4455
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4456
-                            }
4452
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4453
+								$invalid++;
4454
+								$valid = false;
4455
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4456
+							}
4457 4457
                             
4458
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4459
-                            if ( $location_allowed ) {
4460
-                                $location_result = geodir_get_default_location();
4461
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4462
-                                    $invalid_addr++;
4463
-                                    $valid = false;
4464
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4465
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4466
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4467
-                                        $invalid_addr++;
4468
-                                        $valid = false;
4469
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4470
-                                    } else {
4471
-                                        if (!$location_manager) {
4472
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4473
-                                        }
4474
-                                    }
4475
-                                }
4476
-                            }
4458
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4459
+							if ( $location_allowed ) {
4460
+								$location_result = geodir_get_default_location();
4461
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4462
+									$invalid_addr++;
4463
+									$valid = false;
4464
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4465
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4466
+									if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4467
+										$invalid_addr++;
4468
+										$valid = false;
4469
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4470
+									} else {
4471
+										if (!$location_manager) {
4472
+											$gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4473
+										}
4474
+									}
4475
+								}
4476
+							}
4477 4477
                             
4478
-                            if ( !$valid ) {
4479
-                                continue;
4480
-                            }
4478
+							if ( !$valid ) {
4479
+								continue;
4480
+							}
4481 4481
 
4482
-                            $cat_taxonomy = $post_type . 'category';
4483
-                            $tags_taxonomy = $post_type . '_tags';
4482
+							$cat_taxonomy = $post_type . 'category';
4483
+							$tags_taxonomy = $post_type . '_tags';
4484 4484
                             
4485
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4486
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4487
-                            }
4485
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4486
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4487
+							}
4488 4488
 
4489
-                            $post_category = array();
4490
-                            $default_category_id = NULL;
4491
-                            if ( !empty( $post_category_arr ) ) {
4492
-                                foreach ( $post_category_arr as $value ) {
4493
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4489
+							$post_category = array();
4490
+							$default_category_id = NULL;
4491
+							if ( !empty( $post_category_arr ) ) {
4492
+								foreach ( $post_category_arr as $value ) {
4493
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4494 4494
                                     
4495
-                                    if ( $category_name != '' ) {
4496
-                                        $term_category = array();
4495
+									if ( $category_name != '' ) {
4496
+										$term_category = array();
4497 4497
                                         
4498
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4499
-                                            $term_category = $term;
4500
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4501
-                                            $term_category = $term;
4502
-                                        } else {
4503
-                                            $term_data = array();
4504
-                                            $term_data['name'] = $category_name;
4505
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4498
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4499
+											$term_category = $term;
4500
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4501
+											$term_category = $term;
4502
+										} else {
4503
+											$term_data = array();
4504
+											$term_data['name'] = $category_name;
4505
+											$term_data['taxonomy'] = $cat_taxonomy;
4506 4506
                                             
4507
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4508
-                                            if ( $term_id ) {
4509
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4510
-                                            }
4511
-                                        }
4507
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4508
+											if ( $term_id ) {
4509
+												$term_category = get_term( $term_id, $cat_taxonomy );
4510
+											}
4511
+										}
4512 4512
                                         
4513
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4514
-                                            $post_category[] = intval($term_category->term_id);
4513
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4514
+											$post_category[] = intval($term_category->term_id);
4515 4515
                                             
4516
-                                            if ($category_name == $default_category) {
4517
-                                                $default_category_id = intval($term_category->term_id);
4518
-                                            }
4519
-                                        }
4520
-                                    }
4521
-                                }
4522
-                            }
4516
+											if ($category_name == $default_category) {
4517
+												$default_category_id = intval($term_category->term_id);
4518
+											}
4519
+										}
4520
+									}
4521
+								}
4522
+							}
4523 4523
 
4524
-                            $save_post = array();
4525
-                            $save_post['post_title'] = $post_title;
4526
-                            $save_post['post_content'] = $post_content;
4527
-                            $save_post['post_type'] = $post_type;
4528
-                            $save_post['post_author'] = $post_author;
4529
-                            $save_post['post_status'] = $post_status;
4530
-                            $save_post['post_category'] = $post_category;
4531
-                            $save_post['post_tags'] = $post_tags;
4532
-
4533
-                            $saved_post_id = NULL;
4534
-                            if ( $import_choice == 'update' ) {
4535
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4524
+							$save_post = array();
4525
+							$save_post['post_title'] = $post_title;
4526
+							$save_post['post_content'] = $post_content;
4527
+							$save_post['post_type'] = $post_type;
4528
+							$save_post['post_author'] = $post_author;
4529
+							$save_post['post_status'] = $post_status;
4530
+							$save_post['post_category'] = $post_category;
4531
+							$save_post['post_tags'] = $post_tags;
4532
+
4533
+							$saved_post_id = NULL;
4534
+							if ( $import_choice == 'update' ) {
4535
+								$gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4536 4536
                                 
4537
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4538
-                                    $save_post['ID'] = $post_id;
4537
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4538
+									$save_post['ID'] = $post_id;
4539 4539
                                     
4540
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4541
-                                        if ( is_wp_error( $saved_post_id ) ) {
4542
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4543
-                                            $saved_post_id = 0;
4544
-                                        } else {
4545
-                                            $saved_post_id = $post_id;
4546
-                                            $updated++;
4547
-                                        }
4548
-                                    }
4549
-                                } else {
4550
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4551
-                                        if ( is_wp_error( $saved_post_id ) ) {
4552
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4553
-                                            $saved_post_id = 0;
4554
-                                        } else {
4555
-                                            $created++;
4556
-                                        }
4557
-                                    }
4558
-                                }
4540
+									if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4541
+										if ( is_wp_error( $saved_post_id ) ) {
4542
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4543
+											$saved_post_id = 0;
4544
+										} else {
4545
+											$saved_post_id = $post_id;
4546
+											$updated++;
4547
+										}
4548
+									}
4549
+								} else {
4550
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4551
+										if ( is_wp_error( $saved_post_id ) ) {
4552
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4553
+											$saved_post_id = 0;
4554
+										} else {
4555
+											$created++;
4556
+										}
4557
+									}
4558
+								}
4559 4559
                                 
4560
-                                if ( !$saved_post_id > 0 ) {
4561
-                                    $invalid++;
4562
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4563
-                                }
4564
-                            } else if ( $import_choice == 'skip' ) {
4565
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4566
-                                    $skipped++;	
4567
-                                } else {
4568
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4569
-                                        if ( is_wp_error( $saved_post_id ) ) {
4570
-                                            $invalid++;
4560
+								if ( !$saved_post_id > 0 ) {
4561
+									$invalid++;
4562
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4563
+								}
4564
+							} else if ( $import_choice == 'skip' ) {
4565
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4566
+									$skipped++;	
4567
+								} else {
4568
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4569
+										if ( is_wp_error( $saved_post_id ) ) {
4570
+											$invalid++;
4571 4571
                                             
4572
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4573
-                                            $saved_post_id = 0;
4574
-                                        } else {
4575
-                                            $created++;
4576
-                                        }
4577
-                                    } else {
4578
-                                        $invalid++;
4572
+											geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4573
+											$saved_post_id = 0;
4574
+										} else {
4575
+											$created++;
4576
+										}
4577
+									} else {
4578
+										$invalid++;
4579 4579
                                         
4580
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4581
-                                    }
4582
-                                }
4583
-                            } else {
4584
-                                $invalid++;
4580
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4581
+									}
4582
+								}
4583
+							} else {
4584
+								$invalid++;
4585 4585
                                 
4586
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4587
-                            }
4586
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4587
+							}
4588 4588
 
4589
-                            if ( (int)$saved_post_id > 0 ) {
4590
-                                // WPML
4591
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
4592
-                                    $wpml_post_type = 'post_' . $post_type;
4593
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4594
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4589
+							if ( (int)$saved_post_id > 0 ) {
4590
+								// WPML
4591
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
4592
+									$wpml_post_type = 'post_' . $post_type;
4593
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4594
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4595 4595
 
4596
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4596
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4597 4597
                                     
4598
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4599
-                                }
4600
-                                // WPML
4601
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4598
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4599
+								}
4600
+								// WPML
4601
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4602 4602
                                 
4603
-                                $gd_post['post_id'] = $saved_post_id;
4604
-                                $gd_post['ID'] = $saved_post_id;
4605
-                                $gd_post['post_tags'] = $post_tags;
4606
-                                $gd_post['post_title'] = $post_title;
4607
-                                $gd_post['post_status'] = $post_status;
4608
-                                $gd_post['submit_time'] = time();
4609
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4603
+								$gd_post['post_id'] = $saved_post_id;
4604
+								$gd_post['ID'] = $saved_post_id;
4605
+								$gd_post['post_tags'] = $post_tags;
4606
+								$gd_post['post_title'] = $post_title;
4607
+								$gd_post['post_status'] = $post_status;
4608
+								$gd_post['submit_time'] = time();
4609
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4610 4610
                                                     
4611
-                                // post location
4612
-                                $post_location_id = 0;
4613
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4614
-                                    $gd_post['post_neighbourhood'] = '';
4611
+								// post location
4612
+								$post_location_id = 0;
4613
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4614
+									$gd_post['post_neighbourhood'] = '';
4615 4615
                                     
4616
-                                    $post_location_info = array(
4617
-                                                                'city' => $post_city,
4618
-                                                                'region' => $post_region,
4619
-                                                                'country' => $post_country,
4620
-                                                                'geo_lat' => $post_latitude,
4621
-                                                                'geo_lng' => $post_longitude
4622
-                                                            );
4623
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4624
-                                        $post_location_id = $location_id;
4625
-                                    }
4616
+									$post_location_info = array(
4617
+																'city' => $post_city,
4618
+																'region' => $post_region,
4619
+																'country' => $post_country,
4620
+																'geo_lat' => $post_latitude,
4621
+																'geo_lng' => $post_longitude
4622
+															);
4623
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4624
+										$post_location_id = $location_id;
4625
+									}
4626 4626
                                     
4627
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4628
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4627
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4628
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4629 4629
 
4630
-                                        $hood_data = array();
4631
-                                        $hood_data['hood_location_id'] = $post_location_id;
4632
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4630
+										$hood_data = array();
4631
+										$hood_data['hood_location_id'] = $post_location_id;
4632
+										$hood_data['hood_name'] = $post_neighbourhood;
4633 4633
                                         
4634
-                                        if (!empty($neighbourhood_info)) {
4635
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4636
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4634
+										if (!empty($neighbourhood_info)) {
4635
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4636
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4637 4637
                                             
4638
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4639
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4640
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4641
-                                            }
4642
-                                        }
4638
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4639
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4640
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4641
+											}
4642
+										}
4643 4643
                                         
4644
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4645
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4646
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4647
-                                        }
4644
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4645
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4646
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4647
+										}
4648 4648
                                         
4649
-                                        $hood_data['hood_latitude'] = $post_latitude;
4650
-                                        $hood_data['hood_longitude'] = $post_longitude;
4649
+										$hood_data['hood_latitude'] = $post_latitude;
4650
+										$hood_data['hood_longitude'] = $post_longitude;
4651 4651
 
4652
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4653
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4654
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4655
-                                        }
4656
-                                    }
4657
-                                }
4658
-                                $gd_post['post_location_id'] = $post_location_id;
4652
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4653
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4654
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4655
+										}
4656
+									}
4657
+								}
4658
+								$gd_post['post_location_id'] = $post_location_id;
4659 4659
                                 
4660
-                                // post package info
4661
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4662
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4663
-                                    $package_id = $gd_post_info->package_id;
4664
-                                }
4660
+								// post package info
4661
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4662
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4663
+									$package_id = $gd_post_info->package_id;
4664
+								}
4665 4665
                                 
4666
-                                $package_info = array();
4667
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4668
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4666
+								$package_info = array();
4667
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4668
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4669 4669
                                     
4670
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4671
-                                        $package_info = array();
4672
-                                    }
4673
-                                }
4670
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4671
+										$package_info = array();
4672
+									}
4673
+								}
4674 4674
                                 
4675
-                                if (empty($package_info)) {
4676
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4677
-                                }
4675
+								if (empty($package_info)) {
4676
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4677
+								}
4678 4678
                                  
4679
-                                if (!empty($package_info))	 {
4680
-                                    $package_id = $package_info['pid'];
4679
+								if (!empty($package_info))	 {
4680
+									$package_id = $package_info['pid'];
4681 4681
                                     
4682
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4683
-                                        $gd_post['expire_date'] = $expire_date;
4684
-                                    } else {
4685
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4686
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4687
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4688
-                                        } else {
4689
-                                            $gd_post['expire_date'] = 'Never';
4690
-                                        }
4691
-                                    }
4682
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4683
+										$gd_post['expire_date'] = $expire_date;
4684
+									} else {
4685
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4686
+											$gd_post['alive_days'] = (int)$package_info['days'];
4687
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4688
+										} else {
4689
+											$gd_post['expire_date'] = 'Never';
4690
+										}
4691
+									}
4692 4692
                                     
4693
-                                    $gd_post['package_id'] = $package_id;
4694
-                                }
4693
+									$gd_post['package_id'] = $package_id;
4694
+								}
4695 4695
 
4696
-                                $table = $plugin_prefix . $post_type . '_detail';
4696
+								$table = $plugin_prefix . $post_type . '_detail';
4697 4697
                                 
4698
-                                if ($post_type == 'gd_event') {
4699
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4700
-                                }
4698
+								if ($post_type == 'gd_event') {
4699
+									$gd_post = geodir_imex_process_event_data($gd_post);
4700
+								}
4701 4701
                                 
4702
-                                if (isset($gd_post['post_id'])) {
4703
-                                    unset($gd_post['post_id']);
4704
-                                }
4702
+								if (isset($gd_post['post_id'])) {
4703
+									unset($gd_post['post_id']);
4704
+								}
4705 4705
 
4706
-                                // Export franchise fields
4707
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4708
-                                if ($is_franchise_active) {
4709
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4710
-                                        $gd_franchise_lock = array();
4706
+								// Export franchise fields
4707
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4708
+								if ($is_franchise_active) {
4709
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4710
+										$gd_franchise_lock = array();
4711 4711
                                         
4712
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4713
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4714
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4715
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4716
-                                        }
4712
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4713
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4714
+											$gd_franchise_lock = trim( $gd_franchise_lock );
4715
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4716
+										}
4717 4717
                                         
4718
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4719
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4720
-                                    } else {
4721
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4722
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4723
-                                        }
4724
-                                    }
4725
-                                }
4718
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4719
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4720
+									} else {
4721
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4722
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4723
+										}
4724
+									}
4725
+								}
4726 4726
                                 
4727
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4728
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4729
-                                    if ($default_category_id) {
4730
-                                        $save_post['post_default_category'] = $default_category_id;
4731
-                                        $gd_post['default_category'] = $default_category_id;
4732
-                                    }
4733
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4734
-                                }
4727
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4728
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4729
+									if ($default_category_id) {
4730
+										$save_post['post_default_category'] = $default_category_id;
4731
+										$gd_post['default_category'] = $default_category_id;
4732
+									}
4733
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4734
+								}
4735 4735
                                 
4736
-                                // Save post info
4737
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4738
-                                // post taxonomies
4739
-                                if ( !empty( $save_post['post_category'] ) ) {
4740
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4736
+								// Save post info
4737
+								geodir_save_post_info( $saved_post_id, $gd_post );
4738
+								// post taxonomies
4739
+								if ( !empty( $save_post['post_category'] ) ) {
4740
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4741 4741
                                     
4742
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4743
-                                    if ($default_category_id) {
4744
-                                        $post_default_category = $default_category_id;
4745
-                                    }
4746
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4747
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4748
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4742
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4743
+									if ($default_category_id) {
4744
+										$post_default_category = $default_category_id;
4745
+									}
4746
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4747
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4748
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4749 4749
                                     
4750
-                                    if ($post_category_str != '' && $post_default_category) {
4751
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4752
-                                    }
4750
+									if ($post_category_str != '' && $post_default_category) {
4751
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4752
+									}
4753 4753
                                     
4754
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4754
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4755 4755
                                     
4756
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4757
-                                }
4756
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4757
+								}
4758 4758
 
4759
-                                if ( !empty( $save_post['post_tags'] ) ) {
4760
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4761
-                                }
4759
+								if ( !empty( $save_post['post_tags'] ) ) {
4760
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4761
+								}
4762 4762
 
4763
-                                // Post images
4764
-                                if ( !empty( $post_images ) ) {
4765
-                                    $post_images = array_unique($post_images);
4763
+								// Post images
4764
+								if ( !empty( $post_images ) ) {
4765
+									$post_images = array_unique($post_images);
4766 4766
                                     
4767
-                                    $old_post_images_arr = array();
4768
-                                    $saved_post_images_arr = array();
4767
+									$old_post_images_arr = array();
4768
+									$saved_post_images_arr = array();
4769 4769
                                     
4770
-                                    $order = 1;
4770
+									$order = 1;
4771 4771
                                     
4772
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4773
-                                    if (!empty($old_post_images)) {
4774
-                                        foreach( $old_post_images as $old_post_image ) {
4775
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4776
-                                                $old_post_images_arr[] = $old_post_image->file;
4777
-                                            }
4778
-                                        }
4779
-                                    }
4772
+									$old_post_images = geodir_get_images( $saved_post_id );
4773
+									if (!empty($old_post_images)) {
4774
+										foreach( $old_post_images as $old_post_image ) {
4775
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4776
+												$old_post_images_arr[] = $old_post_image->file;
4777
+											}
4778
+										}
4779
+									}
4780 4780
                                     
4781
-                                    foreach ( $post_images as $post_image ) {
4782
-                                        $image_name = basename( $post_image );
4783
-                                        $saved_post_images_arr[] = $image_name;
4781
+									foreach ( $post_images as $post_image ) {
4782
+										$image_name = basename( $post_image );
4783
+										$saved_post_images_arr[] = $image_name;
4784 4784
                                         
4785
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4786
-                                            continue; // Skip if image already exists.
4787
-                                        }
4785
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4786
+											continue; // Skip if image already exists.
4787
+										}
4788 4788
                                         
4789
-                                        $image_name_parts = explode( '.', $image_name );
4790
-                                        array_pop( $image_name_parts );
4791
-                                        $proper_image_name = implode( '.', $image_name_parts );
4789
+										$image_name_parts = explode( '.', $image_name );
4790
+										array_pop( $image_name_parts );
4791
+										$proper_image_name = implode( '.', $image_name_parts );
4792 4792
                                         
4793
-                                        $arr_file_type = wp_check_filetype( $image_name );
4793
+										$arr_file_type = wp_check_filetype( $image_name );
4794 4794
                                         
4795
-                                        if ( !empty( $arr_file_type ) ) {
4796
-                                            $uploaded_file_type = $arr_file_type['type'];
4795
+										if ( !empty( $arr_file_type ) ) {
4796
+											$uploaded_file_type = $arr_file_type['type'];
4797 4797
                                             
4798
-                                            $attachment = array();
4799
-                                            $attachment['post_id'] = $saved_post_id;
4800
-                                            $attachment['title'] = $proper_image_name;
4801
-                                            $attachment['content'] = '';
4802
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4803
-                                            $attachment['mime_type'] = $uploaded_file_type;
4804
-                                            $attachment['menu_order'] = $order;
4805
-                                            $attachment['is_featured'] = 0;
4806
-
4807
-                                            $attachment_set = '';
4808
-                                            foreach ( $attachment as $key => $val ) {
4809
-                                                if ( $val != '' ) {
4810
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4811
-                                                }
4812
-                                            }
4813
-                                            $attachment_set = trim( $attachment_set, ", " );
4798
+											$attachment = array();
4799
+											$attachment['post_id'] = $saved_post_id;
4800
+											$attachment['title'] = $proper_image_name;
4801
+											$attachment['content'] = '';
4802
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4803
+											$attachment['mime_type'] = $uploaded_file_type;
4804
+											$attachment['menu_order'] = $order;
4805
+											$attachment['is_featured'] = 0;
4806
+
4807
+											$attachment_set = '';
4808
+											foreach ( $attachment as $key => $val ) {
4809
+												if ( $val != '' ) {
4810
+													$attachment_set .= $key . " = '" . $val . "', ";
4811
+												}
4812
+											}
4813
+											$attachment_set = trim( $attachment_set, ", " );
4814 4814
                                                                                         
4815
-                                            // Add new attachment
4816
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4815
+											// Add new attachment
4816
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4817 4817
                                                                                         
4818
-                                            $order++;
4819
-                                        }
4820
-                                    }
4818
+											$order++;
4819
+										}
4820
+									}
4821 4821
 
4822
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4823
-                                    // Remove previous attachment
4824
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4822
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4823
+									// Remove previous attachment
4824
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4825 4825
                                     
4826
-                                    if ( !empty( $saved_post_images_arr ) ) {
4827
-                                        $menu_order = 1;
4826
+									if ( !empty( $saved_post_images_arr ) ) {
4827
+										$menu_order = 1;
4828 4828
                                         
4829
-                                        foreach ( $saved_post_images_arr as $img_name ) {
4830
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4829
+										foreach ( $saved_post_images_arr as $img_name ) {
4830
+											$wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4831 4831
                                             
4832
-                                            if( $menu_order == 1 ) {
4833
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4834
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4835
-                                                }
4836
-                                            }
4837
-                                            $menu_order++;
4838
-                                        }
4839
-                                    }
4832
+											if( $menu_order == 1 ) {
4833
+												if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4834
+													$wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4835
+												}
4836
+											}
4837
+											$menu_order++;
4838
+										}
4839
+									}
4840 4840
                                     
4841
-                                    if ( $order > 1 ) {
4842
-                                        $images++;
4843
-                                    }
4844
-                                }
4841
+									if ( $order > 1 ) {
4842
+										$images++;
4843
+									}
4844
+								}
4845 4845
 
4846
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4847
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4846
+								/** This action is documented in geodirectory-functions/post-functions.php */
4847
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4848 4848
                                 
4849
-                                if (isset($is_featured)) {
4850
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4851
-                                }
4852
-                                if (isset($gd_post['expire_date'])) {
4853
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4854
-                                }
4855
-                            }
4849
+								if (isset($is_featured)) {
4850
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4851
+								}
4852
+								if (isset($gd_post['expire_date'])) {
4853
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4854
+								}
4855
+							}
4856 4856
                             
4857
-                            // WPML
4858
-                            if ($is_wpml && $language != '') {
4859
-                                $sitepress->switch_lang($active_lang, true);
4860
-                            }
4861
-                            // WPML
4862
-                        }
4863
-                    }
4864
-                }
4857
+							// WPML
4858
+							if ($is_wpml && $language != '') {
4859
+								$sitepress->switch_lang($active_lang, true);
4860
+							}
4861
+							// WPML
4862
+						}
4863
+					}
4864
+				}
4865 4865
 
4866
-                //undo some stuff to make the import quicker
4867
-                wp_defer_term_counting( false );
4868
-                wp_defer_comment_counting( false );
4869
-                $wpdb->query( 'COMMIT;' );
4870
-                $wpdb->query( 'SET autocommit = 1;' );
4871
-
4872
-                $json = array();
4873
-                $json['processed'] = $processed_actual;
4874
-                $json['created'] = $created;
4875
-                $json['updated'] = $updated;
4876
-                $json['skipped'] = $skipped;
4877
-                $json['invalid'] = $invalid;
4878
-                $json['invalid_addr'] = $invalid_addr;
4879
-                $json['images'] = $images;
4866
+				//undo some stuff to make the import quicker
4867
+				wp_defer_term_counting( false );
4868
+				wp_defer_comment_counting( false );
4869
+				$wpdb->query( 'COMMIT;' );
4870
+				$wpdb->query( 'SET autocommit = 1;' );
4871
+
4872
+				$json = array();
4873
+				$json['processed'] = $processed_actual;
4874
+				$json['created'] = $created;
4875
+				$json['updated'] = $updated;
4876
+				$json['skipped'] = $skipped;
4877
+				$json['invalid'] = $invalid;
4878
+				$json['invalid_addr'] = $invalid_addr;
4879
+				$json['images'] = $images;
4880 4880
                 
4881
-                wp_send_json( $json );
4882
-                exit;
4883
-            } else if ( $task == 'import_loc' ) {
4884
-                global $gd_post_types;
4885
-                $gd_post_types = $post_types;
4881
+				wp_send_json( $json );
4882
+				exit;
4883
+			} else if ( $task == 'import_loc' ) {
4884
+				global $gd_post_types;
4885
+				$gd_post_types = $post_types;
4886 4886
                 
4887
-                if (!empty($file)) {
4888
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4887
+				if (!empty($file)) {
4888
+					$columns = isset($file[0]) ? $file[0] : NULL;
4889 4889
                     
4890
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4891
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4892
-                        wp_send_json( $json );
4893
-                    }
4890
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4891
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4892
+						wp_send_json( $json );
4893
+					}
4894 4894
                     
4895
-                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4896
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4897
-                    for ($i = 1; $i <= $limit; $i++) {
4898
-                        $index = $processed + $i;
4895
+					$gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4896
+					$gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4897
+					for ($i = 1; $i <= $limit; $i++) {
4898
+						$index = $processed + $i;
4899 4899
                         
4900
-                        if (isset($file[$index])) {
4901
-                            $row = $file[$index];
4902
-                            $row = array_map( 'trim', $row );
4903
-                            $data = array();
4900
+						if (isset($file[$index])) {
4901
+							$row = $file[$index];
4902
+							$row = array_map( 'trim', $row );
4903
+							$data = array();
4904 4904
                             
4905
-                            foreach ($columns as $c => $column ) {
4906
-                                if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4907
-                                    $data[$column] = $row[$c];
4908
-                                }
4909
-                            }
4905
+							foreach ($columns as $c => $column ) {
4906
+								if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4907
+									$data[$column] = $row[$c];
4908
+								}
4909
+							}
4910 4910
 
4911
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4912
-                                $invalid++;
4913
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4914
-                                continue;
4915
-                            }
4911
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4912
+								$invalid++;
4913
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4914
+								continue;
4915
+							}
4916 4916
                             
4917
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4917
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4918 4918
                             
4919
-                            if ( $import_choice == 'update' ) {
4920
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4921
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4922
-                                        $updated++;
4923
-                                    } else {
4924
-                                        $invalid++;
4925
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4926
-                                    }
4927
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4928
-                                    $data['location_id'] = (int)$location->location_id;
4919
+							if ( $import_choice == 'update' ) {
4920
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4921
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4922
+										$updated++;
4923
+									} else {
4924
+										$invalid++;
4925
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4926
+									}
4927
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4928
+									$data['location_id'] = (int)$location->location_id;
4929 4929
                                     
4930
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4931
-                                        $data['location_id'] = (int)$location->location_id;
4932
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4933
-                                        $data['location_id'] = (int)$location->location_id;
4934
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4935
-                                        $data['location_id'] = (int)$location->location_id;
4936
-                                    }
4930
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4931
+										$data['location_id'] = (int)$location->location_id;
4932
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4933
+										$data['location_id'] = (int)$location->location_id;
4934
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4935
+										$data['location_id'] = (int)$location->location_id;
4936
+									}
4937 4937
                                     
4938
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4939
-                                        $updated++;
4940
-                                    } else {
4941
-                                        $invalid++;
4942
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4943
-                                    }
4944
-                                } else {
4945
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4946
-                                        $created++;
4947
-                                    } else {
4948
-                                        $invalid++;
4949
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4950
-                                    }
4951
-                                }
4952
-                            } elseif ( $import_choice == 'skip' ) {
4953
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4954
-                                    $skipped++;
4955
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4956
-                                    $skipped++;
4957
-                                } else {
4958
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4959
-                                        $created++;
4960
-                                    } else {
4961
-                                        $invalid++;
4962
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4963
-                                    }
4964
-                                }
4965
-                            } else {
4966
-                                $invalid++;
4967
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4968
-                            }
4969
-                        }
4970
-                    }
4971
-                }
4938
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4939
+										$updated++;
4940
+									} else {
4941
+										$invalid++;
4942
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4943
+									}
4944
+								} else {
4945
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4946
+										$created++;
4947
+									} else {
4948
+										$invalid++;
4949
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4950
+									}
4951
+								}
4952
+							} elseif ( $import_choice == 'skip' ) {
4953
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4954
+									$skipped++;
4955
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4956
+									$skipped++;
4957
+								} else {
4958
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4959
+										$created++;
4960
+									} else {
4961
+										$invalid++;
4962
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4963
+									}
4964
+								}
4965
+							} else {
4966
+								$invalid++;
4967
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4968
+							}
4969
+						}
4970
+					}
4971
+				}
4972 4972
                 
4973
-                $json = array();
4974
-                $json['processed'] = $limit;
4975
-                $json['created'] = $created;
4976
-                $json['updated'] = $updated;
4977
-                $json['skipped'] = $skipped;
4978
-                $json['invalid'] = $invalid;
4979
-                $json['images'] = $images;
4973
+				$json = array();
4974
+				$json['processed'] = $limit;
4975
+				$json['created'] = $created;
4976
+				$json['updated'] = $updated;
4977
+				$json['skipped'] = $skipped;
4978
+				$json['invalid'] = $invalid;
4979
+				$json['images'] = $images;
4980 4980
                 
4981
-                wp_send_json( $json );
4982
-            } else if ( $task == 'import_hood' ) {               
4983
-                if (!empty($file)) {
4984
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4981
+				wp_send_json( $json );
4982
+			} else if ( $task == 'import_hood' ) {               
4983
+				if (!empty($file)) {
4984
+					$columns = isset($file[0]) ? $file[0] : NULL;
4985 4985
                     
4986
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4987
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4988
-                        wp_send_json( $json );
4989
-                    }
4986
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4987
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4988
+						wp_send_json( $json );
4989
+					}
4990 4990
                     
4991
-                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4992
-                    $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
4993
-                    for ($i = 1; $i <= $limit; $i++) {
4994
-                        $index = $processed + $i;
4991
+					$gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4992
+					$gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
4993
+					for ($i = 1; $i <= $limit; $i++) {
4994
+						$index = $processed + $i;
4995 4995
                         
4996
-                        if (isset($file[$index])) {
4997
-                            $row = $file[$index];
4998
-                            $row = array_map( 'trim', $row );
4999
-                            $data = array();
4996
+						if (isset($file[$index])) {
4997
+							$row = $file[$index];
4998
+							$row = array_map( 'trim', $row );
4999
+							$data = array();
5000 5000
                             
5001
-                            foreach ($columns as $c => $column) {
5002
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
5003
-                                    $data[$column] = sanitize_text_field($row[$c]);
5004
-                                }
5005
-                            }
5001
+							foreach ($columns as $c => $column) {
5002
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
5003
+									$data[$column] = sanitize_text_field($row[$c]);
5004
+								}
5005
+							}
5006 5006
 
5007
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5008
-                                $invalid++;
5009
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5010
-                                continue;
5011
-                            }
5007
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5008
+								$invalid++;
5009
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5010
+								continue;
5011
+							}
5012 5012
                             
5013
-                            $location_info = array();
5014
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5015
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5016
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5017
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5018
-                            }
5013
+							$location_info = array();
5014
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5015
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5016
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5017
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5018
+							}
5019 5019
 
5020
-                            if (empty($location_info)) {
5021
-                                $invalid++;
5022
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5023
-                                continue;
5024
-                            }
5020
+							if (empty($location_info)) {
5021
+								$invalid++;
5022
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5023
+								continue;
5024
+							}
5025 5025
                             
5026
-                            $location_id = $location_info->location_id;
5026
+							$location_id = $location_info->location_id;
5027 5027
 
5028
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
5028
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
5029 5029
                             
5030
-                            $hood_data = array();
5031
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
5032
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
5033
-                            $hood_data['hood_latitude'] = $data['latitude'];
5034
-                            $hood_data['hood_longitude'] = $data['longitude'];
5035
-                            $hood_data['hood_location_id'] = $location_id;
5030
+							$hood_data = array();
5031
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
5032
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
5033
+							$hood_data['hood_latitude'] = $data['latitude'];
5034
+							$hood_data['hood_longitude'] = $data['longitude'];
5035
+							$hood_data['hood_location_id'] = $location_id;
5036 5036
                                     
5037
-                            if ( $import_choice == 'update' ) {
5038
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5039
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5037
+							if ( $import_choice == 'update' ) {
5038
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5039
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5040 5040
                                     
5041
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5042
-                                        $updated++;
5043
-                                    } else {
5044
-                                        $invalid++;
5045
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5046
-                                    }
5047
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5048
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5041
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5042
+										$updated++;
5043
+									} else {
5044
+										$invalid++;
5045
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5046
+									}
5047
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5048
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5049 5049
                                     
5050
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5051
-                                        $updated++;
5052
-                                    } else {
5053
-                                        $invalid++;
5054
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5055
-                                    }
5056
-                                } else {
5057
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5058
-                                        $created++;
5059
-                                    } else {
5060
-                                        $invalid++;
5061
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5062
-                                    }
5063
-                                }
5064
-                            } elseif ( $import_choice == 'skip' ) {
5065
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5066
-                                    $skipped++;
5067
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5068
-                                    $skipped++;
5069
-                                } else {
5050
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5051
+										$updated++;
5052
+									} else {
5053
+										$invalid++;
5054
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5055
+									}
5056
+								} else {
5057
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5058
+										$created++;
5059
+									} else {
5060
+										$invalid++;
5061
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5062
+									}
5063
+								}
5064
+							} elseif ( $import_choice == 'skip' ) {
5065
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5066
+									$skipped++;
5067
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5068
+									$skipped++;
5069
+								} else {
5070 5070
                                     
5071
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5072
-                                        $created++;
5073
-                                    } else {
5074
-                                        $invalid++;
5075
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5076
-                                    }
5077
-                                }
5078
-                            } else {
5079
-                                $invalid++;
5080
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5081
-                            }
5082
-                        }
5083
-                    }
5084
-                }
5071
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5072
+										$created++;
5073
+									} else {
5074
+										$invalid++;
5075
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5076
+									}
5077
+								}
5078
+							} else {
5079
+								$invalid++;
5080
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5081
+							}
5082
+						}
5083
+					}
5084
+				}
5085 5085
                 
5086
-                $json = array();
5087
-                $json['processed'] = $limit;
5088
-                $json['created'] = $created;
5089
-                $json['updated'] = $updated;
5090
-                $json['skipped'] = $skipped;
5091
-                $json['invalid'] = $invalid;
5092
-                $json['images'] = $images;
5086
+				$json = array();
5087
+				$json['processed'] = $limit;
5088
+				$json['created'] = $created;
5089
+				$json['updated'] = $updated;
5090
+				$json['skipped'] = $skipped;
5091
+				$json['invalid'] = $invalid;
5092
+				$json['images'] = $images;
5093 5093
                 
5094
-                wp_send_json( $json );
5095
-            }
5096
-        }
5097
-        break;
5098
-        case 'import_finish':{
5099
-            /**
5100
-             * Run an action when an import finishes.
5101
-             *
5102
-             * This action can be used to fire functions after an import ends.
5103
-             *
5104
-             * @since 1.5.3
5105
-             * @package GeoDirectory
5106
-             */
5107
-            do_action('geodir_import_finished');
5108
-        }
5109
-        break;
5094
+				wp_send_json( $json );
5095
+			}
5096
+		}
5097
+		break;
5098
+		case 'import_finish':{
5099
+			/**
5100
+			 * Run an action when an import finishes.
5101
+			 *
5102
+			 * This action can be used to fire functions after an import ends.
5103
+			 *
5104
+			 * @since 1.5.3
5105
+			 * @package GeoDirectory
5106
+			 */
5107
+			do_action('geodir_import_finished');
5108
+		}
5109
+		break;
5110 5110
 
5111
-    }
5112
-    echo '0';
5113
-    gd_die();
5111
+	}
5112
+	echo '0';
5113
+	gd_die();
5114 5114
 }
5115 5115
 
5116 5116
 /**
@@ -5154,12 +5154,12 @@  discard block
 block discarded – undo
5154 5154
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5155 5155
 	}
5156 5156
 	
5157
-    if( !empty( $term ) ) {
5157
+	if( !empty( $term ) ) {
5158 5158
 		$result = wp_insert_term( $term, $taxonomy, $args );
5159
-        if( !is_wp_error( $result ) ) {
5160
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5161
-        }
5162
-    }
5159
+		if( !is_wp_error( $result ) ) {
5160
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5161
+		}
5162
+	}
5163 5163
 	
5164 5164
 	return false;
5165 5165
 }
@@ -5205,16 +5205,16 @@  discard block
 block discarded – undo
5205 5205
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5206 5206
 		
5207 5207
 		if( !is_wp_error( $result ) ) {
5208
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5209
-        }
5208
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5209
+		}
5210 5210
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5211 5211
 		$term_data['term_id'] = $term_info['term_id'];
5212 5212
 		
5213 5213
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5214 5214
 		
5215 5215
 		if( !is_wp_error( $result ) ) {
5216
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5217
-        }
5216
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5217
+		}
5218 5218
 	} else {
5219 5219
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5220 5220
 	}
@@ -5235,37 +5235,37 @@  discard block
 block discarded – undo
5235 5235
  * @return int Posts count.
5236 5236
  */
5237 5237
 function geodir_get_posts_count( $post_type ) {
5238
-    global $wpdb, $plugin_prefix;
5238
+	global $wpdb, $plugin_prefix;
5239 5239
 
5240
-    if ( !post_type_exists( $post_type ) ) {
5241
-        return 0;
5242
-    }
5240
+	if ( !post_type_exists( $post_type ) ) {
5241
+		return 0;
5242
+	}
5243 5243
         
5244
-    $table = $plugin_prefix . $post_type . '_detail';
5244
+	$table = $plugin_prefix . $post_type . '_detail';
5245 5245
 
5246
-    // Skip listing with statuses trash, auto-draft etc...
5247
-    $skip_statuses = geodir_imex_export_skip_statuses();
5248
-    $where_statuses = '';
5249
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5250
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5251
-    }
5246
+	// Skip listing with statuses trash, auto-draft etc...
5247
+	$skip_statuses = geodir_imex_export_skip_statuses();
5248
+	$where_statuses = '';
5249
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5250
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5251
+	}
5252 5252
 
5253
-    $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5253
+	$query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5254 5254
 
5255
-    $posts_count = (int)$wpdb->get_var( $query );
5255
+	$posts_count = (int)$wpdb->get_var( $query );
5256 5256
     
5257
-    /**
5258
-     * Modify returned post counts for the current post type.
5259
-     *
5260
-     * @since 1.4.6
5261
-     * @package GeoDirectory
5262
-     *
5263
-     * @param int $posts_count Post counts.
5264
-     * @param string $post_type Post type.
5265
-     */
5266
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5267
-
5268
-    return $posts_count;
5257
+	/**
5258
+	 * Modify returned post counts for the current post type.
5259
+	 *
5260
+	 * @since 1.4.6
5261
+	 * @package GeoDirectory
5262
+	 *
5263
+	 * @param int $posts_count Post counts.
5264
+	 * @param string $post_type Post type.
5265
+	 */
5266
+	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5267
+
5268
+	return $posts_count;
5269 5269
 }
5270 5270
 
5271 5271
 /**
@@ -5293,9 +5293,9 @@  discard block
 block discarded – undo
5293 5293
 	
5294 5294
 	if ( !empty( $posts ) ) {
5295 5295
 		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5296
-        $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5297
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5298
-        $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5296
+		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5297
+		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5298
+		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5299 5299
 		
5300 5300
 		$csv_row = array();
5301 5301
 		$csv_row[] = 'post_id';
@@ -5339,11 +5339,11 @@  discard block
 block discarded – undo
5339 5339
 		$csv_row[] = 'post_zip';
5340 5340
 		$csv_row[] = 'post_latitude';
5341 5341
 		$csv_row[] = 'post_longitude';
5342
-        if ($neighbourhood_active) {
5343
-            $csv_row[] = 'post_neighbourhood';
5344
-            $csv_row[] = 'neighbourhood_latitude';
5345
-            $csv_row[] = 'neighbourhood_longitude';
5346
-        }
5342
+		if ($neighbourhood_active) {
5343
+			$csv_row[] = 'post_neighbourhood';
5344
+			$csv_row[] = 'neighbourhood_latitude';
5345
+			$csv_row[] = 'neighbourhood_longitude';
5346
+		}
5347 5347
 		$csv_row[] = 'geodir_timing';
5348 5348
 		$csv_row[] = 'geodir_contact';
5349 5349
 		$csv_row[] = 'geodir_email';
@@ -5378,7 +5378,7 @@  discard block
 block discarded – undo
5378 5378
 		$csv_rows[] = $csv_row;
5379 5379
 
5380 5380
 		$images_count = 5;
5381
-        $xx=0;
5381
+		$xx=0;
5382 5382
 		foreach ( $posts as $post ) {$xx++;
5383 5383
 			$post_id = $post['ID'];
5384 5384
 			
@@ -5521,21 +5521,21 @@  discard block
 block discarded – undo
5521 5521
 			$csv_row[] = $post_info['post_zip']; // post_zip
5522 5522
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5523 5523
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5524
-            if ($neighbourhood_active) {
5525
-                $post_neighbourhood = '';
5526
-                $neighbourhood_latitude = '';
5527
-                $neighbourhood_longitude = '';
5528
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5529
-                    if (!empty($hood_info)) {
5530
-                        $post_neighbourhood = $hood_info->hood_name;
5531
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5532
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5533
-                    }
5534
-                }
5535
-                $csv_row[] = $post_neighbourhood; // post_neighbourhood
5536
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5537
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5538
-            }
5524
+			if ($neighbourhood_active) {
5525
+				$post_neighbourhood = '';
5526
+				$neighbourhood_latitude = '';
5527
+				$neighbourhood_longitude = '';
5528
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5529
+					if (!empty($hood_info)) {
5530
+						$post_neighbourhood = $hood_info->hood_name;
5531
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5532
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5533
+					}
5534
+				}
5535
+				$csv_row[] = $post_neighbourhood; // post_neighbourhood
5536
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5537
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5538
+			}
5539 5539
 			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
5540 5540
 			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
5541 5541
 			$csv_row[] = $post_info['geodir_email']; // geodir_email
@@ -5606,55 +5606,55 @@  discard block
 block discarded – undo
5606 5606
  * @return array Array of posts data.
5607 5607
  */
5608 5608
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5609
-    global $wpdb, $plugin_prefix;
5609
+	global $wpdb, $plugin_prefix;
5610 5610
 
5611
-    if ( ! post_type_exists( $post_type ) )
5612
-        return new stdClass;
5611
+	if ( ! post_type_exists( $post_type ) )
5612
+		return new stdClass;
5613 5613
         
5614
-    $table = $plugin_prefix . $post_type . '_detail';
5614
+	$table = $plugin_prefix . $post_type . '_detail';
5615 5615
 
5616
-    $limit = '';
5617
-    if ( $per_page > 0 && $page_no > 0 ) {
5618
-        $offset = ( $page_no - 1 ) * $per_page;
5616
+	$limit = '';
5617
+	if ( $per_page > 0 && $page_no > 0 ) {
5618
+		$offset = ( $page_no - 1 ) * $per_page;
5619 5619
         
5620
-        if ( $offset > 0 ) {
5621
-            $limit = " LIMIT " . $offset . "," . $per_page;
5622
-        } else {
5623
-            $limit = " LIMIT " . $per_page;
5624
-        }
5625
-    }
5620
+		if ( $offset > 0 ) {
5621
+			$limit = " LIMIT " . $offset . "," . $per_page;
5622
+		} else {
5623
+			$limit = " LIMIT " . $per_page;
5624
+		}
5625
+	}
5626 5626
 
5627
-    // Skip listing with statuses trash, auto-draft etc...
5628
-    $skip_statuses = geodir_imex_export_skip_statuses();
5629
-    $where_statuses = '';
5630
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5631
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5632
-    }
5627
+	// Skip listing with statuses trash, auto-draft etc...
5628
+	$skip_statuses = geodir_imex_export_skip_statuses();
5629
+	$where_statuses = '';
5630
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5631
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5632
+	}
5633
+
5634
+	$query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
5635
+	/**
5636
+	 * Modify returned posts SQL query for the current post type.
5637
+	 *
5638
+	 * @since 1.4.6
5639
+	 * @package GeoDirectory
5640
+	 *
5641
+	 * @param int $query The SQL query.
5642
+	 * @param string $post_type Post type.
5643
+	 */
5644
+	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5645
+
5646
+	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5633 5647
 
5634
-    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
5635
-    /**
5636
-     * Modify returned posts SQL query for the current post type.
5637
-     *
5638
-     * @since 1.4.6
5639
-     * @package GeoDirectory
5640
-     *
5641
-     * @param int $query The SQL query.
5642
-     * @param string $post_type Post type.
5643
-     */
5644
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5645
-
5646
-    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5647
-
5648
-    /**
5649
-     * Modify returned post results for the current post type.
5650
-     *
5651
-     * @since 1.4.6
5652
-     * @package GeoDirectory
5653
-     *
5654
-     * @param object $results An object containing all post ids.
5655
-     * @param string $post_type Post type.
5656
-     */
5657
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5648
+	/**
5649
+	 * Modify returned post results for the current post type.
5650
+	 *
5651
+	 * @since 1.4.6
5652
+	 * @package GeoDirectory
5653
+	 *
5654
+	 * @param object $results An object containing all post ids.
5655
+	 * @param string $post_type Post type.
5656
+	 */
5657
+	return apply_filters( 'geodir_export_posts', $results, $post_type );
5658 5658
 }
5659 5659
 
5660 5660
 /**
@@ -5672,23 +5672,23 @@  discard block
 block discarded – undo
5672 5672
  * @return string The SQL query.
5673 5673
  */
5674 5674
 function geodir_imex_get_events_query( $query, $post_type ) {
5675
-    if ( $post_type == 'gd_event' ) {
5676
-        global $wpdb, $plugin_prefix;
5675
+	if ( $post_type == 'gd_event' ) {
5676
+		global $wpdb, $plugin_prefix;
5677 5677
         
5678
-        $table = $plugin_prefix . $post_type . '_detail';
5679
-        $schedule_table = EVENT_SCHEDULE;
5678
+		$table = $plugin_prefix . $post_type . '_detail';
5679
+		$schedule_table = EVENT_SCHEDULE;
5680 5680
         
5681
-        // Skip listing with statuses trash, auto-draft etc...
5682
-        $skip_statuses = geodir_imex_export_skip_statuses();
5683
-        $where_statuses = '';
5684
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5685
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5686
-        }
5681
+		// Skip listing with statuses trash, auto-draft etc...
5682
+		$skip_statuses = geodir_imex_export_skip_statuses();
5683
+		$where_statuses = '';
5684
+		if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5685
+			$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5686
+		}
5687 5687
 
5688
-        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5689
-    }
5688
+		$query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5689
+	}
5690 5690
 
5691
-    return $query;
5691
+	return $query;
5692 5692
 }
5693 5693
 
5694 5694
 /**
@@ -5710,36 +5710,36 @@  discard block
 block discarded – undo
5710 5710
  * @return int Total terms count.
5711 5711
  */
5712 5712
 function geodir_get_terms_count( $post_type ) {
5713
-    $args = array( 'hide_empty' => 0 );
5713
+	$args = array( 'hide_empty' => 0 );
5714 5714
 
5715
-    remove_all_filters( 'get_terms' );
5715
+	remove_all_filters( 'get_terms' );
5716 5716
 
5717
-    $taxonomy = $post_type . 'category';
5717
+	$taxonomy = $post_type . 'category';
5718 5718
 
5719
-    // WPML
5720
-    $is_wpml = geodir_is_wpml();
5721
-    $active_lang = 'all';
5722
-    if ( $is_wpml ) {
5723
-        global $sitepress;
5724
-        $active_lang = $sitepress->get_current_language();
5719
+	// WPML
5720
+	$is_wpml = geodir_is_wpml();
5721
+	$active_lang = 'all';
5722
+	if ( $is_wpml ) {
5723
+		global $sitepress;
5724
+		$active_lang = $sitepress->get_current_language();
5725 5725
         
5726
-        if ( $active_lang != 'all' ) {
5727
-            $sitepress->switch_lang( 'all', true );
5728
-        }
5729
-    }
5730
-    // WPML
5726
+		if ( $active_lang != 'all' ) {
5727
+			$sitepress->switch_lang( 'all', true );
5728
+		}
5729
+	}
5730
+	// WPML
5731 5731
             
5732
-    $count_terms = wp_count_terms( $taxonomy, $args );
5732
+	$count_terms = wp_count_terms( $taxonomy, $args );
5733 5733
 
5734
-    // WPML
5735
-    if ( $is_wpml && $active_lang !== 'all' ) {
5736
-        global $sitepress;
5737
-        $sitepress->switch_lang( $active_lang, true );
5738
-    }
5739
-    // WPML
5740
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5734
+	// WPML
5735
+	if ( $is_wpml && $active_lang !== 'all' ) {
5736
+		global $sitepress;
5737
+		$sitepress->switch_lang( $active_lang, true );
5738
+	}
5739
+	// WPML
5740
+	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5741 5741
      
5742
-    return $count_terms;
5742
+	return $count_terms;
5743 5743
 }
5744 5744
 
5745 5745
 /**
@@ -5778,11 +5778,11 @@  discard block
 block discarded – undo
5778 5778
 		$csv_row[] = 'cat_posttype';
5779 5779
 		$csv_row[] = 'cat_parent';
5780 5780
 		$csv_row[] = 'cat_schema';
5781
-        // WPML
5781
+		// WPML
5782 5782
 		$is_wpml = geodir_is_wpml();
5783 5783
 		if ($is_wpml) {
5784 5784
 			$csv_row[] = 'cat_language';
5785
-            $csv_row[] = 'cat_id_original';
5785
+			$csv_row[] = 'cat_id_original';
5786 5786
 		}
5787 5787
 		// WPML
5788 5788
 		$csv_row[] = 'cat_description';
@@ -5812,10 +5812,10 @@  discard block
 block discarded – undo
5812 5812
 			$csv_row[] = $post_type;
5813 5813
 			$csv_row[] = $cat_parent;
5814 5814
 			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5815
-            // WPML
5815
+			// WPML
5816 5816
 			if ($is_wpml) {
5817 5817
 				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5818
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5818
+				$csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5819 5819
 			}
5820 5820
 			// WPML
5821 5821
 			$csv_row[] = $term->description;
@@ -6411,43 +6411,43 @@  discard block
 block discarded – undo
6411 6411
  * @param string $status Post status.
6412 6412
  */
6413 6413
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6414
-    global $wpdb, $current_user;
6415
-
6416
-    $option_value = get_option($option);
6417
-
6418
-    if ($option_value > 0) :
6419
-        if (get_post($option_value)) :
6420
-            // Page exists
6421
-            return;
6422
-        endif;
6423
-    endif;
6424
-
6425
-    $page_found = $wpdb->get_var(
6426
-        $wpdb->prepare(
6427
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6428
-            array($slug)
6429
-        )
6430
-    );
6431
-
6432
-    if ($page_found) :
6433
-        // Page exists
6434
-        if (!$option_value) update_option($option, $page_found);
6435
-        return;
6436
-    endif;
6437
-
6438
-    $page_data = array(
6439
-        'post_status' => $status,
6440
-        'post_type' => 'page',
6441
-        'post_author' => $current_user->ID,
6442
-        'post_name' => $slug,
6443
-        'post_title' => $page_title,
6444
-        'post_content' => $page_content,
6445
-        'post_parent' => $post_parent,
6446
-        'comment_status' => 'closed'
6447
-    );
6448
-    $page_id = wp_insert_post($page_data);
6449
-
6450
-    add_option($option, $page_id);
6414
+	global $wpdb, $current_user;
6415
+
6416
+	$option_value = get_option($option);
6417
+
6418
+	if ($option_value > 0) :
6419
+		if (get_post($option_value)) :
6420
+			// Page exists
6421
+			return;
6422
+		endif;
6423
+	endif;
6424
+
6425
+	$page_found = $wpdb->get_var(
6426
+		$wpdb->prepare(
6427
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6428
+			array($slug)
6429
+		)
6430
+	);
6431
+
6432
+	if ($page_found) :
6433
+		// Page exists
6434
+		if (!$option_value) update_option($option, $page_found);
6435
+		return;
6436
+	endif;
6437
+
6438
+	$page_data = array(
6439
+		'post_status' => $status,
6440
+		'post_type' => 'page',
6441
+		'post_author' => $current_user->ID,
6442
+		'post_name' => $slug,
6443
+		'post_title' => $page_title,
6444
+		'post_content' => $page_content,
6445
+		'post_parent' => $post_parent,
6446
+		'comment_status' => 'closed'
6447
+	);
6448
+	$page_id = wp_insert_post($page_data);
6449
+
6450
+	add_option($option, $page_id);
6451 6451
 
6452 6452
 }
6453 6453
 
@@ -6478,9 +6478,9 @@  discard block
 block discarded – undo
6478 6478
  * @package GeoDirectory
6479 6479
  */
6480 6480
 function geodir_admin_upgrade_notice() {
6481
-    $class = "error";
6482
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6483
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6481
+	$class = "error";
6482
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6483
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6484 6484
 }
6485 6485
 
6486 6486
 /**
@@ -6493,18 +6493,18 @@  discard block
 block discarded – undo
6493 6493
  */
6494 6494
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6495 6495
 {
6496
-    // readme contents
6497
-    $args = array(
6498
-        'timeout'     => 15,
6499
-        'redirection' => 5
6500
-    );
6501
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6502
-    $data       = wp_remote_get( $url, $args );
6496
+	// readme contents
6497
+	$args = array(
6498
+		'timeout'     => 15,
6499
+		'redirection' => 5
6500
+	);
6501
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6502
+	$data       = wp_remote_get( $url, $args );
6503 6503
 
6504
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6504
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6505 6505
 
6506
-        geodir_in_plugin_update_message($data['body']);
6507
-    }
6506
+		geodir_in_plugin_update_message($data['body']);
6507
+	}
6508 6508
 }
6509 6509
 
6510 6510
 
@@ -6512,28 +6512,28 @@  discard block
 block discarded – undo
6512 6512
 * @param string $content http response body
6513 6513
 */
6514 6514
 function geodir_in_plugin_update_message($content) {
6515
-    // Output Upgrade Notice
6516
-    $matches        = null;
6517
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6518
-    $upgrade_notice = '';
6519
-    if ( preg_match( $regexp, $content, $matches ) ) {
6520
-        if(empty($matches)){return;}
6521
-
6522
-        $version = trim( $matches[1] );
6523
-        if($version && $version>GEODIRECTORY_VERSION){
6524
-
6525
-
6526
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6527
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6528
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6529
-            foreach ( $notices as $index => $line ) {
6530
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6531
-            }
6532
-            $upgrade_notice .= '</div> ';
6533
-        }
6534
-        }
6535
-    }
6536
-    echo $upgrade_notice;
6515
+	// Output Upgrade Notice
6516
+	$matches        = null;
6517
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6518
+	$upgrade_notice = '';
6519
+	if ( preg_match( $regexp, $content, $matches ) ) {
6520
+		if(empty($matches)){return;}
6521
+
6522
+		$version = trim( $matches[1] );
6523
+		if($version && $version>GEODIRECTORY_VERSION){
6524
+
6525
+
6526
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6527
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6528
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6529
+			foreach ( $notices as $index => $line ) {
6530
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6531
+			}
6532
+			$upgrade_notice .= '</div> ';
6533
+		}
6534
+		}
6535
+	}
6536
+	echo $upgrade_notice;
6537 6537
 }
6538 6538
 
6539 6539
 /**
@@ -6566,19 +6566,19 @@  discard block
 block discarded – undo
6566 6566
  * @param array Listing statuses to be skipped.
6567 6567
  */
6568 6568
 function geodir_imex_export_skip_statuses() {
6569
-    $statuses = array( 'trash', 'auto-draft' );
6569
+	$statuses = array( 'trash', 'auto-draft' );
6570 6570
     
6571
-    /**
6572
-     * Filter the statuses to skip during GD export listings.
6573
-     *
6574
-     * @since 1.6.0
6575
-     * @package GeoDirectory
6576
-     *
6577
-     * @param array $statuses Listing statuses to be skipped.
6578
-     */
6579
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6571
+	/**
6572
+	 * Filter the statuses to skip during GD export listings.
6573
+	 *
6574
+	 * @since 1.6.0
6575
+	 * @package GeoDirectory
6576
+	 *
6577
+	 * @param array $statuses Listing statuses to be skipped.
6578
+	 */
6579
+	$statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6580 6580
      
6581
-    return $statuses;
6581
+	return $statuses;
6582 6582
 }
6583 6583
 
6584 6584
 /**
@@ -6590,15 +6590,15 @@  discard block
 block discarded – undo
6590 6590
  * @since 1.6.3
6591 6591
  */
6592 6592
 function geodir_admin_dequeue_scripts() {
6593
-    // EDD
6594
-    if (wp_script_is('jquery-chosen', 'enqueued')) {
6595
-        wp_dequeue_script('jquery-chosen');
6596
-    }
6593
+	// EDD
6594
+	if (wp_script_is('jquery-chosen', 'enqueued')) {
6595
+		wp_dequeue_script('jquery-chosen');
6596
+	}
6597 6597
     
6598
-    // Ultimate Addons for Visual Composer
6599
-    if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6600
-        wp_dequeue_script('ultimate-vc-backend-script');
6601
-    }
6598
+	// Ultimate Addons for Visual Composer
6599
+	if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6600
+		wp_dequeue_script('ultimate-vc-backend-script');
6601
+	}
6602 6602
 }
6603 6603
 
6604 6604
 /*
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/design_settings_array.php 1 patch
Indentation   +936 added lines, -936 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_post_type_setting_fun()
19 19
 {
20
-    $post_type_arr = array();
20
+	$post_type_arr = array();
21 21
 
22
-    $post_types = geodir_get_posttypes('object');
22
+	$post_types = geodir_get_posttypes('object');
23 23
 
24
-    foreach ($post_types as $key => $post_types_obj) {
25
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
-    }
27
-    return $post_type_arr;
24
+	foreach ($post_types as $key => $post_types_obj) {
25
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
+	}
27
+	return $post_type_arr;
28 28
 }
29 29
 
30 30
 /**
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_theme_location_setting_fun()
37 37
 {
38
-    $post_type_arr = array();
39
-    $geodir_all_nav_locations = get_registered_nav_menus();
40
-    $geodir_active_nav_locations = get_nav_menu_locations();
41
-    if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
-        foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
-            if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
-                $post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
-        }
46
-    }
47
-
48
-    return $post_type_arr;
38
+	$post_type_arr = array();
39
+	$geodir_all_nav_locations = get_registered_nav_menus();
40
+	$geodir_active_nav_locations = get_nav_menu_locations();
41
+	if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
+		foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
+			if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
+				$post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
+		}
46
+	}
47
+
48
+	return $post_type_arr;
49 49
 }
50 50
 /**
51 51
  * Filter GD design settings array.
@@ -55,543 +55,543 @@  discard block
 block discarded – undo
55 55
  */
56 56
 $geodir_settings['design_settings'] = apply_filters('geodir_design_settings', array(
57 57
 
58
-    /* Home Layout Settings start */
59
-    array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
58
+	/* Home Layout Settings start */
59
+	array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
60 60
 
61 61
 
62
-    array('name' => __('Home Top Section Settings', 'geodirectory'),
63
-        'type' => 'sectionstart',
64
-        'desc' => '',
65
-        'id' => 'geodir_home_top_section'),
62
+	array('name' => __('Home Top Section Settings', 'geodirectory'),
63
+		'type' => 'sectionstart',
64
+		'desc' => '',
65
+		'id' => 'geodir_home_top_section'),
66 66
 
67
-    array(
68
-        'name' => __('Geodirectory home page', 'geodirectory'),
69
-        'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
-        'id' => 'geodir_set_as_home',
71
-        'type' => 'checkbox',
72
-        'std' => '0' // Default value to show home top section
73
-    ),
67
+	array(
68
+		'name' => __('Geodirectory home page', 'geodirectory'),
69
+		'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
+		'id' => 'geodir_set_as_home',
71
+		'type' => 'checkbox',
72
+		'std' => '0' // Default value to show home top section
73
+	),
74 74
 
75
-    array(
76
-        'name' => __('Home top section', 'geodirectory'),
77
-        'desc' => __('Show the top section of home page', 'geodirectory'),
78
-        'id' => 'geodir_show_home_top_section',
79
-        'type' => 'checkbox',
80
-        'std' => '1' // Default value to show home top section
81
-    ),
75
+	array(
76
+		'name' => __('Home top section', 'geodirectory'),
77
+		'desc' => __('Show the top section of home page', 'geodirectory'),
78
+		'id' => 'geodir_show_home_top_section',
79
+		'type' => 'checkbox',
80
+		'std' => '1' // Default value to show home top section
81
+	),
82 82
 
83 83
 
84
-    array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
84
+	array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
85 85
 
86 86
 
87
-    array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
-        'type' => 'sectionstart',
89
-        'desc' => '',
90
-        'id' => 'geodir_home_layout'),
87
+	array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
+		'type' => 'sectionstart',
89
+		'desc' => '',
90
+		'id' => 'geodir_home_layout'),
91 91
 
92
-    array(
93
-        'name' => __('Home right section', 'geodirectory'),
94
-        'desc' => __('Show the right section of home page', 'geodirectory'),
95
-        'id' => 'geodir_show_home_right_section',
96
-        'type' => 'checkbox',
97
-        'std' => '1' // Default value to show home top section
98
-    ),
92
+	array(
93
+		'name' => __('Home right section', 'geodirectory'),
94
+		'desc' => __('Show the right section of home page', 'geodirectory'),
95
+		'id' => 'geodir_show_home_right_section',
96
+		'type' => 'checkbox',
97
+		'std' => '1' // Default value to show home top section
98
+	),
99 99
 
100
-    array(
101
-        'name' => __('Width of home right section', 'geodirectory'),
102
-        'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
-        'id' => 'geodir_width_home_right_section',
104
-        'type' => 'text',
105
-        'css' => 'min-width:300px;',
106
-        'std' => '30' // Default value to show home top section
107
-    ),
100
+	array(
101
+		'name' => __('Width of home right section', 'geodirectory'),
102
+		'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
+		'id' => 'geodir_width_home_right_section',
104
+		'type' => 'text',
105
+		'css' => 'min-width:300px;',
106
+		'std' => '30' // Default value to show home top section
107
+	),
108 108
 
109
-    array(
110
-        'name' => __('Home content section', 'geodirectory'),
111
-        'desc' => __('Show the content section of home page', 'geodirectory'),
112
-        'id' => 'geodir_show_home_contant_section',
113
-        'type' => 'checkbox',
114
-        'std' => '1' // Default value to show home top section
115
-    ),
109
+	array(
110
+		'name' => __('Home content section', 'geodirectory'),
111
+		'desc' => __('Show the content section of home page', 'geodirectory'),
112
+		'id' => 'geodir_show_home_contant_section',
113
+		'type' => 'checkbox',
114
+		'std' => '1' // Default value to show home top section
115
+	),
116 116
 
117
-    array(
118
-        'name' => __('Width of home content section', 'geodirectory'),
119
-        'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
-        'id' => 'geodir_width_home_contant_section',
121
-        'type' => 'text',
122
-        'css' => 'min-width:300px;',
123
-        'std' => '63' // Default value to show home top section
124
-    ),
117
+	array(
118
+		'name' => __('Width of home content section', 'geodirectory'),
119
+		'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
+		'id' => 'geodir_width_home_contant_section',
121
+		'type' => 'text',
122
+		'css' => 'min-width:300px;',
123
+		'std' => '63' // Default value to show home top section
124
+	),
125 125
 
126
-    array(
127
-        'name' => __('Home left section', 'geodirectory'),
128
-        'desc' => __('Show the left section of home page', 'geodirectory'),
129
-        'id' => 'geodir_show_home_left_section',
130
-        'type' => 'checkbox',
131
-        'std' => '0' // Default value to show home top section
132
-    ),
126
+	array(
127
+		'name' => __('Home left section', 'geodirectory'),
128
+		'desc' => __('Show the left section of home page', 'geodirectory'),
129
+		'id' => 'geodir_show_home_left_section',
130
+		'type' => 'checkbox',
131
+		'std' => '0' // Default value to show home top section
132
+	),
133 133
 
134
-    array(
135
-        'name' => __('Width of home left section', 'geodirectory'),
136
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
-        'id' => 'geodir_width_home_left_section',
138
-        'type' => 'text',
139
-        'css' => 'min-width:300px;',
140
-        'std' => '30' // Default value to show home top section
141
-    ),
134
+	array(
135
+		'name' => __('Width of home left section', 'geodirectory'),
136
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
+		'id' => 'geodir_width_home_left_section',
138
+		'type' => 'text',
139
+		'css' => 'min-width:300px;',
140
+		'std' => '30' // Default value to show home top section
141
+	),
142 142
 
143
-    array(
144
-        'name' => __('Home bottom section', 'geodirectory'),
145
-        'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
-        'id' => 'geodir_show_home_bottom_section',
147
-        'type' => 'checkbox',
148
-        'std' => '0' // Default value to show home top section
149
-    ),
150
-    array(
151
-        'name' => __('Resize image large size', 'geodirectory'),
152
-        'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
-        'id' => 'geodir_use_wp_media_large_size',
154
-        'type' => 'checkbox',
155
-        'std' => '0'
156
-    ),
143
+	array(
144
+		'name' => __('Home bottom section', 'geodirectory'),
145
+		'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
+		'id' => 'geodir_show_home_bottom_section',
147
+		'type' => 'checkbox',
148
+		'std' => '0' // Default value to show home top section
149
+	),
150
+	array(
151
+		'name' => __('Resize image large size', 'geodirectory'),
152
+		'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
+		'id' => 'geodir_use_wp_media_large_size',
154
+		'type' => 'checkbox',
155
+		'std' => '0'
156
+	),
157 157
 
158
-    array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
158
+	array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
159 159
 
160 160
 
161
-    /* Home Layout Settings end */
161
+	/* Home Layout Settings end */
162 162
 
163 163
 
164
-    /* Listing Layout Settings end */
164
+	/* Listing Layout Settings end */
165 165
 
166
-    array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
166
+	array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
167 167
 
168 168
 
169
-    array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
-        'type' => 'sectionstart',
171
-        'desc' => '',
172
-        'id' => 'geodir_listing_layout'),
169
+	array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
+		'type' => 'sectionstart',
171
+		'desc' => '',
172
+		'id' => 'geodir_listing_layout'),
173 173
 
174
-    array(
175
-        'name' => __('Listing top section', 'geodirectory'),
176
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
177
-        'id' => 'geodir_show_listing_top_section',
178
-        'type' => 'checkbox',
179
-        'std' => '1' // Default value to show home top section
180
-    ),
174
+	array(
175
+		'name' => __('Listing top section', 'geodirectory'),
176
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
177
+		'id' => 'geodir_show_listing_top_section',
178
+		'type' => 'checkbox',
179
+		'std' => '1' // Default value to show home top section
180
+	),
181 181
 
182
-    array(
183
-        'name' => __('Listing right section', 'geodirectory'),
184
-        'desc' => __('Show the right section of listing page', 'geodirectory'),
185
-        'id' => 'geodir_show_listing_right_section',
186
-        'type' => 'checkbox',
187
-        'std' => '1' // Default value to show home top section
188
-    ),
182
+	array(
183
+		'name' => __('Listing right section', 'geodirectory'),
184
+		'desc' => __('Show the right section of listing page', 'geodirectory'),
185
+		'id' => 'geodir_show_listing_right_section',
186
+		'type' => 'checkbox',
187
+		'std' => '1' // Default value to show home top section
188
+	),
189 189
 
190
-    array(
191
-        'name' => __('Width of listing right section', 'geodirectory'),
192
-        'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
-        'id' => 'geodir_width_listing_right_section',
194
-        'type' => 'text',
195
-        'css' => 'min-width:300px;',
196
-        'std' => '30' // Default value to show home top section
197
-    ),
190
+	array(
191
+		'name' => __('Width of listing right section', 'geodirectory'),
192
+		'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
+		'id' => 'geodir_width_listing_right_section',
194
+		'type' => 'text',
195
+		'css' => 'min-width:300px;',
196
+		'std' => '30' // Default value to show home top section
197
+	),
198 198
 
199 199
 
200
-    array(
201
-        'name' => __('Listing content section view', 'geodirectory'),
202
-        'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
-        'id' => 'geodir_listing_view',
204
-        'css' => 'min-width:300px;',
205
-        'std' => 'gridview_onehalf',
206
-        'type' => 'select',
207
-        'class' => 'chosen_select',
208
-        'options' => array_unique(array(
209
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
-            'listview' => __('List view', 'geodirectory'),
214
-        ))
215
-    ),
200
+	array(
201
+		'name' => __('Listing content section view', 'geodirectory'),
202
+		'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
+		'id' => 'geodir_listing_view',
204
+		'css' => 'min-width:300px;',
205
+		'std' => 'gridview_onehalf',
206
+		'type' => 'select',
207
+		'class' => 'chosen_select',
208
+		'options' => array_unique(array(
209
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
+			'listview' => __('List view', 'geodirectory'),
214
+		))
215
+	),
216 216
 
217
-    array(
218
-        'name' => __('Width of listing content section', 'geodirectory'),
219
-        'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
-        'id' => 'geodir_width_listing_contant_section',
221
-        'type' => 'text',
222
-        'css' => 'min-width:300px;',
223
-        'std' => '63' // Default value to show home top section
224
-    ),
217
+	array(
218
+		'name' => __('Width of listing content section', 'geodirectory'),
219
+		'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
+		'id' => 'geodir_width_listing_contant_section',
221
+		'type' => 'text',
222
+		'css' => 'min-width:300px;',
223
+		'std' => '63' // Default value to show home top section
224
+	),
225 225
 
226
-    array(
227
-        'name' => __('Listing left section', 'geodirectory'),
228
-        'desc' => __('Show the left section of listing page', 'geodirectory'),
229
-        'id' => 'geodir_show_listing_left_section',
230
-        'type' => 'checkbox',
231
-        'std' => '0' // Default value to show home top section
232
-    ),
226
+	array(
227
+		'name' => __('Listing left section', 'geodirectory'),
228
+		'desc' => __('Show the left section of listing page', 'geodirectory'),
229
+		'id' => 'geodir_show_listing_left_section',
230
+		'type' => 'checkbox',
231
+		'std' => '0' // Default value to show home top section
232
+	),
233 233
 
234
-    array(
235
-        'name' => __('Width of listing left section', 'geodirectory'),
236
-        'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
-        'id' => 'geodir_width_listing_left_section',
238
-        'type' => 'text',
239
-        'css' => 'min-width:300px;',
240
-        'std' => '30' // Default value to show home top section
241
-    ),
234
+	array(
235
+		'name' => __('Width of listing left section', 'geodirectory'),
236
+		'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
+		'id' => 'geodir_width_listing_left_section',
238
+		'type' => 'text',
239
+		'css' => 'min-width:300px;',
240
+		'std' => '30' // Default value to show home top section
241
+	),
242 242
 
243
-    array(
244
-        'name' => __('Listing bottom section', 'geodirectory'),
245
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
-        'id' => 'geodir_show_listing_bottom_section',
247
-        'type' => 'checkbox',
248
-        'std' => '0' // Default value to show home top section
249
-    ),
243
+	array(
244
+		'name' => __('Listing bottom section', 'geodirectory'),
245
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
+		'id' => 'geodir_show_listing_bottom_section',
247
+		'type' => 'checkbox',
248
+		'std' => '0' // Default value to show home top section
249
+	),
250 250
 
251
-    array(
252
-        'name' => __('Upload listing no image', 'geodirectory'),
253
-        'desc' => '',
254
-        'id' => 'geodir_listing_no_img',
255
-        'type' => 'file',
256
-        'std' => '0' // Default value to show home top section
257
-    ),
251
+	array(
252
+		'name' => __('Upload listing no image', 'geodirectory'),
253
+		'desc' => '',
254
+		'id' => 'geodir_listing_no_img',
255
+		'type' => 'file',
256
+		'std' => '0' // Default value to show home top section
257
+	),
258 258
 
259
-    array(
260
-        'name' => __('Description word limit', 'geodirectory'),
261
-        'desc' => '',
262
-        'id' => 'geodir_desc_word_limit',
263
-        'type' => 'text',
264
-        'css' => 'min-width:300px;',
265
-        'std' => '50' // Default value to show home top section
266
-    ),
259
+	array(
260
+		'name' => __('Description word limit', 'geodirectory'),
261
+		'desc' => '',
262
+		'id' => 'geodir_desc_word_limit',
263
+		'type' => 'text',
264
+		'css' => 'min-width:300px;',
265
+		'std' => '50' // Default value to show home top section
266
+	),
267 267
 
268
-    array(
269
-        'name' => __('Hover listing map animation', 'geodirectory'),
270
-        'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
271
-        'id' => 'geodir_listing_hover_bounce_map_pin',
272
-        'type' => 'checkbox',
273
-        'std' => '1' // Default value to show home top section
274
-    ),
268
+	array(
269
+		'name' => __('Hover listing map animation', 'geodirectory'),
270
+		'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
271
+		'id' => 'geodir_listing_hover_bounce_map_pin',
272
+		'type' => 'checkbox',
273
+		'std' => '1' // Default value to show home top section
274
+	),
275 275
 
276
-    array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
276
+	array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
277 277
 
278 278
 
279
-    array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
279
+	array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
280 280
 
281
-    array(
282
-        'name' => __('New listing default status', 'geodirectory'),
283
-        'desc' => __('Select new listing default status.', 'geodirectory'),
284
-        'tip' => '',
285
-        'id' => 'geodir_new_post_default_status',
286
-        'css' => 'min-width:300px;',
287
-        'std' => 'publish',
288
-        'type' => 'select',
289
-        'class' => 'chosen_select',
290
-        'options' => array_unique(array(
291
-            'publish' => __('publish', 'geodirectory'),
292
-            'draft' => __('draft', 'geodirectory'),
293
-        ))
294
-    ),
281
+	array(
282
+		'name' => __('New listing default status', 'geodirectory'),
283
+		'desc' => __('Select new listing default status.', 'geodirectory'),
284
+		'tip' => '',
285
+		'id' => 'geodir_new_post_default_status',
286
+		'css' => 'min-width:300px;',
287
+		'std' => 'publish',
288
+		'type' => 'select',
289
+		'class' => 'chosen_select',
290
+		'options' => array_unique(array(
291
+			'publish' => __('publish', 'geodirectory'),
292
+			'draft' => __('draft', 'geodirectory'),
293
+		))
294
+	),
295 295
 
296
-    array(
297
-        'name' => __('New listings settings', 'geodirectory'),
298
-        'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
299
-        'id' => 'geodir_listing_new_days',
300
-        'type' => 'text',
301
-        'css' => 'min-width:300px;',
302
-        'std' => '30' // Default value for the page title - changed in settings
303
-    ),
296
+	array(
297
+		'name' => __('New listings settings', 'geodirectory'),
298
+		'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
299
+		'id' => 'geodir_listing_new_days',
300
+		'type' => 'text',
301
+		'css' => 'min-width:300px;',
302
+		'std' => '30' // Default value for the page title - changed in settings
303
+	),
304 304
 
305
-    array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
305
+	array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
306 306
 
307 307
 
308
-    array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
308
+	array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
309 309
 
310
-    array(
311
-        'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
312
-        'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
313
-        'id' => 'geodir_accept_term_condition',
314
-        'type' => 'checkbox',
315
-        'std' => '1' // Default value to show home top section
316
-    ),
310
+	array(
311
+		'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
312
+		'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
313
+		'id' => 'geodir_accept_term_condition',
314
+		'type' => 'checkbox',
315
+		'std' => '1' // Default value to show home top section
316
+	),
317 317
 
318 318
 
319
-    array(
320
-        'name' => __('Show description field as editor', 'geodirectory'),
321
-        'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
322
-        'tip' => '',
323
-        'id' => 'geodir_tiny_editor_on_add_listing',
324
-        'css' => 'min-width:300px;',
325
-        'std' => array(),
326
-        'type' => 'multiselect',
327
-        'placeholder_text' => __('Select post types', 'geodirectory'),
328
-        'class' => 'chosen_select',
329
-        'options' => array_unique(geodir_post_type_setting_fun())
330
-    ),
319
+	array(
320
+		'name' => __('Show description field as editor', 'geodirectory'),
321
+		'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
322
+		'tip' => '',
323
+		'id' => 'geodir_tiny_editor_on_add_listing',
324
+		'css' => 'min-width:300px;',
325
+		'std' => array(),
326
+		'type' => 'multiselect',
327
+		'placeholder_text' => __('Select post types', 'geodirectory'),
328
+		'class' => 'chosen_select',
329
+		'options' => array_unique(geodir_post_type_setting_fun())
330
+	),
331 331
 
332
-    array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
333
-    /* Listing Layout Settings end */
332
+	array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
333
+	/* Listing Layout Settings end */
334 334
 
335 335
 
336
-    /* Search Layout Settings end */
336
+	/* Search Layout Settings end */
337 337
 
338
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
338
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
339 339
 
340 340
 
341
-    array('name' => __('Search Page Layout Settings', 'geodirectory'),
342
-        'type' => 'sectionstart',
343
-        'desc' => '',
344
-        'id' => 'geodir_search_layout'),
341
+	array('name' => __('Search Page Layout Settings', 'geodirectory'),
342
+		'type' => 'sectionstart',
343
+		'desc' => '',
344
+		'id' => 'geodir_search_layout'),
345 345
 
346
-    array(
347
-        'name' => __('Search top section', 'geodirectory'),
348
-        'desc' => __('Show the top section of search page', 'geodirectory'),
349
-        'id' => 'geodir_show_search_top_section',
350
-        'type' => 'checkbox',
351
-        'std' => '1' // Default value to show home top section
352
-    ),
346
+	array(
347
+		'name' => __('Search top section', 'geodirectory'),
348
+		'desc' => __('Show the top section of search page', 'geodirectory'),
349
+		'id' => 'geodir_show_search_top_section',
350
+		'type' => 'checkbox',
351
+		'std' => '1' // Default value to show home top section
352
+	),
353 353
 
354
-    array(
355
-        'name' => __('Search right section', 'geodirectory'),
356
-        'desc' => __('Show the right section of search page', 'geodirectory'),
357
-        'id' => 'geodir_show_search_right_section',
358
-        'type' => 'checkbox',
359
-        'std' => '1' // Default value to show home top section
360
-    ),
354
+	array(
355
+		'name' => __('Search right section', 'geodirectory'),
356
+		'desc' => __('Show the right section of search page', 'geodirectory'),
357
+		'id' => 'geodir_show_search_right_section',
358
+		'type' => 'checkbox',
359
+		'std' => '1' // Default value to show home top section
360
+	),
361 361
 
362
-    array(
363
-        'name' => __('Width of search right section', 'geodirectory'),
364
-        'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
365
-        'id' => 'geodir_width_search_right_section',
366
-        'type' => 'text',
367
-        'css' => 'min-width:300px;',
368
-        'std' => '30' // Default value to show home top section
369
-    ),
362
+	array(
363
+		'name' => __('Width of search right section', 'geodirectory'),
364
+		'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
365
+		'id' => 'geodir_width_search_right_section',
366
+		'type' => 'text',
367
+		'css' => 'min-width:300px;',
368
+		'std' => '30' // Default value to show home top section
369
+	),
370 370
 
371 371
 
372
-    array(
373
-        'name' => __('Search content section view', 'geodirectory'),
374
-        'desc' => __('Set the listing view of search page', 'geodirectory'),
375
-        'id' => 'geodir_search_view',
376
-        'css' => 'min-width:300px;',
377
-        'std' => 'gridview_onehalf',
378
-        'type' => 'select',
379
-        'class' => 'chosen_select',
380
-        'options' => array_unique(array(
381
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
382
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
383
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
384
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
385
-            'listview' => __('List view', 'geodirectory'),
386
-        ))
387
-    ),
372
+	array(
373
+		'name' => __('Search content section view', 'geodirectory'),
374
+		'desc' => __('Set the listing view of search page', 'geodirectory'),
375
+		'id' => 'geodir_search_view',
376
+		'css' => 'min-width:300px;',
377
+		'std' => 'gridview_onehalf',
378
+		'type' => 'select',
379
+		'class' => 'chosen_select',
380
+		'options' => array_unique(array(
381
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
382
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
383
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
384
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
385
+			'listview' => __('List view', 'geodirectory'),
386
+		))
387
+	),
388 388
 
389
-    array(
390
-        'name' => __('Width of search content section', 'geodirectory'),
391
-        'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
392
-        'id' => 'geodir_width_search_contant_section',
393
-        'type' => 'text',
394
-        'css' => 'min-width:300px;',
395
-        'std' => '63' // Default value to show home top section
396
-    ),
389
+	array(
390
+		'name' => __('Width of search content section', 'geodirectory'),
391
+		'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
392
+		'id' => 'geodir_width_search_contant_section',
393
+		'type' => 'text',
394
+		'css' => 'min-width:300px;',
395
+		'std' => '63' // Default value to show home top section
396
+	),
397 397
 
398
-    array(
399
-        'name' => __('Search left section', 'geodirectory'),
400
-        'desc' => __('Show the left section of search page', 'geodirectory'),
401
-        'id' => 'geodir_show_search_left_section',
402
-        'type' => 'checkbox',
403
-        'std' => '0' // Default value to show home top section
404
-    ),
398
+	array(
399
+		'name' => __('Search left section', 'geodirectory'),
400
+		'desc' => __('Show the left section of search page', 'geodirectory'),
401
+		'id' => 'geodir_show_search_left_section',
402
+		'type' => 'checkbox',
403
+		'std' => '0' // Default value to show home top section
404
+	),
405 405
 
406
-    array(
407
-        'name' => __('Width of search left section', 'geodirectory'),
408
-        'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
409
-        'id' => 'geodir_width_search_left_section',
410
-        'type' => 'text',
411
-        'css' => 'min-width:300px;',
412
-        'std' => '30' // Default value to show home top section
413
-    ),
406
+	array(
407
+		'name' => __('Width of search left section', 'geodirectory'),
408
+		'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
409
+		'id' => 'geodir_width_search_left_section',
410
+		'type' => 'text',
411
+		'css' => 'min-width:300px;',
412
+		'std' => '30' // Default value to show home top section
413
+	),
414 414
 
415
-    array(
416
-        'name' => __('Search bottom section', 'geodirectory'),
417
-        'desc' => __('Show the bottom section of search page', 'geodirectory'),
418
-        'id' => 'geodir_show_search_bottom_section',
419
-        'type' => 'checkbox',
420
-        'std' => '0' // Default value to show home top section
421
-    ),
415
+	array(
416
+		'name' => __('Search bottom section', 'geodirectory'),
417
+		'desc' => __('Show the bottom section of search page', 'geodirectory'),
418
+		'id' => 'geodir_show_search_bottom_section',
419
+		'type' => 'checkbox',
420
+		'std' => '0' // Default value to show home top section
421
+	),
422 422
 	
423 423
 	array(
424
-        'name' => __('Show advanced pagination details', 'geodirectory'),
425
-        'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
426
-        'id' => 'geodir_pagination_advance_info',
427
-        'css' => 'min-width:300px;',
428
-        'std' => '',
429
-        'type' => 'select',
430
-        'class' => 'chosen_select',
431
-        'options' => array(
424
+		'name' => __('Show advanced pagination details', 'geodirectory'),
425
+		'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
426
+		'id' => 'geodir_pagination_advance_info',
427
+		'css' => 'min-width:300px;',
428
+		'std' => '',
429
+		'type' => 'select',
430
+		'class' => 'chosen_select',
431
+		'options' => array(
432 432
 						'' => __('Never Display', 'geodirectory'),
433 433
 						'after' => __('After Pagination', 'geodirectory'),
434 434
 						'before' => __('Before Pagination', 'geodirectory')
435 435
 					)
436
-    ),
436
+	),
437 437
 
438
-    array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
438
+	array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
439 439
 
440 440
 
441
-    array('name' => __('Search form default text settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
441
+	array('name' => __('Search form default text settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
442 442
 
443
-    array(
444
-        'name' => __('Search field default value', 'geodirectory'),
445
-        'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
446
-        'id' => 'geodir_search_field_default_text',
447
-        'type' => 'text',
448
-        'css' => 'min-width:300px;',
449
-        'std' => 'Search for' // show on the listing page.
450
-    ),
443
+	array(
444
+		'name' => __('Search field default value', 'geodirectory'),
445
+		'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
446
+		'id' => 'geodir_search_field_default_text',
447
+		'type' => 'text',
448
+		'css' => 'min-width:300px;',
449
+		'std' => 'Search for' // show on the listing page.
450
+	),
451 451
 
452
-    array(
453
-        'name' => __('Near field default value', 'geodirectory'),
454
-        'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
455
-        'id' => 'geodir_near_field_default_text',
456
-        'type' => 'text',
457
-        'css' => 'min-width:300px;',
458
-        'std' => 'Near' // show on the listing page.
459
-    ),
452
+	array(
453
+		'name' => __('Near field default value', 'geodirectory'),
454
+		'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
455
+		'id' => 'geodir_near_field_default_text',
456
+		'type' => 'text',
457
+		'css' => 'min-width:300px;',
458
+		'std' => 'Near' // show on the listing page.
459
+	),
460 460
 
461
-    array(
462
-        'name' => __('Search button label', 'geodirectory'),
463
-        'desc' => __('Show the search button label on search form.', 'geodirectory'),
464
-        'id' => 'geodir_search_button_label',
465
-        'type' => 'text',
466
-        'css' => 'min-width:300px;',
467
-        'std' => 'Search' // show on the listing page.
468
-    ),
461
+	array(
462
+		'name' => __('Search button label', 'geodirectory'),
463
+		'desc' => __('Show the search button label on search form.', 'geodirectory'),
464
+		'id' => 'geodir_search_button_label',
465
+		'type' => 'text',
466
+		'css' => 'min-width:300px;',
467
+		'std' => 'Search' // show on the listing page.
468
+	),
469 469
 
470
-    array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
470
+	array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
471 471
 
472
-    /* Listing Layout Settings end */
472
+	/* Listing Layout Settings end */
473 473
 
474 474
 
475
-    /* Detail Layout Settings end */
475
+	/* Detail Layout Settings end */
476 476
 
477
-    array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
477
+	array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
478 478
 
479
-    array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
479
+	array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
480 480
 
481
-    array(
482
-        'name' => __('Detail top section', 'geodirectory'),
483
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
484
-        'id' => 'geodir_show_detail_top_section',
485
-        'type' => 'checkbox',
486
-        'std' => '1' // Default value to show home top section
487
-    ),
481
+	array(
482
+		'name' => __('Detail top section', 'geodirectory'),
483
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
484
+		'id' => 'geodir_show_detail_top_section',
485
+		'type' => 'checkbox',
486
+		'std' => '1' // Default value to show home top section
487
+	),
488 488
 
489
-    array(
490
-        'name' => __('Detail bottom section', 'geodirectory'),
491
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
492
-        'id' => 'geodir_show_detail_bottom_section',
493
-        'type' => 'checkbox',
494
-        'std' => '1' // Default value to show home top section
495
-    ),
496
-    array(
497
-        'name' => __('Detail sidebar section on left side', 'geodirectory'),
498
-        'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
499
-        'id' => 'geodir_detail_sidebar_left_section',
500
-        'type' => 'checkbox',
501
-        'std' => '0'
502
-    ),
503
-    array(
504
-        'name' => __('Disable GD modal', 'geodirectory'),
505
-        'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
506
-        'id' => 'geodir_disable_gb_modal',
507
-        'type' => 'checkbox',
508
-        'std' => '0'
509
-    ),
510
-    array(
511
-        'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
512
-        'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
513
-        'id' => 'geodir_disable_tfg_buttons_section',
514
-        'type' => 'checkbox',
515
-        'std' => '0'
516
-    ),
517
-    array(
518
-        'name' => __('Disable share this button section', 'geodirectory'),
519
-        'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
520
-        'id' => 'geodir_disable_sharethis_button_section',
521
-        'type' => 'checkbox',
522
-        'std' => '0'
523
-    ),
524
-    array(
525
-        'name' => __('Disable Google Analytics section', 'geodirectory'),
526
-        'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
527
-        'id' => 'geodir_disable_google_analytics_section',
528
-        'type' => 'checkbox',
529
-        'std' => '0'
530
-    ),
531
-    array(
532
-        'name' => __('Disable User Links section', 'geodirectory'),
533
-        'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
534
-        'id' => 'geodir_disable_user_links_section',
535
-        'type' => 'checkbox',
536
-        'std' => '0'
537
-    ),
538
-    array(
539
-        'name' => __('Disable Rating Info section', 'geodirectory'),
540
-        'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
541
-        'id' => 'geodir_disable_rating_info_section',
542
-        'type' => 'checkbox',
543
-        'std' => '0'
544
-    ),
545
-    array(
546
-        'name' => __('Disable Listing Info section', 'geodirectory'),
547
-        'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
548
-        'id' => 'geodir_disable_listing_info_section',
549
-        'type' => 'checkbox',
550
-        'std' => '0'
551
-    ),
489
+	array(
490
+		'name' => __('Detail bottom section', 'geodirectory'),
491
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
492
+		'id' => 'geodir_show_detail_bottom_section',
493
+		'type' => 'checkbox',
494
+		'std' => '1' // Default value to show home top section
495
+	),
496
+	array(
497
+		'name' => __('Detail sidebar section on left side', 'geodirectory'),
498
+		'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
499
+		'id' => 'geodir_detail_sidebar_left_section',
500
+		'type' => 'checkbox',
501
+		'std' => '0'
502
+	),
503
+	array(
504
+		'name' => __('Disable GD modal', 'geodirectory'),
505
+		'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
506
+		'id' => 'geodir_disable_gb_modal',
507
+		'type' => 'checkbox',
508
+		'std' => '0'
509
+	),
510
+	array(
511
+		'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
512
+		'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
513
+		'id' => 'geodir_disable_tfg_buttons_section',
514
+		'type' => 'checkbox',
515
+		'std' => '0'
516
+	),
517
+	array(
518
+		'name' => __('Disable share this button section', 'geodirectory'),
519
+		'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
520
+		'id' => 'geodir_disable_sharethis_button_section',
521
+		'type' => 'checkbox',
522
+		'std' => '0'
523
+	),
524
+	array(
525
+		'name' => __('Disable Google Analytics section', 'geodirectory'),
526
+		'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
527
+		'id' => 'geodir_disable_google_analytics_section',
528
+		'type' => 'checkbox',
529
+		'std' => '0'
530
+	),
531
+	array(
532
+		'name' => __('Disable User Links section', 'geodirectory'),
533
+		'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
534
+		'id' => 'geodir_disable_user_links_section',
535
+		'type' => 'checkbox',
536
+		'std' => '0'
537
+	),
538
+	array(
539
+		'name' => __('Disable Rating Info section', 'geodirectory'),
540
+		'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
541
+		'id' => 'geodir_disable_rating_info_section',
542
+		'type' => 'checkbox',
543
+		'std' => '0'
544
+	),
545
+	array(
546
+		'name' => __('Disable Listing Info section', 'geodirectory'),
547
+		'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
548
+		'id' => 'geodir_disable_listing_info_section',
549
+		'type' => 'checkbox',
550
+		'std' => '0'
551
+	),
552 552
 
553
-    array('type' => 'sectionend', 'id' => 'detail_page_settings'),
553
+	array('type' => 'sectionend', 'id' => 'detail_page_settings'),
554 554
 
555 555
 
556
-    /* ---------- DETAIL PAGE TAB SETTING START*/
556
+	/* ---------- DETAIL PAGE TAB SETTING START*/
557 557
 
558
-    array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
558
+	array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
559 559
 
560
-    array(
561
-        'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
562
-        'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
563
-        'tip' => '',
564
-        'id' => 'geodir_detail_page_tabs_excluded',
565
-        'css' => 'min-width:300px;',
566
-        'std' => geodir_get_posttypes(),
567
-        'type' => 'multiselect',
568
-        'placeholder_text' => __('Select tabs', 'geodirectory'),
569
-        'class' => 'chosen_select',
570
-        'options' => array_unique(geodir_detail_page_tabs_key_value_array())
571
-    ),
560
+	array(
561
+		'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
562
+		'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
563
+		'tip' => '',
564
+		'id' => 'geodir_detail_page_tabs_excluded',
565
+		'css' => 'min-width:300px;',
566
+		'std' => geodir_get_posttypes(),
567
+		'type' => 'multiselect',
568
+		'placeholder_text' => __('Select tabs', 'geodirectory'),
569
+		'class' => 'chosen_select',
570
+		'options' => array_unique(geodir_detail_page_tabs_key_value_array())
571
+	),
572 572
     
573
-    array(
574
-        'name' => __('Show as list', 'geodirectory'),
575
-        'desc' => __('Show as list instead of tabs', 'geodirectory'),
576
-        'id' => 'geodir_disable_tabs',
577
-        'type' => 'checkbox',
578
-        'std' => '0'
579
-    ),
573
+	array(
574
+		'name' => __('Show as list', 'geodirectory'),
575
+		'desc' => __('Show as list instead of tabs', 'geodirectory'),
576
+		'id' => 'geodir_disable_tabs',
577
+		'type' => 'checkbox',
578
+		'std' => '0'
579
+	),
580 580
 
581
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
582
-    /* ---------- DETAIL PAGE TAB SETTING END*/
581
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
582
+	/* ---------- DETAIL PAGE TAB SETTING END*/
583 583
 
584
-    /* START DEFAULT STAR IMAGE*/
585
-    array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
584
+	/* START DEFAULT STAR IMAGE*/
585
+	array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
586 586
 
587
-    array(
588
-        'name' => __('Upload default rating star icon', 'geodirectory'),
589
-        'desc' => '',
590
-        'id' => 'geodir_default_rating_star_icon',
591
-        'type' => 'file',
592
-        'std' => '0',
593
-        'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
594
-    ),
587
+	array(
588
+		'name' => __('Upload default rating star icon', 'geodirectory'),
589
+		'desc' => '',
590
+		'id' => 'geodir_default_rating_star_icon',
591
+		'type' => 'file',
592
+		'std' => '0',
593
+		'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
594
+	),
595 595
 	array(
596 596
 		'name' => __('Enable Font Awesome', 'geodirectory'),
597 597
 		'desc' => __('When enabled all rating images will be using font awesome rating icons as images.', 'geodirectory' ),
@@ -607,368 +607,368 @@  discard block
 block discarded – undo
607 607
 		'std' => '#757575'
608 608
 	),
609 609
 
610
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
610
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
611 611
 
612
-    /* END DEFAULT STAR IMAGE*/
612
+	/* END DEFAULT STAR IMAGE*/
613 613
 
614
-    /* Detail related post settings start */
614
+	/* Detail related post settings start */
615 615
 
616
-    array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
616
+	array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
617 617
 
618
-    array(
619
-        'name' => __('Show related post listing on', 'geodirectory'),
620
-        'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
621
-        'tip' => '',
622
-        'id' => 'geodir_add_related_listing_posttypes',
623
-        'css' => 'min-width:300px;',
624
-        'std' => geodir_get_posttypes(),
625
-        'type' => 'multiselect',
626
-        'placeholder_text' => __('Select post types', 'geodirectory'),
627
-        'class' => 'chosen_select',
628
-        'options' => array_unique(geodir_post_type_setting_fun())
629
-    ),
618
+	array(
619
+		'name' => __('Show related post listing on', 'geodirectory'),
620
+		'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
621
+		'tip' => '',
622
+		'id' => 'geodir_add_related_listing_posttypes',
623
+		'css' => 'min-width:300px;',
624
+		'std' => geodir_get_posttypes(),
625
+		'type' => 'multiselect',
626
+		'placeholder_text' => __('Select post types', 'geodirectory'),
627
+		'class' => 'chosen_select',
628
+		'options' => array_unique(geodir_post_type_setting_fun())
629
+	),
630 630
 
631
-    array(
632
-        'name' => __('Relate to', 'geodirectory'),
633
-        'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
634
-        'id' => 'geodir_related_post_relate_to',
635
-        'css' => 'min-width:300px;',
636
-        'std' => 'category',
637
-        'type' => 'select',
638
-        'class' => 'chosen_select',
639
-        'options' => array_unique(array(
640
-            'category' => __('Categories', 'geodirectory'),
641
-            'tags' => __('Tags', 'geodirectory'),
642
-        ))
643
-    ),
631
+	array(
632
+		'name' => __('Relate to', 'geodirectory'),
633
+		'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
634
+		'id' => 'geodir_related_post_relate_to',
635
+		'css' => 'min-width:300px;',
636
+		'std' => 'category',
637
+		'type' => 'select',
638
+		'class' => 'chosen_select',
639
+		'options' => array_unique(array(
640
+			'category' => __('Categories', 'geodirectory'),
641
+			'tags' => __('Tags', 'geodirectory'),
642
+		))
643
+	),
644 644
 
645
-    array(
646
-        'name' => __('Layout', 'geodirectory'),
647
-        'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
648
-        'id' => 'geodir_related_post_listing_view',
649
-        'css' => 'min-width:300px;',
650
-        'std' => 'gridview_onehalf',
651
-        'type' => 'select',
652
-        'class' => 'chosen_select',
653
-        'options' => array_unique(array(
654
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
655
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
656
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
657
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
658
-            'listview' => __('List view', 'geodirectory'),
659
-        ))
660
-    ),
645
+	array(
646
+		'name' => __('Layout', 'geodirectory'),
647
+		'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
648
+		'id' => 'geodir_related_post_listing_view',
649
+		'css' => 'min-width:300px;',
650
+		'std' => 'gridview_onehalf',
651
+		'type' => 'select',
652
+		'class' => 'chosen_select',
653
+		'options' => array_unique(array(
654
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
655
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
656
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
657
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
658
+			'listview' => __('List view', 'geodirectory'),
659
+		))
660
+	),
661 661
 
662
-    array(
663
-        'name' => __('Sort by', 'geodirectory'),
664
-        'desc' => __('Set the related post listing sort by view', 'geodirectory'),
665
-        'id' => 'geodir_related_post_sortby',
666
-        'css' => 'min-width:300px;',
667
-        'std' => 'latest',
668
-        'type' => 'select',
669
-        'class' => 'chosen_select',
670
-        'options' => array_unique(array(
671
-            'latest' => __('Latest', 'geodirectory'),
672
-            'featured' => __('Featured', 'geodirectory'),
673
-            'high_review' => __('Review', 'geodirectory'),
674
-            'high_rating' => __('Rating', 'geodirectory'),
675
-            'random' => __('Random', 'geodirectory'),
676
-        ))
677
-    ),
662
+	array(
663
+		'name' => __('Sort by', 'geodirectory'),
664
+		'desc' => __('Set the related post listing sort by view', 'geodirectory'),
665
+		'id' => 'geodir_related_post_sortby',
666
+		'css' => 'min-width:300px;',
667
+		'std' => 'latest',
668
+		'type' => 'select',
669
+		'class' => 'chosen_select',
670
+		'options' => array_unique(array(
671
+			'latest' => __('Latest', 'geodirectory'),
672
+			'featured' => __('Featured', 'geodirectory'),
673
+			'high_review' => __('Review', 'geodirectory'),
674
+			'high_rating' => __('Rating', 'geodirectory'),
675
+			'random' => __('Random', 'geodirectory'),
676
+		))
677
+	),
678 678
 
679
-    array(
680
-        'name' => __('Number of posts:', 'geodirectory'),
681
-        'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
682
-        'id' => 'geodir_related_post_count',
683
-        'type' => 'text',
684
-        'css' => 'min-width:300px;',
685
-        'std' => '5' // Default value to show home top section
686
-    ),
679
+	array(
680
+		'name' => __('Number of posts:', 'geodirectory'),
681
+		'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
682
+		'id' => 'geodir_related_post_count',
683
+		'type' => 'text',
684
+		'css' => 'min-width:300px;',
685
+		'std' => '5' // Default value to show home top section
686
+	),
687 687
 
688
-    array(
689
-        'name' => __('Post excerpt', 'geodirectory'),
690
-        'desc' => __('Post content excerpt character count', 'geodirectory'),
691
-        'id' => 'geodir_related_post_excerpt',
692
-        'type' => 'text',
693
-        'css' => 'min-width:300px;',
694
-        'std' => '20' // Default value to show home top section
695
-    ),
688
+	array(
689
+		'name' => __('Post excerpt', 'geodirectory'),
690
+		'desc' => __('Post content excerpt character count', 'geodirectory'),
691
+		'id' => 'geodir_related_post_excerpt',
692
+		'type' => 'text',
693
+		'css' => 'min-width:300px;',
694
+		'std' => '20' // Default value to show home top section
695
+	),
696 696
 
697 697
 
698
-    array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
699
-    /* Detail Layout Settings end */
698
+	array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
699
+	/* Detail Layout Settings end */
700 700
 
701
-    /* Author Layout Settings Start */
701
+	/* Author Layout Settings Start */
702 702
 
703
-    array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
703
+	array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
704 704
 
705 705
 
706
-    array('name' => __('Author Page Layout Settings', 'geodirectory'),
707
-        'type' => 'sectionstart',
708
-        'desc' => '',
709
-        'id' => 'geodir_author_layout'),
706
+	array('name' => __('Author Page Layout Settings', 'geodirectory'),
707
+		'type' => 'sectionstart',
708
+		'desc' => '',
709
+		'id' => 'geodir_author_layout'),
710 710
 
711
-    array(
712
-        'name' => __('Author top section', 'geodirectory'),
713
-        'desc' => __('Show the top section of author page', 'geodirectory'),
714
-        'id' => 'geodir_show_author_top_section',
715
-        'type' => 'checkbox',
716
-        'std' => '1' // Default value to show home top section
717
-    ),
711
+	array(
712
+		'name' => __('Author top section', 'geodirectory'),
713
+		'desc' => __('Show the top section of author page', 'geodirectory'),
714
+		'id' => 'geodir_show_author_top_section',
715
+		'type' => 'checkbox',
716
+		'std' => '1' // Default value to show home top section
717
+	),
718 718
 
719
-    array(
720
-        'name' => __('Author right section', 'geodirectory'),
721
-        'desc' => __('Show the right section of author page', 'geodirectory'),
722
-        'id' => 'geodir_show_author_right_section',
723
-        'type' => 'checkbox',
724
-        'std' => '1' // Default value to show home top section
725
-    ),
719
+	array(
720
+		'name' => __('Author right section', 'geodirectory'),
721
+		'desc' => __('Show the right section of author page', 'geodirectory'),
722
+		'id' => 'geodir_show_author_right_section',
723
+		'type' => 'checkbox',
724
+		'std' => '1' // Default value to show home top section
725
+	),
726 726
 
727
-    array(
728
-        'name' => __('Width of author right section', 'geodirectory'),
729
-        'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
730
-        'id' => 'geodir_width_author_right_section',
731
-        'type' => 'text',
732
-        'css' => 'min-width:300px;',
733
-        'std' => '30' // Default value to show home top section
734
-    ),
727
+	array(
728
+		'name' => __('Width of author right section', 'geodirectory'),
729
+		'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
730
+		'id' => 'geodir_width_author_right_section',
731
+		'type' => 'text',
732
+		'css' => 'min-width:300px;',
733
+		'std' => '30' // Default value to show home top section
734
+	),
735 735
 
736
-    array(
737
-        'name' => __('Author content section view', 'geodirectory'),
738
-        'desc' => __('Set the listing view of author page', 'geodirectory'),
739
-        'id' => 'geodir_author_view',
740
-        'css' => 'min-width:300px;',
741
-        'std' => 'gridview_onehalf',
742
-        'type' => 'select',
743
-        'class' => 'chosen_select',
744
-        'options' => array_unique(array(
745
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
746
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
747
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
748
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
749
-            'listview' => __('List view', 'geodirectory'),
750
-        ))
751
-    ),
736
+	array(
737
+		'name' => __('Author content section view', 'geodirectory'),
738
+		'desc' => __('Set the listing view of author page', 'geodirectory'),
739
+		'id' => 'geodir_author_view',
740
+		'css' => 'min-width:300px;',
741
+		'std' => 'gridview_onehalf',
742
+		'type' => 'select',
743
+		'class' => 'chosen_select',
744
+		'options' => array_unique(array(
745
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
746
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
747
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
748
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
749
+			'listview' => __('List view', 'geodirectory'),
750
+		))
751
+	),
752 752
 
753
-    array(
754
-        'name' => __('Width of author content section', 'geodirectory'),
755
-        'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
756
-        'id' => 'geodir_width_author_contant_section',
757
-        'type' => 'text',
758
-        'css' => 'min-width:300px;',
759
-        'std' => '63' // Default value to show home top section
760
-    ),
753
+	array(
754
+		'name' => __('Width of author content section', 'geodirectory'),
755
+		'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
756
+		'id' => 'geodir_width_author_contant_section',
757
+		'type' => 'text',
758
+		'css' => 'min-width:300px;',
759
+		'std' => '63' // Default value to show home top section
760
+	),
761 761
 
762
-    array(
763
-        'name' => __('Author left section', 'geodirectory'),
764
-        'desc' => __('Show the left section of author page', 'geodirectory'),
765
-        'id' => 'geodir_show_author_left_section',
766
-        'type' => 'checkbox',
767
-        'std' => '0' // Default value to show home top section
768
-    ),
762
+	array(
763
+		'name' => __('Author left section', 'geodirectory'),
764
+		'desc' => __('Show the left section of author page', 'geodirectory'),
765
+		'id' => 'geodir_show_author_left_section',
766
+		'type' => 'checkbox',
767
+		'std' => '0' // Default value to show home top section
768
+	),
769 769
 
770
-    array(
771
-        'name' => __('Width of author left section', 'geodirectory'),
772
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
773
-        'id' => 'geodir_width_author_left_section',
774
-        'type' => 'text',
775
-        'css' => 'min-width:300px;',
776
-        'std' => '30' // Default value to show home top section
777
-    ),
770
+	array(
771
+		'name' => __('Width of author left section', 'geodirectory'),
772
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
773
+		'id' => 'geodir_width_author_left_section',
774
+		'type' => 'text',
775
+		'css' => 'min-width:300px;',
776
+		'std' => '30' // Default value to show home top section
777
+	),
778 778
 
779
-    array(
780
-        'name' => __('Author bottom section', 'geodirectory'),
781
-        'desc' => __('Show the bottom section of author page', 'geodirectory'),
782
-        'id' => 'geodir_show_author_bottom_section',
783
-        'type' => 'checkbox',
784
-        'std' => '0' // Default value to show home top section
785
-    ),
779
+	array(
780
+		'name' => __('Author bottom section', 'geodirectory'),
781
+		'desc' => __('Show the bottom section of author page', 'geodirectory'),
782
+		'id' => 'geodir_show_author_bottom_section',
783
+		'type' => 'checkbox',
784
+		'std' => '0' // Default value to show home top section
785
+	),
786 786
 
787 787
 
788
-    array(
789
-        'name' => __('Description word limit', 'geodirectory'),
790
-        'desc' => '',
791
-        'id' => 'geodir_author_desc_word_limit',
792
-        'type' => 'text',
793
-        'css' => 'min-width:300px;',
794
-        'std' => '50' // Default value to show home top section
795
-    ),
788
+	array(
789
+		'name' => __('Description word limit', 'geodirectory'),
790
+		'desc' => '',
791
+		'id' => 'geodir_author_desc_word_limit',
792
+		'type' => 'text',
793
+		'css' => 'min-width:300px;',
794
+		'std' => '50' // Default value to show home top section
795
+	),
796 796
 
797
-    array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
798
-    /* Author Layout Settings end */
797
+	array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
798
+	/* Author Layout Settings end */
799 799
 
800 800
 
801
-    /* Post Type Navigation Settings Start */
802
-    array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
801
+	/* Post Type Navigation Settings Start */
802
+	array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
803 803
 
804 804
 
805
-    /* Post Type Navigation Settings Start */
805
+	/* Post Type Navigation Settings Start */
806 806
 
807
-    array('name' => __('Navigation Locations', 'geodirectory'),
808
-        'type' => 'sectionstart',
809
-        'desc' => '',
810
-        'id' => 'geodir_navigation_locations'),
807
+	array('name' => __('Navigation Locations', 'geodirectory'),
808
+		'type' => 'sectionstart',
809
+		'desc' => '',
810
+		'id' => 'geodir_navigation_locations'),
811 811
 
812
-    array(
813
-        'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
814
-        'desc' => '',
815
-        'tip' => '',
816
-        'id' => 'geodir_theme_location_nav',
817
-        'css' => 'min-width:300px;',
818
-        'std' => array(),
819
-        'type' => 'multiselect',
820
-        'placeholder_text' => __('Select menu locations', 'geodirectory'),
821
-        'class' => 'chosen_select',
822
-        'options' => array_unique(geodir_theme_location_setting_fun())
823
-    ),
824
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
825
-
826
-
827
-    array('name' => __('Navigation Settings', 'geodirectory'),
828
-        'type' => 'sectionstart',
829
-        'desc' => '',
830
-        'id' => 'geodir_navigation_options'),
812
+	array(
813
+		'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
814
+		'desc' => '',
815
+		'tip' => '',
816
+		'id' => 'geodir_theme_location_nav',
817
+		'css' => 'min-width:300px;',
818
+		'std' => array(),
819
+		'type' => 'multiselect',
820
+		'placeholder_text' => __('Select menu locations', 'geodirectory'),
821
+		'class' => 'chosen_select',
822
+		'options' => array_unique(geodir_theme_location_setting_fun())
823
+	),
824
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
831 825
 
832 826
 
833
-    array(
834
-        'name' => __('Show add listing navigation in menu', 'geodirectory'),
835
-        'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
836
-        'id' => 'geodir_show_addlisting_nav',
837
-        'std' => '1',
838
-        'type' => 'checkbox'
839
-    ),
827
+	array('name' => __('Navigation Settings', 'geodirectory'),
828
+		'type' => 'sectionstart',
829
+		'desc' => '',
830
+		'id' => 'geodir_navigation_options'),
840 831
 
841
-    array(
842
-        'name' => __('Show listings navigation in menu', 'geodirectory'),
843
-        'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
844
-        'id' => 'geodir_show_listing_nav',
845
-        'std' => '1',
846
-        'type' => 'checkbox'
847
-    ),
848 832
 
849
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
833
+	array(
834
+		'name' => __('Show add listing navigation in menu', 'geodirectory'),
835
+		'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
836
+		'id' => 'geodir_show_addlisting_nav',
837
+		'std' => '1',
838
+		'type' => 'checkbox'
839
+	),
850 840
 
841
+	array(
842
+		'name' => __('Show listings navigation in menu', 'geodirectory'),
843
+		'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
844
+		'id' => 'geodir_show_listing_nav',
845
+		'std' => '1',
846
+		'type' => 'checkbox'
847
+	),
851 848
 
852
-    array('name' => __('Post Type Navigation Settings', 'geodirectory'),
853
-        'type' => 'sectionstart',
854
-        'desc' => '',
855
-        'id' => 'geodir_post_type_navigation_layout'),
856
-    array(
857
-        'name' => __('Show listing link in main navigation', 'geodirectory'),
858
-        'desc' => '',
859
-        'tip' => '',
860
-        'id' => 'geodir_add_posttype_in_main_nav',
861
-        'css' => 'min-width:300px;',
862
-        'std' => array(),
863
-        'type' => 'multiselect',
864
-        'placeholder_text' => __('Select post types', 'geodirectory'),
865
-        'class' => 'chosen_select',
866
-        'options' => array_unique(geodir_post_type_setting_fun())
867
-    ),
849
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
868 850
 
869
-    array(
870
-        'name' => __('Show listing link in listing navigation', 'geodirectory'),
871
-        'desc' => '',
872
-        'tip' => '',
873
-        'id' => 'geodir_add_posttype_in_listing_nav',
874
-        'css' => 'min-width:300px;',
875
-        'std' => geodir_get_posttypes(),
876
-        'type' => 'multiselect',
877
-        'placeholder_text' => __('Select post types', 'geodirectory'),
878
-        'class' => 'chosen_select',
879
-        'options' => array_unique(geodir_post_type_setting_fun())
880
-    ),
881 851
 
882
-    array(
883
-        'name' => __('Allow post type to add from frontend', 'geodirectory'),
884
-        'desc' => '',
885
-        'tip' => '',
886
-        'id' => 'geodir_allow_posttype_frontend',
887
-        'css' => 'min-width:300px;',
888
-        'std' => geodir_get_posttypes(),
889
-        'type' => 'multiselect',
890
-        'placeholder_text' => __('Select post types', 'geodirectory'),
891
-        'class' => 'chosen_select',
892
-        'options' => array_unique(geodir_post_type_setting_fun())
893
-    ),
852
+	array('name' => __('Post Type Navigation Settings', 'geodirectory'),
853
+		'type' => 'sectionstart',
854
+		'desc' => '',
855
+		'id' => 'geodir_post_type_navigation_layout'),
856
+	array(
857
+		'name' => __('Show listing link in main navigation', 'geodirectory'),
858
+		'desc' => '',
859
+		'tip' => '',
860
+		'id' => 'geodir_add_posttype_in_main_nav',
861
+		'css' => 'min-width:300px;',
862
+		'std' => array(),
863
+		'type' => 'multiselect',
864
+		'placeholder_text' => __('Select post types', 'geodirectory'),
865
+		'class' => 'chosen_select',
866
+		'options' => array_unique(geodir_post_type_setting_fun())
867
+	),
894 868
 
895
-    array(
896
-        'name' => __('Show add listing link in main navigation', 'geodirectory'),
897
-        'desc' => '',
898
-        'tip' => '',
899
-        'id' => 'geodir_add_listing_link_main_nav',
900
-        'css' => 'min-width:300px;',
901
-        'std' => array(),
902
-        'type' => 'multiselect',
903
-        'placeholder_text' => __('Select post types', 'geodirectory'),
904
-        'class' => 'chosen_select',
905
-        'options' => array_unique(geodir_post_type_setting_fun())
906
-    ),
869
+	array(
870
+		'name' => __('Show listing link in listing navigation', 'geodirectory'),
871
+		'desc' => '',
872
+		'tip' => '',
873
+		'id' => 'geodir_add_posttype_in_listing_nav',
874
+		'css' => 'min-width:300px;',
875
+		'std' => geodir_get_posttypes(),
876
+		'type' => 'multiselect',
877
+		'placeholder_text' => __('Select post types', 'geodirectory'),
878
+		'class' => 'chosen_select',
879
+		'options' => array_unique(geodir_post_type_setting_fun())
880
+	),
907 881
 
908
-    array(
909
-        'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
910
-        'desc' => '',
911
-        'tip' => '',
912
-        'id' => 'geodir_add_listing_link_add_listing_nav',
913
-        'css' => 'min-width:300px;',
914
-        'std' => geodir_get_posttypes(),
915
-        'type' => 'multiselect',
916
-        'class' => 'chosen_select',
917
-        'options' => array_unique(geodir_post_type_setting_fun())
918
-    ),
882
+	array(
883
+		'name' => __('Allow post type to add from frontend', 'geodirectory'),
884
+		'desc' => '',
885
+		'tip' => '',
886
+		'id' => 'geodir_allow_posttype_frontend',
887
+		'css' => 'min-width:300px;',
888
+		'std' => geodir_get_posttypes(),
889
+		'type' => 'multiselect',
890
+		'placeholder_text' => __('Select post types', 'geodirectory'),
891
+		'class' => 'chosen_select',
892
+		'options' => array_unique(geodir_post_type_setting_fun())
893
+	),
919 894
 
920
-    array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
895
+	array(
896
+		'name' => __('Show add listing link in main navigation', 'geodirectory'),
897
+		'desc' => '',
898
+		'tip' => '',
899
+		'id' => 'geodir_add_listing_link_main_nav',
900
+		'css' => 'min-width:300px;',
901
+		'std' => array(),
902
+		'type' => 'multiselect',
903
+		'placeholder_text' => __('Select post types', 'geodirectory'),
904
+		'class' => 'chosen_select',
905
+		'options' => array_unique(geodir_post_type_setting_fun())
906
+	),
921 907
 
908
+	array(
909
+		'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
910
+		'desc' => '',
911
+		'tip' => '',
912
+		'id' => 'geodir_add_listing_link_add_listing_nav',
913
+		'css' => 'min-width:300px;',
914
+		'std' => geodir_get_posttypes(),
915
+		'type' => 'multiselect',
916
+		'class' => 'chosen_select',
917
+		'options' => array_unique(geodir_post_type_setting_fun())
918
+	),
922 919
 
923
-    array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
920
+	array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
924 921
 
925 922
 
926
-    array(
927
-        'name' => __('Show add listing link in user dashboard', 'geodirectory'),
928
-        'desc' => '',
929
-        'tip' => '',
930
-        'id' => 'geodir_add_listing_link_user_dashboard',
931
-        'css' => 'min-width:300px;',
932
-        'std' => geodir_get_posttypes(),
933
-        'type' => 'multiselect',
934
-        'placeholder_text' => __('Select post types', 'geodirectory'),
935
-        'class' => 'chosen_select',
936
-        'options' => array_unique(geodir_post_type_setting_fun())
937
-    ),
923
+	array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
938 924
 
939
-    array(
940
-        'name' => __('Show favorite link in user dashboard', 'geodirectory'),
941
-        'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
942
-        'tip' => '',
943
-        'id' => 'geodir_favorite_link_user_dashboard',
944
-        'css' => 'min-width:300px;',
945
-        'std' => geodir_get_posttypes(),
946
-        'type' => 'multiselect',
947
-        'placeholder_text' => __('Select post types', 'geodirectory'),
948
-        'class' => 'chosen_select',
949
-        'options' => array_unique(geodir_post_type_setting_fun())
950
-    ),
951 925
 
952
-    array(
953
-        'name' => __('Show listing link in user dashboard', 'geodirectory'),
954
-        'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
955
-        'tip' => '',
956
-        'id' => 'geodir_listing_link_user_dashboard',
957
-        'css' => 'min-width:300px;',
958
-        'std' => geodir_get_posttypes(),
959
-        'type' => 'multiselect',
960
-        'placeholder_text' => __('Select post types', 'geodirectory'),
961
-        'class' => 'chosen_select',
962
-        'options' => array_unique(geodir_post_type_setting_fun())
963
-    ),
964
-
965
-    array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
966
-    /* Post Type Navigation Settings End */
967
-
968
-    /* Script Settings Start */
969
-    array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
970
-
971
-    /*
926
+	array(
927
+		'name' => __('Show add listing link in user dashboard', 'geodirectory'),
928
+		'desc' => '',
929
+		'tip' => '',
930
+		'id' => 'geodir_add_listing_link_user_dashboard',
931
+		'css' => 'min-width:300px;',
932
+		'std' => geodir_get_posttypes(),
933
+		'type' => 'multiselect',
934
+		'placeholder_text' => __('Select post types', 'geodirectory'),
935
+		'class' => 'chosen_select',
936
+		'options' => array_unique(geodir_post_type_setting_fun())
937
+	),
938
+
939
+	array(
940
+		'name' => __('Show favorite link in user dashboard', 'geodirectory'),
941
+		'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
942
+		'tip' => '',
943
+		'id' => 'geodir_favorite_link_user_dashboard',
944
+		'css' => 'min-width:300px;',
945
+		'std' => geodir_get_posttypes(),
946
+		'type' => 'multiselect',
947
+		'placeholder_text' => __('Select post types', 'geodirectory'),
948
+		'class' => 'chosen_select',
949
+		'options' => array_unique(geodir_post_type_setting_fun())
950
+	),
951
+
952
+	array(
953
+		'name' => __('Show listing link in user dashboard', 'geodirectory'),
954
+		'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
955
+		'tip' => '',
956
+		'id' => 'geodir_listing_link_user_dashboard',
957
+		'css' => 'min-width:300px;',
958
+		'std' => geodir_get_posttypes(),
959
+		'type' => 'multiselect',
960
+		'placeholder_text' => __('Select post types', 'geodirectory'),
961
+		'class' => 'chosen_select',
962
+		'options' => array_unique(geodir_post_type_setting_fun())
963
+	),
964
+
965
+	array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
966
+	/* Post Type Navigation Settings End */
967
+
968
+	/* Script Settings Start */
969
+	array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
970
+
971
+	/*
972 972
     array( 	'name' => __( 'Add/Remove Scripts', 'geodirectory' ),
973 973
                 'type' => 'sectionstart',
974 974
                 'desc' => '',
@@ -994,180 +994,180 @@  discard block
 block discarded – undo
994 994
 
995 995
     */
996 996
 
997
-    array('name' => __('GD Lazy Load Images', 'geodirectory'),
998
-        'type' => 'sectionstart',
999
-        'desc' => '',
1000
-        'id' => 'geodir_gdll_settings'),
997
+	array('name' => __('GD Lazy Load Images', 'geodirectory'),
998
+		'type' => 'sectionstart',
999
+		'desc' => '',
1000
+		'id' => 'geodir_gdll_settings'),
1001 1001
 
1002
-    array(
1003
-        'name' => __('Enable lazy load images?', 'geodirectory'),
1004
-        'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1005
-        'id' => 'geodir_lazy_load',
1006
-        'type' => 'checkbox',
1007
-        'std' => '1' // Default value to show home top section
1008
-    ),
1009
-    array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
1010
-
1011
-    array('name' => __('SCSS Settings (CSS combine and minify)', 'geodirectory'),
1012
-        'type' => 'sectionstart',
1013
-        'desc' => '',
1014
-        'id' => 'geodir_scss_settings'),
1002
+	array(
1003
+		'name' => __('Enable lazy load images?', 'geodirectory'),
1004
+		'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1005
+		'id' => 'geodir_lazy_load',
1006
+		'type' => 'checkbox',
1007
+		'std' => '1' // Default value to show home top section
1008
+	),
1009
+	array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
1015 1010
 
1016
-    array(
1017
-        'name' => __('Disable Core SCSS', 'geodirectory'),
1018
-        'desc' => __('Stops the CSS files being minified and output as one.', 'geodirectory'),
1019
-        'id' => 'geodir_scss_core',
1020
-        'type' => 'checkbox',
1021
-        'std' => '0' // Default value to show home top section
1022
-    ),
1011
+	array('name' => __('SCSS Settings (CSS combine and minify)', 'geodirectory'),
1012
+		'type' => 'sectionstart',
1013
+		'desc' => '',
1014
+		'id' => 'geodir_scss_settings'),
1015
+
1016
+	array(
1017
+		'name' => __('Disable Core SCSS', 'geodirectory'),
1018
+		'desc' => __('Stops the CSS files being minified and output as one.', 'geodirectory'),
1019
+		'id' => 'geodir_scss_core',
1020
+		'type' => 'checkbox',
1021
+		'std' => '0' // Default value to show home top section
1022
+	),
1023 1023
 
1024
-    array('type' => 'sectionend', 'id' => 'geodir_scss_settings'),
1024
+	array('type' => 'sectionend', 'id' => 'geodir_scss_settings'),
1025 1025
 
1026
-    array('name' => __('Script Settings', 'geodirectory'),
1027
-        'type' => 'sectionstart',
1028
-        'desc' => '',
1029
-        'id' => 'geodir_script_settings'),
1026
+	array('name' => __('Script Settings', 'geodirectory'),
1027
+		'type' => 'sectionstart',
1028
+		'desc' => '',
1029
+		'id' => 'geodir_script_settings'),
1030 1030
 
1031
-    array(
1032
-        'name' => __('Custom style css code', 'geodirectory'),
1033
-        'desc' => '',
1034
-        'id' => 'geodir_coustem_css',
1035
-        'type' => 'textarea',
1036
-        'css' => 'min-width:300px;',
1037
-        'std' => '' // Default value for the page title - changed in settings
1038
-    ),
1031
+	array(
1032
+		'name' => __('Custom style css code', 'geodirectory'),
1033
+		'desc' => '',
1034
+		'id' => 'geodir_coustem_css',
1035
+		'type' => 'textarea',
1036
+		'css' => 'min-width:300px;',
1037
+		'std' => '' // Default value for the page title - changed in settings
1038
+	),
1039 1039
 
1040
-    array(
1041
-        'name' => __('Header script code', 'geodirectory'),
1042
-        'desc' => '',
1043
-        'id' => 'geodir_header_scripts',
1044
-        'type' => 'textarea',
1045
-        'css' => 'min-width:300px;',
1046
-        'std' => '' // Default value for the page title - changed in settings
1047
-    ),
1040
+	array(
1041
+		'name' => __('Header script code', 'geodirectory'),
1042
+		'desc' => '',
1043
+		'id' => 'geodir_header_scripts',
1044
+		'type' => 'textarea',
1045
+		'css' => 'min-width:300px;',
1046
+		'std' => '' // Default value for the page title - changed in settings
1047
+	),
1048 1048
 
1049
-    array(
1050
-        'name' => __('Footer script code', 'geodirectory'),
1051
-        'desc' => '',
1052
-        'id' => 'geodir_footer_scripts',
1053
-        'type' => 'textarea',
1054
-        'css' => 'min-width:300px;',
1055
-        'std' => '' // Default value for the page title - changed in settings
1056
-    ),
1049
+	array(
1050
+		'name' => __('Footer script code', 'geodirectory'),
1051
+		'desc' => '',
1052
+		'id' => 'geodir_footer_scripts',
1053
+		'type' => 'textarea',
1054
+		'css' => 'min-width:300px;',
1055
+		'std' => '' // Default value for the page title - changed in settings
1056
+	),
1057 1057
 
1058
-    array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1059
-    /* Script Settings End */
1058
+	array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1059
+	/* Script Settings End */
1060 1060
 
1061
-    /* Map Settings Start */
1062
-    array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1061
+	/* Map Settings Start */
1062
+	array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1063 1063
 
1064
-    /* Untick the category by default on home map */
1065
-    array(
1066
-        'name' => __('Home Map Settings', 'geodirectory'),
1067
-        'type' => 'sectionstart',
1068
-        'desc' => '',
1069
-        'id' => 'geodir_home_map_section'
1070
-    ),
1071
-    array(
1072
-        'name' => __('Select category to untick by default on map', 'geodirectory'),
1073
-        'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1074
-        'tip' => '',
1075
-        'id' => 'geodir_home_map_untick',
1076
-        'css' => 'min-width:300px;',
1077
-        'std' => '',
1078
-        'type' => 'multiselect',
1079
-        'placeholder_text' => __('Select category', 'geodirectory'),
1080
-        'class' => 'chosen_select',
1081
-        'options' => geodir_home_map_cats_key_value_array()
1082
-    ),
1083
-    array(
1084
-        'type' => 'sectionend',
1085
-        'id' => 'geodir_home_map_section'
1086
-    ),
1064
+	/* Untick the category by default on home map */
1065
+	array(
1066
+		'name' => __('Home Map Settings', 'geodirectory'),
1067
+		'type' => 'sectionstart',
1068
+		'desc' => '',
1069
+		'id' => 'geodir_home_map_section'
1070
+	),
1071
+	array(
1072
+		'name' => __('Select category to untick by default on map', 'geodirectory'),
1073
+		'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1074
+		'tip' => '',
1075
+		'id' => 'geodir_home_map_untick',
1076
+		'css' => 'min-width:300px;',
1077
+		'std' => '',
1078
+		'type' => 'multiselect',
1079
+		'placeholder_text' => __('Select category', 'geodirectory'),
1080
+		'class' => 'chosen_select',
1081
+		'options' => geodir_home_map_cats_key_value_array()
1082
+	),
1083
+	array(
1084
+		'type' => 'sectionend',
1085
+		'id' => 'geodir_home_map_section'
1086
+	),
1087 1087
 
1088
-    array(
1089
-        'name' => __('Add Listing Map Settings', 'geodirectory'),
1090
-        'type' => 'sectionstart',
1091
-        'desc' => '',
1092
-        'id' => 'geodir_add_listing_map_section'
1093
-    ),
1094
-    array(
1095
-        'name' => __('Disable mouse scroll', 'geodirectory'),
1096
-        'desc' => __('Stops the mouse scroll zooming the map', 'geodirectory'),
1097
-        'id' => 'geodir_add_listing_mouse_scroll',
1098
-        'type' => 'checkbox',
1099
-        'std' => '0' // Default value to show home top section
1100
-    ),
1101
-    array(
1102
-        'type' => 'sectionend',
1103
-        'id' => 'geodir_add_listing_map_section'
1104
-    ),
1088
+	array(
1089
+		'name' => __('Add Listing Map Settings', 'geodirectory'),
1090
+		'type' => 'sectionstart',
1091
+		'desc' => '',
1092
+		'id' => 'geodir_add_listing_map_section'
1093
+	),
1094
+	array(
1095
+		'name' => __('Disable mouse scroll', 'geodirectory'),
1096
+		'desc' => __('Stops the mouse scroll zooming the map', 'geodirectory'),
1097
+		'id' => 'geodir_add_listing_mouse_scroll',
1098
+		'type' => 'checkbox',
1099
+		'std' => '0' // Default value to show home top section
1100
+	),
1101
+	array(
1102
+		'type' => 'sectionend',
1103
+		'id' => 'geodir_add_listing_map_section'
1104
+	),
1105 1105
 
1106 1106
 
1107
-    array('name' => __('Default map settings', 'geodirectory'),
1108
-        'type' => 'sectionstart',
1109
-        'desc' => '',
1110
-        'id' => 'geodir_map_default_settings'),
1107
+	array('name' => __('Default map settings', 'geodirectory'),
1108
+		'type' => 'sectionstart',
1109
+		'desc' => '',
1110
+		'id' => 'geodir_map_default_settings'),
1111 1111
 
1112
-    array(
1113
-        'name' => '',
1114
-        'desc' => '',
1115
-        'id' => 'map_default_settings',
1116
-        'type' => 'map_default_settings',
1117
-        'css' => 'min-width:300px;',
1118
-        'std' => '' // Default value for the page title - changed in settings
1119
-    ),
1112
+	array(
1113
+		'name' => '',
1114
+		'desc' => '',
1115
+		'id' => 'map_default_settings',
1116
+		'type' => 'map_default_settings',
1117
+		'css' => 'min-width:300px;',
1118
+		'std' => '' // Default value for the page title - changed in settings
1119
+	),
1120 1120
 
1121
-    array(
1122
-        'name' => __('Upload map default marker icon', 'geodirectory'),
1123
-        'desc' => '',
1124
-        'id' => 'geodir_default_marker_icon',
1125
-        'type' => 'file',
1126
-        'std' => '0',
1127
-        'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1128
-    ),
1129
-    // add option that allows enable/disable map dragging to phone devices
1130
-    array(
1131
-        'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1132
-        'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1133
-        'id' => 'geodir_map_onoff_dragging',
1134
-        'type' => 'checkbox',
1135
-        'std' => '0' // Default value to show home top section
1136
-    ),
1137
-    array(
1138
-        'name' => __('Select Maps API', 'geodirectory'),
1139
-        'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1140
-        'tip' => '',
1141
-        'id' => 'geodir_load_map',
1142
-        'css' => 'min-width:300px;',
1143
-        'std' => 'auto',
1144
-        'type' => 'select',
1145
-        'placeholder_text' => __('Select Map', 'geodirectory'),
1146
-        'options' => array(
1147
-                        'auto' => __('Load Automatic', 'geodirectory'),
1148
-                        'google' => __('Load Google Maps API', 'geodirectory'),
1149
-                        'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1150
-                        'none' => __('Disbale Maps', 'geodirectory')
1151
-                    )
1152
-    ),
1153
-
1154
-    array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1155
-
1156
-    array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1157
-        'type' => 'sectionstart',
1158
-        'desc' => '',
1159
-        'id' => 'geodir_map_settings'),
1121
+	array(
1122
+		'name' => __('Upload map default marker icon', 'geodirectory'),
1123
+		'desc' => '',
1124
+		'id' => 'geodir_default_marker_icon',
1125
+		'type' => 'file',
1126
+		'std' => '0',
1127
+		'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1128
+	),
1129
+	// add option that allows enable/disable map dragging to phone devices
1130
+	array(
1131
+		'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1132
+		'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1133
+		'id' => 'geodir_map_onoff_dragging',
1134
+		'type' => 'checkbox',
1135
+		'std' => '0' // Default value to show home top section
1136
+	),
1137
+	array(
1138
+		'name' => __('Select Maps API', 'geodirectory'),
1139
+		'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1140
+		'tip' => '',
1141
+		'id' => 'geodir_load_map',
1142
+		'css' => 'min-width:300px;',
1143
+		'std' => 'auto',
1144
+		'type' => 'select',
1145
+		'placeholder_text' => __('Select Map', 'geodirectory'),
1146
+		'options' => array(
1147
+						'auto' => __('Load Automatic', 'geodirectory'),
1148
+						'google' => __('Load Google Maps API', 'geodirectory'),
1149
+						'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1150
+						'none' => __('Disbale Maps', 'geodirectory')
1151
+					)
1152
+	),
1160 1153
 
1161
-    array(
1162
-        'name' => __('Select Map Category', 'geodirectory'),
1163
-        'desc' => '',
1164
-        'id' => 'geodir_map_settings',
1165
-        'type' => 'map',
1166
-        'css' => 'min-width:300px;',
1167
-        'std' => '' // Default value for the page title - changed in settings
1168
-    ),
1169
-
1170
-    array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1171
-    /* Map Settings End */
1154
+	array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1155
+
1156
+	array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1157
+		'type' => 'sectionstart',
1158
+		'desc' => '',
1159
+		'id' => 'geodir_map_settings'),
1160
+
1161
+	array(
1162
+		'name' => __('Select Map Category', 'geodirectory'),
1163
+		'desc' => '',
1164
+		'id' => 'geodir_map_settings',
1165
+		'type' => 'map',
1166
+		'css' => 'min-width:300px;',
1167
+		'std' => '' // Default value for the page title - changed in settings
1168
+	),
1169
+
1170
+	array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1171
+	/* Map Settings End */
1172 1172
 
1173 1173
 )); // End Design settings
Please login to merge, or discard this patch.